Is the warning correct? Warning says "trying to get the BPM from a sound directly after creation will not work" but the example does exactly that and it works.
| [[{{{image}}}|link=|]]
|
Answer: Now it is correct.
|
I updated the warning to be clearer.
The function works, but if you don't use a timer, the sound will play only after 1-3 seconds.
Compare those examples:
This will play the song immediately. Then it will show the bpm after 1-3 seconds.
function bpm ()
sound = playSound ("song.mp3")
setTimer (function ()
beats = getSoundBPM (sound)
outputChatBox ("Long code version: " .. beats)
end, 50, 1)
end
addCommandHandler ("bpm", bpm)
This will play the song only when bpm is obtained (after 1-3 seconds).
function bpm ()
sound = playSound ("song.mp3")
beats = getSoundBPM (sound)
outputChatBox ("Long code version: " .. beats)
end
addCommandHandler ("bpm", bpm)
|