# getSoundLevelData (Client)

> Returns the peak level of each channel over the sound's last 20 ms.

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

## Syntax

```lua
int, int|false getSoundLevelData(sound sound)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `sound` | `sound` | The `sound` element, or a `dui` element for the browser's sound. |

## Returns

The left and right levels, from 0 to 32768; or `false` if the sound is silent, paused, finished or streamed out.

## Example

```lua
addEventHandler("onClientRender", root, function()
    local left, right = getSoundLevelData(music)
    if not left then return end
    dxDrawRectangle(20, 20, left / 32768 * 200, 8, tocolor(0, 255, 0))
    dxDrawRectangle(20, 32, right / 32768 * 200, 8, tocolor(0, 255, 0))
end)
```

## See also

- [getSoundFFTData (Client)](https://wiki.mymp.gg/en/getSoundFFTData.md): Returns the frequency spectrum of what the sound is playing right now, for building visualisers.
- [getSoundWaveData (Client)](https://wiki.mymp.gg/en/getSoundWaveData.md): Returns the waveform of what the sound just played, for drawing oscilloscopes.
