Last time we had a lot of fun with volume, now it’s turn of filters. Filtering is a very complex matter and there are plenty of resources talking about filters, that must be because they’re useful and important, so let’s check them out.
We’re interested into audio signals and electronics so as you might imagine a filter is something that stops or allows some specific part of our audio signal.
Frequency filters are used to stop or allow different frequencies in our audio signal, that means treble or bass sounds. This filters are divided into 3 categories: high-pass, low-pass and band-pass. It’s easy to see what they do by their names, high-pass blocks low (bass) sounds, low-pass blocks high (treble) sounds, and band-pass blocks everything over an upper sound boundary and below a lower sound boundary, they can be made combining a high-pass and a low-pass filters.
For those who want to get deeper into the matter, check: http://www.allaboutcircuits.com/vol_2/chpt_8/1.html.
How can we achieve this by using electronic components? Well, they look like this:
The formula to get the limit frequency is: f = 1/(2*pi*R*C). If we have a fixed resistor value and want to know the capacitance value for a given frequency limit, C = 1/(2*pi*R*f). A good range of frequencies would be 20Hz to 22KHz, that’s more or less the range of audible frequencies.
Let’s build a high-pass filter which blocks everything lower than 20Hz, using a 100k resistor. With the formula we see that the value of the capacitor should be about 80nF. My filter looks like this:
If we hit the run button to simulate, we see no difference between the input signal and the output signal, same if we hear the output wav file. Why is it so important to filter if this does nothing? do you have sales commission on components or something? Well, it does something important, but before i can show you, let’s see how to get the frequency response of our circuit, that’s called a bode diagram and will help us to understand the high-pass filter here.
Click on Simulate, Edit Simulation Cmd, now click on the AC Analysis tab and configure it like the image below:
When you put the simulation string on the schematic you’ll see that the old one has changed to “;trans 10″. That means it’s commented out, so it doesn’t affect, everything after a semicolon is ignored and you could delete it if you want, or keep it for later use.
Now, before simulating, we need an input source called “AC 1” for the simulator to do the work. The fastest way of doing this is by clicking with the right mouse button on the input string that now loads a wav file, and use the semicolon to keep the string unused including before the semicolon the string “AC 1” Your schematic should look something like this:
The straight line is the magnitude of the frequency response of our circuit. That’s the dB attenuation for any given frequency between 2Hz and 22KHz. As you can see it’s a high-pass filter meaning that the attenuation part is on the left of the diagram (blocks low frequencies), but hey, wait a second, I remember we calculated a limit frequency of 20Hz for our filter, where is it? Right, let’s see what happens at 20Hz, for that click on the diagram over V(out) and you’ll see a cursor appearing and a window indicating you some values. Drag the vertical cursor as close as you can to the 20Hz point checking the actual value in the pop-up window, you’ll see that at that point the attenuation is more or less -3dB, that’s close to nothing, higher frequencies are completely allowed and lower frequencies are blocked.
We have now checked its working, but why is it useful Well it’s used to block the DC component that an audio signal may have, so it’s frequently used at input stages or after the signal has been amplified by an opamp for example, this way we block the positive or negative DC component that can be added to the signal, preventing wrong behavior or damage of other components.
To check it, add a series voltage component with a value of 2 for example, delete the ac analysis string and uncomment the transient analysis one again, it should look like this:
Now click run to simulate and see the input signal shifted by 2 volts up, down there is the output signal unaltered except it’s centered at 0V without the DC component, ready to be used.