The Attenuator

2 3.5mm audio cables
                plugged into some circuit boards with components sticking off

This is the first post in a new series on this blog called "What's that horrifying thing on your desk" Where I explain horrifying things that are on or near my desk. Our first eldritch companion is this hand built audio attenuator. I promise that I can explain how it is and why it is, but before we get to that, we have to explain how does computer make sound.

How Does Computer Make Sound.

In general, a computer has some idea for what sound it would like to make. That idea can be as simple as BEEP! if the output is a 1980s style PC SPEAKER, or as complex as you want to get with modern surround sound audio setup. My specific computer sends its ideas of what sounds it wants me to hear through this USB audio card

A commercial USB
                sound card with one 3.5mm audio cable plugged into the output
which outputs 48kHz stereo. When I say "outputs," I really need to be more specific. The outputs of my audio device are intended to drive headphones, this means that the voltage it puts on the metal contacts you can plug a 3.5mm audio jack into are in the approximate range that a pair of headphones expects, and that it can deliver that voltage at a fair rate of current, namely, a fair bit more than a typical pair of headphones is likely to draw. (This is in contrast to a microphone or electric guitar or something, which might lack the required voltage, current, or both to drive headphones without amplification.) So what happens when I plug headphones into the USB audio card? The computer tells the card what sounds it wants made, and the audio card pushes and pulls electrons into and out of the wires that you plug in. The audio card pushing and pulling electrons causes electrons to move back and forth in the headphones, this causes magnetic fields in the vicinity of a permanent magnet attached to a diaphragm that moves air next to my ears that I hear as sound.

So What's the Problem

The problem is that if I just plug my headphones into my sound card, it's way too loud. I don't know what it is about my ears, but my pain threshold is much lower for loud sounds than others. I just find the defaults that are offered are painfully loud. In the sketch above more electrons means more magnetism which means more movement of the permanent magnet diaphragm which means more sound. One solution to this is to give the electrons something to do that isn't in the headphones at all. That's the idea of an attenuator. It's the sort of thing that you can buy of the shelf and indeed I did, and this is the one that I used for several years.

A commercial off
                the shelf audio attenuator with text MIN MAX VOLBOX IN OUT
The idea behind an attenuator is that it's basically a speaker that doesn't make sound that you put in series with the one that does make sound. Some of the electrons from the sound card get used up by the attenuator and therefore don't get turned into sound by the real speaker. Because the attenuator doesn't actually have to make sound, it can be made to have the following useful properties. 1) It's variable, you don't have to make a custom attenuator for each attenuation level you want to achieve. You can just make one attenuator and use less or more of it depending on how many electrons you want to use up. 2) It's cheap. A decent pair of headphones costs over $100, the best attenuator money can buy costs $18.

But That Is a Totally Reasonable Thing to Have On Your Desk What's With That Monstrosity?

The problem that I had with the off the shelf attenuator is that my left stereo channel was ever so slightly louder than my right stereo channel. Unfortunately, this sort of thing is really to be expected. The way that attenuators work is that a resistor (wire but uses up electrons) is wound around a doughnut shaped core that's set up so that a metal wiper can touch the top of every wind. You connect the input to the wiper, and the output to one end of the long wound resistor, and then you can use any length of the resistor between the end and what the wiper can touch to use up the energy of electrons before they make it to the speaker. The off the shelf attenuator that I bought is just two of those doughnut wound resistors and wipers put on the same axis and connected to the same knob. The attenuator needs to have two properties to make it convenient to use for headphone audio. The first is that at full quiet it should use up all the electrons, that is, it should be close to an open circuit. The second is that the resistance shouldn't be even (linear) because the human experience of sound isn't even but exponential. This means that most of the resistance is at the very quiet end of the attenuator. This is also where most of the manufacturing variability is. And this is what drove me to build that dead bug looking thing you saw earlier. When I put the knob for the attenuator where it was comfortable for me to listen to, the only thing keeping the left channel and the right channel at a similar volume was the manufacturer's ability to keep the resistances even at the most difficult point for them to do so. As a consequence I wound up with one channel annoyingly louder than the other.

But, Like, How Does It Work

The two boxy components are just audio attenuators, I've just attached one to each channel so that they can be adjusted independently. The two thin round banded components are fixed resistors, and cheap ones at that. Normally they would be wildly inappropriate for an audio application. Two specific things mitigate these disadvantages. First, I know that they will only ever operate in a climate controlled environment. Their relatively poor thermal stability won't ever be a problem for me. Second, I have a box of dozens of them and a multimeter, I kept trying pairs of them until I found two that were really well matched. This is something I can do, but wouldn't if I were selling them. The main point of the resistors is to soak up some of the attenuation load so that the real attenuators are operating in the center of their range where they are most sensitive. If they're not quite the same, the variable resistors can correct it out.

But How Do You Tune It

A screenshot from
                the audio editing software Audacity showing two 440Hz sine tones
                180 degrees out of phase in the left and right audio channels.
One of the first things you're taught in an electronics class is the concept of a voltage divider. If there are two points in a circuit with known voltages and current is flowing from one to the other through two resistors, the voltage at the midpoint will divide the voltage between the two points in proportion to the values of the resistances. I can use this idea to tune the attenuators so that the left and right channels are balanced. First, I have my computer put out a constant sine wave on the left channel and the inverse of that sine wave (180 degrees out of phase) on the right channel. Then I can divide these two voltages with two equal resistors and turn the left and right attenuators up and down until my multimeter reads as close to zero as I can get it. Having done this, I can unplug the resistors, and plug in my headphones confident that my left and right ears are being exposed to the same levels of sound. Finally.

A multimeter
              connected to a voltage divider across the left and right audio
              outputs of a headphone jack showing 284.5 mV AC.

Unbalanced stereo channels showing risidual voltage on the multimeter.

A multimeter
              connected to a voltage divider across the left and right audio
              outputs of a headphone jack showing 4.5 mV AC.

Tuned atttenuation of the left and right channels to match well enough to be below the noise floor.