How do I filter audio?

I just successfully hooked up an electret microphone to my PC, without burning either. I use a very simple circuit to pre-amplify the signal, using a single general purpose transistor (2n3904). The microphone is electrically separated from the amp by a capacitor (.1 uF). The same trick (.01 uF) is used between amp and PC.

Audacity is able to record sound and display levels. I am getting decent range across the audible spectrum.

Now I would like to hook it up to a Picaxe and detect levels. But I want to detect levels in different regions of the audio spectrum. How do I make a filter to do that? I expect software (in a Picaxe) will not work, so I am looking for solutions in electronics.

Say, I have an input signal 2.5V +/- .5 V (I really don't know what amplitude I am really getting). And the frequencies range from 200 Hz to 8000 Hz. How would I isolate any sub-range from that? For example, all sound between 3000 and 5000 Hz? Or all sound at 4400 Hz +/- 100 Hz?

I don't need to separate it into too many sub-ranges. Just three or four would be nice. And the sub-ranges would not need to be contiguous (gaps in between are acceptable), as long as they don't overlap (by much). And I don't really care where the boundaries are exactly.

Each sub-range can have its own filter and will be fed into a separate ADC input on the picaxe.

"Give me what you've got!" And then some.

circuit

This is the pre-amp I found here on LMR.

simplepreamp.gif

I'm powering it at 5V and I am using capacitors that I had in stock. My C1= "104" or 100000 pF (100 nF = .1 uF). My C2= "103" or .01 uF. My (left channel) PC mic-input is directly connected to the indicated "output" and GND.

Not sure if this will help,

Not sure if this will help, but I came across this on Picaxe official site:

http://www.rev-ed.co.uk/docs/picaxe_sound.pdf

No and maybe yes

Joe linked to that image here. The circuit is designed to detect a certain level of sound against a given level of background noise. It does not filter any specific frequency.

The first and second stage (mic & Q1) are almost identical to the circuit I used. The third stage (Q2) is a detector. The fourth (Q3) holds the signal for a short while for the picaxe to pick it up on the emitter of Q3.

I was doing some searches
I was doing some searches for frequency filtering as well, and I think the way to go is band-pass filters, they are combination of low-pass and high-pass filters connected in series. There are lots of circuits on internet. I hope to build one as well in nearest future.

Oh, my car stereo days…

Well rik, this might help… I dunno.

If this were a signal going to a speaker (and I am assuming a signal is a signal to or from where ever) you would want your highs going to your tweets and the lows to your woofers. Inside of home speakers, and in stand-alone boxes for car stereos, we use crossovers. These crossovers are simply audio filters. They all have a “slope” in that as a frequency passes a threashold, it is attenuated to a higher degree the farther away it gets from that threashold. In very simple terms, its caps and coils… Capacitors will block out lower signals and coils will block out higher ones. Combinations of the two will produce a midrange. This is about all I got, but if you want to do some searching or wiki’ing, “crossover” is your search term.

oh yeah, iso got it…

I didn’t notice the post above and forgot to add this:

As Isotope said, “bandpass” is the name of the “midrange” crossover.

I think you can use the

I think you can use the schematic of a LED light organ for filter purpose. A normal 3 channel light organ has a high pass low pass and a band pass filter for the mid frequencies. Here is a sample schematic. You can connect your A/D ports on the LED outputs.

http://www.dieelektronikerseite.de/Circuits/3%20Kanal%20LED-Lichtorgel.htm

Thanks Peter
That’s exactly the kind of example that will get me on track. With the knowledge from all about circuits, I can even understand that schematic now. Will give it a try later.

Mildly informative link

Thanks guys for providing met with meaningful search words. This is what I found:

About AC filters: high, low, pass, block, band. Inductors or capacitors or both.

http://www.allaboutcircuits.com/vol_2/chpt_8/index.html

I’ve used several of those

I’ve used several of those simple 2 capacitor band-pass filters on a few circuits myself, and found them to be surprisingly effective. One circuit was for filtering an IR signal to remove signals below ~1kHz and above ~30kHz, which made the sensor a lot more effective at picking up the 10kHz transmitted wave. Crossover filters like CtC mentioned are great, but they’ll take up a lot more space than a basic all-capacitor design.
As you may have noticed, the two capacitors in your pre-amp circuit are actually high-pass filters themselves, ignoring any signals that are close to DC.

The circuit that RobotFreak posted is definitely a good starting point, since it has a two-stage amplifier after each filter to bring the signal level back up after filtering. This will become more important as you decrease the width of frequencies allowed through the band-pass filters, since they’re not perfect and will still attenuate the ‘good’ part of the signal to some degree.

On a slightly related topic,

On a slightly related topic, applying a discrete filter isn’t that demanding. Doing the initial calculations can be a little tricky and processor intensive, but you can let this site do it for you. It even gives you C code for the finished filter :slight_smile:

Just to try it out I created a bandpass filter and the resulting algorithm requires only 5 multiplications and 6 adds/subs.

However, it just gives you a filtered time based signal and not frequency. If you’re interesting the audio volume for different frequency intervals, you probably want to go straight to the FFT (fast fourier transform). Seems to be possible to do on a picaxe still :slight_smile: http://www.piclist.com/techref/microchip/fft/picspect.htm

 

Have you…
Thought of an op-amp bandpass filter? Pretty easy and inexpensive to do in hardware.

not yet
I know about R and C. Never used an opamp before. None in my tackle box. But I am throwing in a few into my next order. Thanks to LMR I am starting to get to know them.

C2 huh?

Could someone please explain to me what the function of C2 is in this circuit? I built this with a few components slightly different and without C2. It detects sound and still operates as a distorting pre-amplifier.

Please be a nice LMRtian and reply here.