I know there has been some discussion about a “beat-detection system” in the past. However, the person behind that post was looking to find the High and Low frequencies in the audio.
I am aware that a audios PBL or PlaybackLoudness is a static value with no relation to the audios frequencies, That being said I still want to make a system that will find the average “Beat” or Loudness to determine what tempo, beat, delay I should set on lights to act as if it were pulsating at the beat of the current track. Something similar to how this game does theirs:
My game does this, it changes the size of the part. Basically, what I do is I change the size of the part on the bottom based on PlaybackLoudness divided by 5, and add that to the original size. You could change the divisor to what works better for your part, but for mine, it’s great.
That’s an interesting idea. You’d have to sample it on a regular basis, so you’d need to use RunService:BindToRenderStep() and then mind the deltas. You’ll have to do filtering on the data,
might not need an FFT, if through the filtering you can pick out the beats. Look up Low Pass Filter, etc.
Well I did it for the fun of it when my friend was making Audio Visualizers, but basically here’s what I did:
On heartbeat I’d check the PlaybackLoudness, I have a table where I save the value on heartbeat in so I can “Average” it between all the values, that way we can see what the average of “beats” will be and I just render anything that’s higher than that as a “beat”.
(Of course if you want something more advanced then I’d suggest looking more into sound frequencies)
so basically :
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)
Probably not the best way to approach this but that’s basically what I did, yes it’s “real time” and if you’d like to see the output then : Audio Visualizer - Roblox (open devconsole if you’d like to see isbeat or not)