GetSoundBPM

From Multi Theft Auto: Wiki
Revision as of 19:48, 18 August 2021 by LordHenry (talk | contribs) (Removed breakline.)
Jump to navigation Jump to search

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.

Syntax

int getSoundBPM ( element sound )

OOP Syntax Help! I don't understand this!

Method: sound:getBPM(...)


Required Arguments

Returns

Returns the beats per minute of the given sound.

Example

Click to collapse [-]
Client
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
end
addCommandHandler ( "bpm", bpm )

Requirements

This template will be deleted.

See Also