getSoundBPM
Client
Detects the sound's tempo in beats per minute, rounded down.
float|false getSoundBPM(sound sound)
Parameters
| Name | Type | Description |
|---|---|---|
| sound | sound | The 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)
endNoteThe first call analyses the whole sound on the spot, which can stall for a moment. The result is kept for later calls.