Saturday, September 1, 2007

Audio Analysis and Beat Detection version 2

I was bored yesterday afternoon, so I sat down and re-coded from scratch my beat detector. I received an email from Robert Hodgin ( aka Flight404 ) on some tips to getting beat detection working effectively.

His short answer was it's very tricky. He's still trying to figure out the best way to do it himself, and throughout the googleverse it's about the same story wherever you go. The best way to do it I've decided is a version very similar to his own :

Basically you divide the FFT stream up into X number of segments ( I've chosen 6 ), the sizes get larger as they move to the right of the stream ( bass to treble ). For each of these segments ( or "Zones" ), you then calculate an average value, and a "threshold" value. If the average moves higher than the threshold, then you have a dramatic increase in that zone, and possibly ( I say possibly ) a beat.

Talking is boring, how about I show you.
Windows Users : Click here ( .rar 1.4mb )
Mac Users : Click here ( .rar 1.3mb )

Unrar the files. The instructions are in the mac .rar file ( there's a readme.txt ). The program listens to your microphone. Windows users, you can go to your recording preferences and set your recording input to equal your audio output and get direct sound from winamp or wmp or whatever you use. Mac users ? no idea ( if someone figures out how to do it, tell me please !).

Let me explain what you're seeing :


The Red lines are the zone "averages". The yellow lines are the "threshold" values. When 2 or more areas trigger at the same time, I'm saying that's a "beat", the screen will flash white ( very quickly ). You'll notice it's still very jumpy, and requires a LOT of tweaking ,but I think I'm getting there. It's kinda cool though.

Watching it, I've noticed certain trends. In the next version, I'm going to experiement with the timing of the thresholds. How much higher than the current value it has to be to trigger a threshold change, and maybe even "weighting" certain zones to be worth more than others ( as they seem to contain "beat" related frequencies more often than others ... ) Suggestions ?

That's it for now. Enjoy.

- Anthony

10 comments:

Tim said...

Really good work Antiony-o you seem to be coming along really well!

I will play around with my settings and see if I can figure out the 'mac' way to do it.

Anonymous said...

this is really hoopy - I love the mathemagical analysis of music.

am keed to see you use the beats you detect in interesting and artistic ways

Anthony Massingham said...

Thanks for the comments guys.
Nice to see that *SOME* people read this blog, unlike some other people who *SHOULD* be reading it . . .

Tim said...

hehe - I have as many comments as you do... I even remember some complaining going on... It's all talk.

Anonymous said...

Well written article.

Anonymous said...

Yeah very very nice...is it possible to get the source code...really wanna play around with it...would be dope!!!! Thank you for inspiring

Unknown said...

source code please!!

Anonymous said...

Genial brief and this enter helped me alot in my college assignement. Say thank you you for your information.

Anonymous said...

Easily I to but I contemplate the post should secure more info then it has.

Anonymous said...

Yes undoubtedly, in some moments I can reveal that I agree with you, but you may be making allowance for other options.
to the article there is stationary a question as you did in the go over like a lead balloon a fall in love with delivery of this beg www.google.com/ie?as_q=samantha boscarino fansite ?
I noticed the catch-phrase you procure not used. Or you profit by the black methods of helping of the resource. I suffer with a week and do necheg