You want a rhythm follow
? need only find out when the beats happen and take action ?
I can’t do for you, but I can give you a lol north...
These algorithms use a combo of filtros
to decompose the audio signal into different frequency ranges, the most noticeable beats will always be in the lower frequency ranges, if you apply filters to the desired frequency ranges you will return the amplitude envelope contained in the audio, the envelope of amplitudes will signal where the beats are happening...
It’s been a long time since I wrote a brief explanation of how this works here, my code calculates how many beats per minute a song has, to identify this you need to find the beats contained in the audio, you can use this in your code and take an action ...
My code to calculate bpm (beats per minute)
will only solve half of the problem, you will also need to identify the frequency of the beat (bass or treble), for this you will need to develop a Pitch track
, I developed one for the tarsus , my code can be found here, if the frequency of the beats is already known, you can replace the pitch track by looking only at the results of the amplitudes envelope, of course in this case you will have to have two filters to decompose the audio at the expected frequencies, if you find larger peaks in the envelope of acute frequencies take action for acute beats otherwise take action for severe beat...
There is a simpler way to identify beats in real time, you can calculate the difference of decibels of the current frame with the previous frame, if the decibels exceed a certain limit proposed by you a hit happened, I wrote something very simple of how this can be done here, of course this method is nothing robust.
If the beat isn’t important, you just want to find out where the bass and the treble are? you will only need a pitch track, important detail my code for pitch track will not work well in polyphonic audios...
EDIT
I took a look at youtube on gameplays from melody's escape
, it is clear what the algorithm does, it processes all the audio before, analyzes piece by piece, finds out how many beats per minute the audio contains, notices that when the beats per minute is high the game gets faster, it also processes the audio pitch, this is done offline (before starting the game), after finishing the analysis he will already know which are the audio locations where the beats are fast or slow, where has bass and treble tones, after that he just needs to assemble the level/obstacles of the game based on analysis, of course I noticed that he also does other analyses to make the player’s rhythm feel more real, he for example calculates if there is an abrupt difference of beats, when this happens without the presence of druns e kicks
the algorithm focuses on the extraction of pitch(frequency), it focuses on whether any frequency has support and creates a slider for the note in question....
hello, you need help in a code or want to hire someone to program for you?
– Ricardo Pontual
Get this help great. Of course I would like to leave this solution here publicly so that people other than me can reuse it. Or even reused in Engines. .
– Erikcht
I don’t understand... Why are they denying my question?
– Erikcht