GetSoundBPM: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 38: Line 38:
[[ar:getSoundBPM]]
[[ar:getSoundBPM]]
[[RO:getSoundBPM]]
[[RO:getSoundBPM]]
[[PT-BR:getSoundBPM]]

Revision as of 18:11, 15 August 2021

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