Sign in to follow this  
RegularKid

Music / Beat Game

Recommended Posts

RegularKid    139
Hey guys, I'm working on a music / beat game and am having trouble figuring out a generic algorithm to detect beats / music note changes / ANYTHING that can represent changes in the music. I'm looking for something that can generate "beats" or "notes" that the player can interact with. However, it seems that anything I try is not accurate enough or can't find beats consistently throughout a song across multiple genres of music. Anyone have any ideas, advice, resources that would help me accomplish my task of having it look like the music playing is affecting the game without hard-coding something for each song? Any help would be much appreciated! Thanks!

Share this post


Link to post
Share on other sites
Nuno1    161
you said you want to do it without 'hard-coding' something. but why not ?

you dont really need to hard-code. you can create a song beats file that provide the beats for each song. most of the modern songs do have a BPM (beats per minute) that set all over the song. some do change the beat. the file will include the changes of the BPM.

trying to find out the beat is not easy and almost impossible to do perfectly. with that, if you still want to analyize the beat, you will have to use an algoritim that will take alot of CPU time.

If I were you, I would use a beat file or somthing similar.

Cheers,
Nuno1

Share this post


Link to post
Share on other sites
TheAdmiral    1122
It's much easier to detect dynamic evolution of low frequencies than high ones. If you can guarantee that the songs have a kick-drum carrying the beat with reasonable regularity, you should low-pass filter the Fourier transform of the audio stream at around 100Hz, then compute the loudness (sum & log) of the resulting down-samples. Provided the track has been normalised to 0dB, a simple threshold test (perhaps with a relaxation period of a few dozen milliseconds) should isolate individual strikes of the bass drum. From here, a greatest-common-denominator algorithm should pick out the tempo or at least an integer multiple thereof.

The situation is complicated by the variety of time signatures, synthesised instruments and heavy post-compression of popular music. It's not worth trying to create a heuristic that works all around the board (and may be realistically impossible) but with a bit of work you could get a good efficacy for the dance music typical of the rhythm-action genre.

Tell us how much you've already done, as it's difficult to know which level to advise at. If you're right at the beginnings, then I recommend you make use of FMOD's excellent FFT library.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this