From Multi Theft Auto: Wiki

This function gets the beats per minute of a specific sound element.

[[|link=]] Warning: This function is expensive to call and will freeze the client about 1-3 seconds. Also, trying to get the BPM from a sound directly after creation will not work. You need a

setTimer to do this.


int getSoundBPM ( element sound )

OOP Syntax Help! I don't understand this!

Method: sound:getBPM(...)

Required Arguments


Returns the beats per minute of the given sound.


Click to collapse [-]
function bpm ()
    -- Long version (might be more understandable as example)
    sound = playSound ( "song.mp3" ) -- Play the song
    beats = getSoundBPM ( sound ) -- Get the beats per minute of the song
    outputChatBox ( "Long code version: " .. beats ) -- Output the beats to the chat box
addCommandHandler ( "bpm", bpm )


Minimum supported server n/a
Minimum supported client 1.3.0-9.04162

Note: Using this function requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.3.0-9.04162" />

See Also