Computer Music II: Sound Art

Music G6611
Tuesday 5:10-8pm
Spring 2006
Professor: Douglas Repetto [douglas at music columbia edu]
TA: Daniel Iglesia [dei2101 at columbia edu]
Our Motto: "Why, then how."
syllabus | schedule




April 4th

Building Basic Audio Circuits

Several people mentioned that they'd like to spend some more time building basic audio circuits, we'll spend today with our breadboards building a super basic, easy, and reliable audio circuit.

Basic i/o circuit with electret mic and LM386 audio amplifier

In addition to your normal gear, please bring the following parts to class:

LM386 audio amplifier ( datasheet)
7805 voltage regulator ( datasheet)
electret microphone
small speaker
caps + resistors listed in schematic

All of this is available at Radio Shack. You may need to try a few different shacks until you find one with all the components.

The schematic we'll be working from is here. This is the curcuit I used in a couple of the pieces we've looked at in class, including both Slowscan Soundwave pieces. I took this from a scan of a larger paper schematic, sorry it's a little unclear. My laptop (with all of my files) is being repaired so I'm improvising.

The unlabeled line underneath the 386 is the audio output. You may or may not need the 1k resistor, depending on what you're feeding the output to. See the LM386 datasheet for examples. IC1 is the 7805 5v voltage regulator. Give it a 9-12v input. You can also use a piezo element instead of a mic, but if you do you'll want to skip the resistor and capacitor that are hooked up to the electret in the example. Just go right into the 386. Remember that the power and ground connections are not shown for the 386, these are assumed. You'll need to look on your 386 datasheet for the appropriate pins.

Read the datasheet and try to understand how the circuit is put together. Where did the 10uf (C7) value come from?

Hopefully I'll make it to class after jury duty and we'll go through the circuit together. If I'm not there start without me and work together to build the circuit. Do some experiments. Add a volume control. Build a basic 555 oscillator circuit and feed it into the 386 amp (you don't need 200x amplification if your 555 is putting out +5v!). Add a passive lowpass filter to the output. Look at the output on the scope. Play around! Be brave!

(Someone please bring both scopes from room 324 to the classroom before class.) ***** Okay, the nice people at the court didn't want me, so I'll definitely be in class. I think we'll get through the circuit above pretty quickly, so we'll move on to some simple passive filters if we have time. We'll run the output of the LM386 above into passive low/high pass filters and look at the output on the scopes.

Passive low/high pass filters

Passive filters (aka RC filters) are a very simple way to change the spectral content of a signal. Low pass lets through low frequencies and blocks high frequencies, and high pass does the opposite. The benefit of passive filters is that they're very simple: just a resistor and a capacitor. They're called "passive" filters because those two components are passive (they don't really do much other than provide a fixed resistance or capacitance), as opposed to "active" components, like amplifiers (which actively change their behavior depending on the input signal). The down side to passive filters is that they take some of the overall energy out of your signal. So if you put an audio signal through a passive filter, not only will it block some of the frequencies, but it will also lower the overall amplitude.

Good wikipedia entries with circuit diagrams: Low Pass Filter * High Pass Filter

To find the cutoff frequency of the low or high pass filter, you just solve for:

freq = 1/(2 * PI * R_value * C_value)

Remember that the capacitor value above is in farads. We usually use microfarades (uF) when we talk about capacitor values in class. A microfarad is 1/1000000th (one millionth) of a farad. So in the equation above you need to convert the microfarad value of your capacitor to a farad value. To do that you just move the decimal place six places to the left. So a .1uF capacitor is a .0000001 farade capacitor.

If we have a 10000k resistor and a .1mF capacitor, what's our cutoff frequency?

freq = 1/(2 * 3.1459 * 10000 * .0000001) = 158.9Hz

You should be able to look at the equation and see that as the R and C values get bigger, the cutoff frequency gets smaller. Using a bigger capacitor (1uF) gives us:

freq = 1/(2 * 3.1459 * 10000 * .000001) = 15.89Hz

Here is a simple calculator you can use if you don't want do the math by hand: http://www.muzique.com/schem/filter.htm

Note that the calculator expects a capacitor value in microfarads.

Both the low and high pass filters use just a resistor and a capacitor to make the circuit. You just hook the components up in a different configuration to switch from one to the other. Variable capacitors are rare, so if you want to make a filter that you can tweak by hand it's best to use a variable resistor. Just select a potentiometer that has a useful range for your application. For example, if you want to roll off the bass on some audio, you might want a high pass filter that lets you sweep up to about 100Hz. Say you've got a .1uf capacitor handy. What value of potentiometer would you use?

100 = 1/(2 * 3.1459 * R * .0000001)
100 * R = 1/(2 * 3.1459 * .0000001)
100 * R = 1/.00000062918
100 * R = 1589370.29
R = 1589370.29/100
R = 15893.70

So a common 20k potentiometer would give you the swing you need. Set at about 3/4 resistance (15k), it will give you a ~100hz cutoff. As you make the resistance smaller the cutoff frequency will go up, and as you make it larger the cutoff frequency will go down.

Try building a 555-based oscillator and running the output through a passive lowpass filter. Listen to the resulting signal, and watch it on the scope. Hook up a potentiometer in place of the fixed resistor, and watch/listen to what happens when you change the resistance. The roll off of the high frequencies should be very obvious. Now try it with your electrect/LM386 amplifier circuit from above. The effect will probably be less obvious, but you should still hear/see the difference.

Passive filters are fine for some simple filtering tasks, but for really extreme tweaking and peaking, you need active filters. If we have time we'll get into those in a future class. Meanwhile, just do some googling around for active low/high pass filters and you should find some decent opamp-based designs. The wikipedia articles above have some simple examples.