Algorithm to identify grave and acute sounds of songs [closed]

-4

Hello. I wondered if anyone was able to make a code that identifies music beats. For example a sound of Electronic music. I say this because I wanted to make a game that it generates obstacles at the moment of the serious beat and some treble.

The simplest thing to do would be this here link

tun tun niiiiii For each tun that plays prince A, for each niii that plays prince B.

Someone? I say this because I've seen two games doing that (Crypt of Necrodancer and Scape Mellody) and I would like to debase how this is done and let this code for the audience to use.

    
asked by anonymous 09.02.2018 / 06:50

1 answer

1

You want a rhythm follow ? need only find out when the beats happen and take action?

I can not do it for you, but I can give you a lol north ...

These algorithms use a filtros combo to decompose the audio signal into different frequency bands, the most noticeable beats will always be in the lower frequency bands, if you apply filters in the desired frequency bands you will have to return the envelope of the amplitude contained in the audio, the envelope of the amplitudes will signal where the beats are happening ...

I've written a brief explanation of how this works for a long time now 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 action ...

My code to calculate bpm (beats per minute) will solve only half of the problem, you will also need to identify the frequency of the beat (serious or acute), for this you will need to develop a Pitch track , I developed one for tarsos , my code can be found #

There is a simpler way to identify the 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 beat happened, I wrote something very simple of as this can be done here , of course this method is not anything robust.

If the beat is not important, do you just want to find out where the bass and treble are? you'll just need a pitch track, important detail my code for pitch track will not work well on polyphonic audios ...

EDIT

I took a look at youtube in melody's escape gameplays, it's clear what the algorithm does, it processes all the audio before, it analyzes piece by piece, it discovers how many beats per minute the audio contains, it repairs when the beats by minute is high the game gets faster, it also processes the pitch of the audio, this is done offline (before starting the game), after finishing the analysis it will already know which are the audio locations where the beats are fast or slow, where it has severe and acute tonalities, after that he only needs to mount the level / obstacles of the game based on the analysis, of course I noticed that he also does other analysis to leave the rhythm sensation of the player more real, for example calculates if it has an abrupt difference of beats, when this happens without the presence of druns e kicks the algorithm focuses on the extraction of the pitch (frequency), it focuses on if some frequency has support and creates a sliding bar for the note in question ....

    
14.02.2018 / 00:35