M MY Multiplayer: Wiki
Side
Kind

getSoundLevelData

Client

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

int, int|false getSoundLevelData(sound sound)

Parameters

NameTypeDescription
soundsoundThe 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

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