how to only detect bass (audio detection)

Hey there,

I just completed this circuit http://www.picaxe.com/docs/picaxe_sound.pdf

It works fine, however I am using it to detect audio to make leds flash. I only want them to flash when there is a bass beat.
for example, a steady bass beat with someone singing over it would only flash with the bass beat and not with the singing.
Instead, this circuit picks up treble and bass, so whenever I play any song, the led flashes like a jumbled mess along with singing. It almost looks like it is flashing at random when music is playing.

any tips?
I am new to electronics (this is actually my first arduino project) so bear with me.

Add a lowpass filter to prevent highs from coming in.

Simplest filter is just a resistor & capacitor

Here's a calculator to the cutoff frequency, and how the high end drops off.

http://sim.okawa-denshi.jp/en/Fkeisan.htm

I'd start with a low-pass filter at about 100Hz, and experiment from there. Since you are using a microphone, the amount of bass your're getting into the microphone depends on your system and speakers. If you have a system with good bass (or with a live band) you can probably go down to 50Hz or lower. If you've got a system with a subwoofer, just putting the mic in front of the sub will help a lot.

for example, a steady bass beat with someone singing over it would only flash with the bass beat and not with the singing.

You know.... Depending on the music, the bass doesn't always match the beat perfectly either, but it should be closer to what you're loooking for. For example, the kick drum usually gives you a fairly steady beat, but the bass guitar is often a bit more complex. But if you are making a lighting effect, sometimes it's more interesting if the light doesn't flash perfectly to the beat like a metronome.

I've done some things in software (in my sketch) to improve beat detection. One thing I did was make a delay, so it won't pick-up a beat faster than about 4 beats per second (then as more time goes by, the detection threshold gets more and more sensitive 'till the next beat is triggered). I think more could be done, such as digitally filtering/tuning the "envelope" to favor loudness changes around 4 beats per second.

And, you could make it intellegent, so that once you've found the tempo, you continuously tune it to "expect" the next beat... That's how humans do it... We don't wait for every beat. We get in rhythm with the beat, and we know when the next beat is coming.

I am new to electronics (this is actually my first arduino project)

It is not an easy project to get working satisfactorily so perhaps you might want to lower your expectations of it or try something more achievable.
While a low pass filter is a good start a simple RC filter is not going to cut it here. You need a filter that drops much more quickly with frequency. This sort of thing is given by the filter's "order" an RC filter is only a first order filter and the output drops with 3dBs per octave. ( An octave is a doubling in frequency and a dB is a deci Bell en.wikipedia.org/wiki/Decibel )
You need a fourth or sixth order filter to get rid of the high frequency stuff. This involves an op-amp for every 2nd order stage and closely matched values of Rs and Cs. So a sixth order filter will consist of three second order stages. Higher Order Filters

If you pass the collector signal from Q2 to an analog pin and sample it then you could use
digital filtering for the low-pass - there's a neat digital filter calculator here: http://www.schwietering.com/jayduino/filtuino/
(it goes up to 5th order, but select a chebyshev low-pass with -3dB ripple and that will be
pretty close to a brick-wall filter)

I'd also suggest increasing the value of C2 to get some low-pass filtering in the preamp part -
particularly as the Arduino only samples at upto 10kSPS or so in default config. You want
to suppress high frequency aliases before passing to the digital filter.

(Though I may be assuming a familiarity with digital signal processing you don't have of course :slight_smile: