Music BPM detector circuit. - Page 1
Forum section: electronics / beginners

author: Pine land
author_rank: Newbie
timestamp: December 21, 2019, 12:18:40 am
content: Hello!I want to make a beats per minute (BPM) detection circuit for a music signal to control LED lights. I have made a music box from scratch and now i want to make it pretty with fancy lights.The requirements i want:Digital output that can be used on a arduino nano as a "pulse" inputA system that behaves pretty much the same regardless of input signal amplitude (audio level)Detection up to 400 BPM.when this is connected i want as little noise as possible to get to the speakers.variable threshold for the detection (for testing)I have looked at peak detectors with diodes and op amps but i dont know if something like that will work. If we assume that the signal we want to detect the peaks of have the same max amplitude for a while (nobody changes the volume level) and its not periodic. how can we make it in hardware?Some facts:Voltage levels of 240Vac, 5V and 19,5V are already in the system.No space or weight limitThanks for readingBest regardsEirik

author: John B
author_rank: Frequent Contributor
timestamp: December 21, 2019, 02:28:37 am
content: Essentially not possible unless the music is predictable and repetitive, like doof-doof rave or club stuff where there is a bass drum every beat. You need to choose something to trigger off.If you want to trigger on transients, where it MIGHT be on the beat or a different rhythm then you'd be looking at a low-pass or maybe band-pass filter in the 40-120Hz region, then perhaps some automatic gain control before feeding that through a diode as a threshold detector. Then a comparator could trigger something like a monostable 555 which outputs a defined length output pulse.

author: alanambrose
author_rank: Frequent Contributor
timestamp: December 21, 2019, 06:40:46 pm
content: Actually I think this might be possible.I'm thinking a microphone and small amp circuit plus peak detector to pick out the amplitude envelope. Then a low pass or notch filter on theamplitudesignal below ~10Hz (400bpm is 6.7Hz). Then an adc and a simple (low frequency) fft. Average the fft results over a few seconds. And then pick out the highest peak in the fft. That will give you the overall 'pulse' frequency, which will be the bpm.I'm sure there are some fancier methods I can think of using the whole fft spectrum, but I'm guessing that the above will work OK. It won't be a perfect algorithm - for instance, if there's a pause (duh) or a free form time shift (e.g. during a cadenza) or maybe a jazz solo where the soloist deliberately plays outside the beat. But, if you think about it, if you listen to a short segment of some pieces of music, it's sometimes possible that you can't pick out the beat yourself anyway.You may even be able to pick out the time signature by looking at where the emphasis re-occurs.Of course, you will find it difficult to separate 3/4 time from 6/8 time (unless the emphasis thing above works ok) - but depending on your application that may not matter.Alan

author: ebastler
author_rank: Super Contributor
timestamp: December 22, 2019, 09:10:17 am
content: It's possible, of course, but a robust solution probably requires enough signal processing to justify a software solution. Doesn't necessarily need an actual DSP, but you will be in the realm of digital signal processing (filtering, peak detection etc.).This solution claims to work with a very simple audio interface and an Arduino to do the computation:https://damian.pecke.tt/2015/03/02/beat-detection-on-the-arduino.htmlhttps://www.hackster.io/Joao_Claro/arduino-beat-detector-d0a21fA few more ideas:https://github.com/chrvadala/music-beat-detectorhttp://mziccard.me/2015/05/28/beats-detection-algorithms-1/