# getSoundLength (Shared)

> Returns the sound's length.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Sound
- **URL**: https://wiki.mymp.gg/en/getSoundLength

## Syntax

```lua
float|false getSoundLength(sound sound)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `sound` | `sound` | The `sound` element. On the client a `dui` element also works, for the browser's sound. |

## Returns

The length in seconds, or `false` if the sound was not found.

## Example

```lua
local music = playSound("sounds/track.mp3")
outputDebugString(("Duration: %.1f s"):format(getSoundLength(music)))
```

## See also

- [getSoundPosition (Shared)](https://wiki.mymp.gg/en/getSoundPosition.md): Returns the point in the track the sound is playing.
- [setSoundPosition (Shared)](https://wiki.mymp.gg/en/setSoundPosition.md): Jumps to a point in the track. The value is kept between 0 and the sound's length. On the server, the change is sent to every client.
