December 30, 2007 10

beat detection in flash.

By in flash

this is my first crack at a beat detection algorithm in flash. it works by calculating average sample energy per frame over a certain band and compares the value against the last few values stored in a buffer. if the value is larger then whats in the memory, a beat occurs. currently it supports multiple bands, so you can listen for a kick or a snare at the same time. the theory is based on this article that i found while looking at some processing examples.

ive knocked up a little example, left and right arrow keys moves the band across the spectrum, < and > keys stretch and shrink the band, up and down arrow keys increase and decrease the beat threshold. you will see two line markers jumping around, the white represents the average energy for the current frame within that band and the yellow represents the average energy in the buffer.

check out the swf here. download the source here.

10 Responses to “beat detection in flash.”

  1. Jeremy Abel says:

    Hot damn! That works pretty well, I do say! Let’s see if I can make something pretty with it…

  2. Nick says:

    Hey man, I liked this so much that I used it as a base for the bumping speakers on 5354.biz. Nice work. :)

  3. Max says:

    Hey dude, you are the first one I found who got this working well! Big up!

  4. [...] visualizers’ but none with real ‘beat’ detection. Luckely I found this post by Julapy so I wrapped it up and made a quick demo. I think for real good beat detection the way to [...]

  5. [...] är för närvarande ett mönster i sekunden. Jag försökte koppla den till en mikrofon och en taktupptäckare av något slag, så att man skulle kunna ställa den på till exempel en elektroklubb, men tyvärr [...]

  6. [...] Jonatan för tipset om att Flash 10.1 klarar att hämta data från micken, och tack (thanks) julapy för beat [...]

  7. Alama says:

    Waouww !! it’s verry good base for me.. :D i seach for making a beat detctor class in AS3. After, i like to implement this in C or C++ with Adobe Alchemy.. But your work is verry nice for immediate time.. :D

  8. Arya says:

    Checking it out man, thx!

  9. [...] l’algorithme de détection du tempo, je me suis basé sur une source Flash très efficace: beat detection in flash. Le principe est le suivant: on calcule l’énergie instantanée par frame en faisant la [...]

Leave a Reply