Go Down

Topic: The "Beat/Music Detection" code you have always wanted (Read 51526 times) previous topic - next topic


Great code, just what I was looking for, however I could do with some help with wiring the pre amp circuit.
I currently have two audio inputs, switched using a relay, and two audio outputs, also witched using a relay, whilst the audio is going between the two relays is where I want to get the sampling signal from, can I just connect the inputs to the op amps to here?


Is it possible to use an LM358 and +5V power supply instead?



You can see some pictures of the shield I built (and more instructions to follow) here:

could you invite me please, it seams your blog is not open to anybody.
thank you.


I can't send private messages, forum aparently broken :D

I want to build a unicorn-on-a-stick for the next festival that shoots beat-synced lasers from it's eyes :)

Is there any chance one could send me the code via eMail, I promise I wont build anything commercial with it :): lulzufail@gmail.com

thanks in advance and best wishes from Germany!



how can i get the code? it would have been to so much help for me.
this is just the thing i have been looking for! :-) :)


I've written some code for an ATTiny85 chip

It samples music/input and adjusts the zero crossing point of the audio automatically
Using FFT, it samples the music and creates the energy/frequency bands accordingly
Bass frequencies are allowed to pass a variable threshold and create a fixed length ON, followed by an OFF window
This trigger is passed to a sequencer algorithm with an 8 channel cross-fader
The output appears as DMX512 (a second pin also outputs the compliment signal for differential output)

In conclusion, all you need is this chip, a few external components (couple of resistors and caps), an audio in socket and a DMX out socket. My first prototype uses a SN76175 RS485 driver.

A complete Audio to DMX-driven ParCan sequencer/crossfader solution :)


This works well for running RGB LED par cans and PowerPack/Dimmers for mains powered lighting



Hi All, I was wondering what one needs to view this awesome Adrunio code in this blog. The Blog ...
http://majordecibel.blogspot.com/ how does one get invited to see this?

Thanks and very much appreciate  :)


Hey very cool! And nice video :)

I'm new to the Arduino world - and have been working on the exact same type of project (the implementation is a bit different, however). Here's my video:


You can see some pictures of the shield I built (and more instructions to follow) here:

It's seems that yout blog doesn't work anymore..
I am looking for a website like https://www.getsongbpm.com that can help me to find the BPM of a song without installing a software on my PC.
Thanks !


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.


if you want to have a digital output instead of analog, the midi timing code number serial.print 240 i think is the number flashes twenty four times per quarter note. some kind of amplitude peak detector you would be able to tune with a pot and preamp on the analog ins or another analog in that adjusts the data read parametric rate you choose. since the most common amplitude peak you will discover in music is going to be a quarter note four four beat, i mean the problem is if you just want to flip a switch thats one thing but you would have to know the time signature of a song to get the data right most music is in 4/4 maybe cut time three and fives can be put in music but usually the time signature stays at a two or four division if they think people will understand it your measures in the timing code you generate may just not stack up but since the number 240 flashes 24 times per beat you would want your peak detector to flash it that much for each beat unless you tune other analog inputs down to catch dynamic subdivisions of smaller notes. i also would suggest  that you should put an analog filter of 10nf and 50k pot maybe a high and low pass version to tune your peak detector to a freq spot in the music.

Go Up