Posts: 1
Joined: Wed Jun 13, 2018 7:06 pm

Beat Detection, BPM Averaging, LED Trigger

Wed Jun 13, 2018 7:11 pm

This should be a remarkably simple program, however I've been having some difficulty doing it myself, and even more difficulty finding previously constructed versions of this program online.

Step 1
Listen to a microphone, detect bass notes

Step 2
Average out, say, 60 samples of beats, determine BPM

Step 3
Using the "current BPM" variable, output a trigger. (in this case, turning on an LED)

I feel like this shouldn't be too hard, but I've been having some troubles. Perhaps someone out there who has gone through the trouble already can save me some trouble and help me out. Any links, ideas, or suggestions would be immensely helpful - thank you!

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: Beat Detection, BPM Averaging, LED Trigger

Thu Jun 14, 2018 9:42 pm

Beat detection is trickier than you seem to think. I recommend you read up about it. ... _detection

Implementing it in an RPi will require DSP (digital signal processing) operations, and (in the first place) a means to get the audio in (the RPi has no analogue input and requires an external ADC). I don't know whether there is enough processing power to perform the necessary FFT in real time (perhaps somebody can advise).

I'm not saying you shouldn't do it (in the spirit of experiment), just that you need to be prepared for some effort and potentially disappointing results.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

Posts: 10
Joined: Sat Aug 18, 2018 2:38 pm

Re: Beat Detection, BPM Averaging, LED Trigger

Sat Aug 18, 2018 2:54 pm


GBD is a framework for generic and realtime music beat detection. It is
designed for IoT setups based on the RPi.

The GBD framework includes support plugins for audio signal routing
between hosts, e.g. a smart phone streaming audio via Bluetooth to a
RPi hosting GBD. As the audio stream is routed through the framework,
the GBD DSP analysis library delivers beat counts to Linux POSIX shared
memory. The IoT maker can then use this information to synchronize
light events to the beats in the music stream.


Demo video (OpenGL emulation of LED control):

Return to “Graphics, sound and multimedia”