The Building Blocks of Electronic Sound.

(watch on youtube)

Script

[“What hath God wrought” typed in Morse code.]

This phrase marked the start of a new era. When Samuel Morse sent the first long-distance telegram from Washington to Baltimore, he couldn’t have predicted that electronic communication would become as essential as food and water. Like any other great invention, we’ve used it for better and for worse.

But today’s story isn’t about the duality of man. The real triumph isn’t that we use our incredible tools to save and destroy the world; it’s that we have enough energy to embrace the bizarre, the amusing, the artistic.

Take Elisha Gray. The telegraph had only existed a few decades when he made a discovery. When you press the lever once a second, you transmit a tone at a rate of one hertz. Twice a second, two hertz. And so on.

If you press the lever fast enough, you can make musical notes. 262 Hz is middle C; 440 the A above that. This is true when you play conventional instruments, like the violin or the piano, and it’s still true with the telegraph.

But nobody can press a lever 400 times a second, so Gray attached a special spring to do the pressing for him. He combined twelve of these machines [actually 16], each with differently tuned springs, to create one of the first electronic instruments: the Musical Telegraph.[1]

There are no special tricks to Gray’s instrument; he simply used basic principles of physics. In the 150 years since, we’ve harnessed the power of electricity to make noises that would sound like a Satanic thunderstorm to nineteenth century ears. But we didn’t get here with dark magic. With just a few more scientific tools, we can make any sound we like.

Let’s start by looking at the violin. The sound comes from strings that vibrate when plucked or bowed. These vibrations rattle the surrounding air molecules, propagating to anything that’ll listen.

But what’s the string doing? Viewed from the side, it looks like the string is bouncing up and down, trying to pull itself back to the center. It acts like a spring.

When you expand or contract a spring, you feel some resistance. The spring is always trying to return to its original length. It applies a force that grows linearly as you stretch the spring a distance x. Some springs are harder to stretch than others, so we multiply this distance by a constant k to account for its stiffness. The force is always in the opposite direction of the stretching or squishing, so we add a negative sign. This is known as Hooke’s law: the force an ideal spring applies is -kx.

Take a block of mass m and attach it to a spring. If you stretch the spring, then let go, the resisting force causes the spring to retract.

Once the spring is at its original length, the mass keeps moving, because there’s no force to stop it. The spring starts to compress, so now it applies a force in the other direction. This slows the mass until it stops and starts moving back down. Now we’re back to the center, speeding in the other direction. Without gravity or air resistance, this mass is destined to oscillate forever.

While we’re stuck here, let’s see if we can learn something useful. If we plot the height of this mass over time, it looks like a sine wave. But we’ll have to do some actual mathematics to confirm our intuition. By Newton’s second law, the forces acting on a mass dictate how its velocity changes over time. Experts of the trade call this change “acceleration.” There’s only one force here, and we already know it’s -kx.

Let’s define the height of the block over time as a function x(t). First, we’ll move things around so x gets the left side to itself. k and m never change; they’re inherent properties of the spring and mass. But we have a problem: a does change over time. Acceleration is change in velocity, and velocity is change in position. We can see the position is changing. The velocity must be changing too, because the mass speeds up, slows down, and changes direction. Since the velocity is changing, the acceleration can’t be zero either.

So we have a function of time on both sides of the equation. How do we resolve this? If you’re comfortable with calculus, sit back and relax for a moment. The rest of you, strap in.

You’ve probably heard of the slope of a linear function: rise over run. You can expand this to many other functions by taking “rise over run” for two points that get closer together. As the distance between the points approaches zero, the line between the points approaches the tangent line to the function. We can derive a new function based on the slope of the tangent line for all points on the original function. We call this a derivative. I’ll call the derivative of our function “x prime”. Velocity is change in position, so that’s x’. Acceleration is change in velocity, so that’s x prime prime, or x”. So x(t) is -mx”/k.

Now the challenge is to find a function where x is -x’’. Because k and m are constant, we can scale this mysterious function to get our answer. To uncover this mystery, we’ll look at rotating objects.

Imagine a ball moving along a circle of radius 1 at constant speed. Let’s draw its position from the origin as a vector s. We can find the velocity v just as we found the derivative. Measure how far the ball travels in a short time dt. Since speed is distance over time, we have to scale this vector by 1 / dt. As dt gets smaller, the vector gets closer to being tangent to the circle, just as a derivative is tangent to its function.

This means the velocity is perpendicular to the position, which means it’s also rotating. So the velocity of the velocity—the acceleration—is perpendicular as well. The acceleration vector a points to the center of the circle, in the opposite direction of s. There’s the negative we’re looking for.

We can break these vectors down into their x- and y-components. If we look at the y-component, its velocity is zero, and acceleration is pointing down. When the height is zero, its velocity is pointing down and its acceleration is zero. Now the acceleration is pushing back in the other direction. Look familiar?

If we make a right triangle with s and the x-axis, the lengths of the legs define the sine and cosine functions. So our bouncing mass doesn’t just look like a sine wave—it is a sine wave.

This wave represents the least complicated oscillation along a line. Its purity is unmatched by other types of repetitive motion because of its ties to the circle.

With that in mind, let’s make an electronic instrument. We should build a circuit that makes a sine wave to model the vibration of air molecules. We’ll need some wire, a capacitor, and an inductor.

A capacitor is made of two conductive plates, like metal, separated by an insulator, like air. If a circuit is a highway, the capacitor is a broken bridge, frustrating electrons on their morning commute. Hook a capacitor to a battery, you force all the electrons to one side of the bridge, charging the capacitor. Congratulations, you’ve caused a major traffic jam. Remove the battery and close the circuit, all the electrons move freely again, discharging the capacitor. You can close the circuit on a charged capacitor by touching the exposed wires with your bare hands, which can kill you. So don’t do that.

