This tread is a few years
old...You might just Google "Arduino Beat Detection", or maybe try to figure-out something yourself.
I made a crude beat detection algorithm once - The code was lost in a computer crash*, but I can tell you how it worked - It found a peak, then paused for about 1/4 second before looking for another equal or greater peak. Then as the milliseconds pass it would become more-sensitive so the next peak doesn't have to be exactly as loud as the previous-peak. It wasn't perfect but it was for lighting effects and I didn't
want a boring-perfect 1, 2, 3, 4, 1, 2, 3, 4... effect.
When you tap your foot (or dance) to the music, you wait and react to the beats... You "get in time" and anticipate the beat. That's how a
good beat detection algorithm would work. It would find a moving-average, figure out the timing and look for the next beat where expected, ignoring any "outliers" (missing beats or extra beats or anything that doesn't sync with the music).
If you want to "get started" with an effect that "flickers" to the loudness (NOT beat detection) take a look at my
World's Simplest Lighting Effect.
* The Arduino still works.