Disco Floor in sync with music

Hello DevForum!

I’ve made a disco room and I was wondering if there’s a way to match the disco floors color changing with the beat of the music that’s currently playing.

At the moment I’ve made it so the colors change every 0.5 seconds but this looks odd when the BPM is faster or slower.

The issue is I don’t want to have to change the time between each color change for every single song and was wondering if there’s some sort of API that can detect it automatically so I can make 1 script for all the different songs.

Any help will be greatly appreciated. :smile:

1 Like

Use renderstepped and sound.playbackloudness.

It wouldnt do any harm to record some sound data either so you could base the colour changes off of average loudness and max loudness.

How would I apply the API into a script?

RenderStepped:

PlayBackLoudness:

My sound Data Script(For saving info about sounds):

1 Like

Greetings!

To respond directly to the question, your best bet would be as what @minimic2002 has mentioned.

This reply is not so much a solution but I do hope that it does further answer the question on the feasibility of your proposed feature. Unfortunately, besides the sheer “loudness” of the sound being played, roblox does not provide any API to perform more complex audio decoding and analysis.

If you so wish to analyse the actual sound to perhaps determine the tempo of a song or a specific rhythm, you will have to use/build a third party application (outside of Roblox) in order to achieve a more robust disco system.

Essentially, it’s basically impossible to do very complex audio analysis in roblox. Your best (and pretty much only bet) is to go with the .PlaybackLoudness property of sound to do any form of meaningful analysis.

1 Like

That why I have provided my sound data script. It saves all kinds of data about a sound. It also listens to sounds in the background so while one song is playing it can get the data of another.

But for some things like the tempo it would be a bit more complicated and would involve saving quite a bit more data and putting a sound through a listener twice.

Overall id say just stick with playback loudness for now.

The script looks awesome for analysing what properties of sound that roblox provides!

Unfortunately, roblox does not really provide any data for say the analysis of real-time frequency (cue the Fourier Transform :laughing: ). I am certain that there are previous devforum articles of others requesting an expansion of the sound API to give developers even more abilities to manipulate sound data. However, I would not expect anything like this in the horizon.

Going back to the question, I would stick with .PlaybackLoudness too!