Have you considered checking the devforum for a topic like this first?
It’s a bad habit, and I sometimes succumb to it aswell, but I found a topic similar that was solved almost 4 years ago.
I have tried the answer to this post, but have no idea how to print the value of the BPM.
PS - If all else fails, i would like to match the Playbackspeed of my clock SFX to the background music. is there any way to preview 2 sounds at the same time, to make this easier?
local loudnessValues = {}
game:GetService("RunService").Heartbeat:Connect(function()
local average = 0
for _,v in ipairs(loudnessValues) do
average = average + v
end
average = average / #loudnessValues
local isBeat = sound.PlaybackLoudness >= average
--visualizing code basted on isBeat etc.
loudnessValues[#loudnessValues + 1] = sound.PlaybackLoudness
end)
The value of the BPM would be average I think. Try to print average later in the function, or make it a variable outside of the function and print it, after the function has ran.
p.s. sorry for not reading the second question, i dont know how to preview 2 sounds at the same time sorry
This keeps printing 0 for some reason. I put it at the end of the function, as leaving it after “end)” would mean its unknown. should i put “local average” out of the function, and leave the print out of the function aswell?