Audio Bass beat detection

Hello together.

I am looking for a (I think) quite simple thing... but can't find a proper solution.

I am working on a magic mirror with sound reactive LEDs, as a xmas gift for my brother (time is running). It is working with an Arduino Nano and an Adafruit MAX4466 mic. Plus a remote control to switch different modes.

I had the great idea to make one stroboscope mode. At a bass/low frequency shall the LEDs light up bright white for X ms. The problem: How to detect the bass?

The MAX4466 is connected to A0.

Most examples or libraries are to complicated and/or I don't understand them. They are "to much" or for serial input or not for Arduino (Nano). Is there any simple easy way to find out the low frequencies from a MAX4466 input?

Low pass filter, then threshold.

Thanks for your answer Mark. Do you have any recommendation for a low pass filter for my purposes?

Well it could be basically all done in analog before the ADC, or as a digital filter on the sampled values, which would be more work, but more flexible.

For 150 Hz cutoff a simple RC filter of 10k and 100nF would work.

Most of the energy of an audio signal is in the bass regions anyway, you could threshold, or envelop detect with some hold off to avoid triggering on transients, or even calculate the rms value on the fly for portions of time and trigger when a portion's rms value is above a theshold.

Dynamically changing the threshold to match the loudness will be useful, in which case the rms trick can provide a baseline value to set the threshold from.

Take a look at my [u]World's Simplest Effect[/u]. It's NOT beat detection but it "flickers" the LED/light on when the signal is above average and off when below average. That gives you lots of "lighting action" and it automatically adjusts to volume changes.

Most examples or libraries are to complicated and/or I don't understand them.

I believe it is somewhat complicated but I've never looked-into how they work. And I'd suspect they don't always work perfectly. ;)

They are "to much" or for serial input or not for Arduino (Nano).

I don't think that should be true unless you're filtering the bass with a software filter or FFT... The actual beats are slow for a computer running at MHz speed. (BTW - You're not reading serial input, you are reading the analog input.)

I'm not sure if filtering out everything but the bass is always best for beat detection... For example, sometimes the snare drum or something else "stands out" so it depends on the music.

I lost the code when my computer crashed, but I've made a "crude" beat detector, starting with my "simplest effect" concept but I use the highest value in the array as a threshold instead of using the average.

I didn't use any audio-frequency filtering but I used some timing & logic. There was a time delay of about 200 mS (1/5th of a second) after a beat detection so it doesn't re-trigger too soon. Then it starts looking for another peak. And, the trigger-threshold starts falling, so as time passes after the delay it gets more sensitive, so sooner-or-later it's going to get triggered even if the next beat isn't as strong as the 1st.

My method is imperfect but I'm just trying to make an interesting effect and a perfect 1, 2, 3, 4 flashing-light gets boring after about one song... The effect I made gets boring too, but I randomly switch to other effects with variations of every effect.

A better beat detector would be "smarter" and find the actual beat-timing over a few measures (or more) and try to sync with it, and it wouldn't matter if there is an occasional "weak" beat or a missing-beat or rest... When we tap our foot (or dance) we don't wait for the beat, we anticipate it and we get in-sync with it...