M MY Multiplayer: Wiki
Side
Kind

getSoundBPM

Client

Detects the sound's tempo in beats per minute, rounded down.

float|false getSoundBPM(sound sound)

Parameters

NameTypeDescription
soundsoundThe sound element, or a dui element for the browser's sound.

Returns

The beats per minute, or false if no tempo was detected.

Example

local music = playSound("sounds/track.mp3", true)
local bpm = getSoundBPM(music)
if bpm then
    outputDebugString("BPM: " .. bpm)
end
NoteThe first call analyses the whole sound on the spot, which can stall for a moment. The result is kept for later calls.

See also