An inductor is made of wire wound into a coil. Inductors resist change in the flow of electrons. There’s no good highway analogy here because the inductor doesn’t care how fast the electrons move; it would just prefer they not speed up or slow down. The inductor creates a force opposing the acceleration of electrons, like the resisting force on a spring.

This circuit has a pre-charged capacitor. As the capacitor discharges, the inductor prevents the electrons from escaping as quickly as they would like. Once they’re fully dispersed, the inductor forces the electrons to keep flowing until they’re stranded on the other side of the capacitor. The electrons move back and forth between the two ends of the capacitor forever, just as our mass bounces up and down on the spring.

We can get a spring-like equation from this circuit by measuring the electromotive forces across the capacitor and the inductor. This force is also known as voltage. Our circuit is in a loop, so the voltages add up to zero. The voltage across a capacitor increases linearly with the charge it stores. The voltage across an inductor opposes the change in current over time. Since current is a change in charge, this means we have a charge function Q(t) equal to some negative constant times Q’’. There’s the sine we were looking for.

This is an LC circuit. The C stands for Capacitor, and the L stands for... Lnductor. Sorry, but I was taken. By current. Awkward naming aside, we can tune our circuit to any frequency by changing the values of these components. If we could adjust these values quickly, we could make different notes with the same circuit.

But we can’t make an instrument just yet. We have an oscillating circuit, but you can’t hear electrons zipping back and forth. You need to hook this circuit up to some kind of machine that vibrates in tandem with the circuit. That’s just a fancy way to say “install a speaker”. But these electrons aren’t powerful enough on their own to move the speaker, so we need something to amplify the signal. That’s just a fancy way to say “use an amplifier.”

Now we’re ready to build an instrument. Although it looks like someone did the hard work for us. Meet Leon Theremin, inventor of... the theremin. You might have heard it used as lazy shorthand for spooky Halloween times. But it’s surprisingly expressive near the hands of a skilled player.

This instrument uses two LC circuits and a radio antenna. Both circuits are tuned to around 500 kilohertz, about two octaves above the hearing range of bats. One circuit uses a variable capacitor attached to the antenna. Human beings are just capacitive enough that this antenna increases the frequency of the circuit as we approach it.

But how does it make sound when the frequencies are so high? Let’s play a sine wave at 440 Hz: [beep]. Now let’s play a sine wave at 441 Hz: [beep]. The sound starts to fade in and out once a second. Move that second wave to 442 Hz, it fades twice a second. As you increase the difference between the two tones, you start to make a third musical tone. 550 Hz makes an A two octaves below the original A. This note sticks around as the involved frequencies go higher than any living thing can hear.

Now we have an instrument that can make any audible frequency. But even Mr. Theremin thought the sine wave was boring on its own. His patent includes diagrams for tuning multiple pairs of LC circuits to different frequencies to create richer sounds. How does stacking sine waves make more interesting sounds? Let’s hear ten sine waves at random frequencies: [beep]. Okay. Sounds like we’ll have to be more thoughtful.

Let’s try integer multiples—that’s simple enough. We’ll start with 220 Hz, a low A. Now add a wave of twice the frequency, three times, four times, this is starting to get out of hand. Now the wave is too big to fit in our box. Let’s try dividing the height of the nth wave by n.

Back to 220 Hz, add a wave at double the frequency, but this time make the wave only half as tall. Add another wave at triple the frequency, but make it a third as tall. And so on. Now this wave is starting to look like something. Combining our smooth, inoffensive sines creates a harsh, irritating sawtooth wave.

But we still recognize it as a low A. It feels like a paradox that you can play a low A on multiple instruments and it sounds similar enough to be the same note but different enough to be recognized as a clarinet, or a bassoon, or a sawtooth wave. Common to all these sounds is a fundamental frequency, a sine wave at 220 Hz. Unique to each instrument is a stack of sine waves over the fundamental that grow, shift, and decay over time. We call these overtones.

Some sounds have a distinct sense of pitch, like pianos and violins. Others don’t, like snare drums and leaves rustling in the wind. Others still are somewhere in the middle, like crappy out of tune pianos and beat-up church bells. All of these can be described as a stack of sine waves. When a sound’s overtones are close to integer multiples of the fundamental, it sounds pitched. When a sound’s overtones are randomly distributed, it sounds unpitched. We give the integer multiples of the fundamental a special name: harmonics.

But frequency isn’t the only important thing about these waves. We can take a set of overtones and shift them in time to create different shapes. This process is called phase shifting. Let’s take just the odd harmonics of low A this time. If we start all the waves in the same place, taking care to divide the heights to contain the wave, we get something that looks squarish. If we could stack infinite sine waves, we’d get a perfect square. If we take every other overtone and flip it upside down, we get... huh. That’s weird. Our square wave was well contained, but this new wave doesn’t fit in the box. If we square the denominator of these terms, we get a triangle wave.

By stacking a bunch of sine waves, we made three wave shapes common to synthesizers of the last 60 years: triangle, square, and sawtooth. No synth designer built infinite LC circuits to make these waves, the cowards; they used a new class of oscillators invented to produce these shapes naturally. But that’s another show.

This business of stacking sine waves is a field of mathematics called Fourier analysis. It isn’t unique to sound—Joseph Fourier discovered this from studying heat diffusing through metal. We’re exploiting this brilliant discovery to better understand music, just as we exploited circuit design and differential equations. There we go using science for whimsy again.

Footnotes

  1. Gray would go on to build a prototype for the telephone, but Alexander Graham Bell’s lawyer made it to the patent office first. ↩︎

Sources

Errata

None that haven’t already been mentioned in the video.