Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Learning Objectives

By the end of this chapter, you should be able to:

Introduction

A close-up photograph of a condenser microphone on a stand in a recording studio.

Figure 15.1:Recording begins with a membrane converting pressure into motion and then voltage. Shixart1985, CC BY 2.0.

Almost all the music anybody hears has been through a microphone, a wire, and a loudspeaker. Live acoustic performance is now the exception rather than the rule, and this chapter is about the chain that has replaced it.

It is a satisfying place to end, because very little in it is new. The chain turns out to be an application of everything already established:

There is one genuinely new idea, and it is a deep one: a continuous signal can be represented exactly by a finite list of numbers. The rest is engineering.

Diagrams and close views of a record groove show how its two walls encode stereo channels.

Figure 15.2:Technology Connections explains the 45/45 groove geometry that stores two audio channels in one mechanical trace. The construction is a compact example of turning two electrical signals into motion and back again.

Watch on YouTube: How Do Vinyl Records Hold Stereo Sound?

Electron-microscope images reveal the modulated groove of a vinyl record.

Figure 15.3:Ben Krasnow images a record groove directly with an electron microscope. The magnified walls make the physical waveform traced by a playback stylus visible rather than abstract.

Watch on YouTube: Vinyl LP in an Electron Microscope

15.1Microphones and Loudspeakers

Turning Pressure Into Voltage

A microphone is a pressure detector with a diaphragm, and there are two common ways to read its motion.

A dynamic microphone attaches a coil of wire to the diaphragm and suspends it in a magnetic field. Motion induces a voltage. It is rugged, needs no power, and handles very loud sources, but the coil’s mass limits its high-frequency response and its transient accuracy.

A condenser microphone makes the diaphragm one plate of a capacitor. Motion changes the capacitance and hence the voltage across it. The diaphragm can be made extremely light, so the response extends further and transients are tracked more faithfully, at the cost of needing a power supply and being more fragile.

The mechanical requirement is the same in both cases and is worth stating: the diaphragm’s resonance should be placed outside the band of interest, and it should be heavily damped, so that the microphone responds evenly rather than coloring everything with its own resonance. This is Chapter 4’s low-QQ design philosophy, for the same reason a guitar body needs it.

Polar Patterns

A microphone’s directivity is set by whether its diaphragm is exposed to pressure on one side or both.

Four polar plots showing an omnidirectional pattern as a circle, a cardioid as a heart shape with a null at the rear, a figure-of-eight with nulls at the sides, and a hypercardioid with a narrower front lobe and a small rear lobe.

Figure 15.4:The four standard patterns. Omnidirectional responds to pressure alone and hears everything equally. Figure-of-eight responds to the pressure difference across the diaphragm, so it is deaf at the sides. Cardioid is the sum of the two, giving a rear null. Hypercardioid is a different mixture, trading a small rear lobe for a narrower front.

The choice is a practical one. A cardioid rejects the room and the audience, which suits a close-miked instrument in a poor room. An omnidirectional captures the room, which suits a good hall. A figure-of-eight rejects sound from the sides, and is used to isolate two instruments facing each other.

Loudspeakers, Drivers, and Crossovers

A loudspeaker runs the microphone backwards: current through a coil in a magnetic field produces force, which moves a cone, which pushes air.

It faces a problem Chapter 2 identified. Directivity depends on the source’s size compared with the wavelength, and a single driver has one size while music spans a factor of a thousand in wavelength. A driver large enough to move air at 40 Hz beams badly at 4 kHz; one small enough to radiate 10 kHz evenly cannot shift enough air to produce bass at all.

The solution is multiple drivers, a woofer, sometimes a midrange, and a tweeter, with a crossover network dividing the signal between them. The crossover is itself a compromise, since the drivers must blend through the handover region without canceling, and crossover design is much of what distinguishes loudspeakers.

The low-frequency problem is attacked separately. A cone radiates from both faces, in opposite phase, so at long wavelengths the front and rear outputs meet around the edge and cancel. An enclosure prevents that. A sealed box is simple and well-behaved; a bass-reflex box adds a tuned port, a Helmholtz resonator (Chapter 4), that reinforces the bottom octave at the cost of a steeper roll-off below it.

A cutaway animation shows a loudspeaker magnet, voice coil, suspension, and moving cone.

Figure 15.5:Branch Education follows an electrical signal through the magnet and voice coil to the moving cone and the pressure wave radiated into the room. The cutaway view shows how the components described above fit together.

Watch on YouTube: How Do Speakers Work?

Electromagnetic Pickups: A Different Transducer

A microphone reads pressure in the air; an electric guitar’s pickup reads the string directly, and it works on a different principle entirely.

A magnetic pickup is a coil of wire wound around a permanent magnet. The magnet’s field passes through the string, provided the string is ferrous (steel, or steel-wound), and magnetizes a section of it. As the string vibrates, it disturbs that field, and the changing flux through the coil induces a voltage by Faraday’s law. No power supply, no diaphragm: the string is the diaphragm.

One consequence is easy to miss. Because the induced voltage depends on the rate of change of flux, the pickup’s output is proportional to the string’s velocity, not its displacement. This is the same distinction Chapter 10 draws between the bridge force a soundboard responds to and the string’s actual shape.

A second consequence is audible on every electric guitar. A pickup samples the string’s motion at one fixed point along its length, and Chapter 10 showed that the plucking or driving point determines which harmonics are strong: a point that is a node for some harmonic contributes almost nothing at that harmonic to the output. A neck pickup, positioned nearer the string’s midpoint, favors the fundamental and sounds warm; a bridge pickup, positioned near a region where high harmonics have their antinodes, emphasizes them and sounds bright and biting. Switching pickups, or blending them, is comb filtering by another name, chosen by ear rather than calculated.

Not every electric or amplified string instrument uses this principle. A piezoelectric pickup, common on acoustic-electric guitars, basses, and violins, is mounted under the bridge saddle and generates a voltage from mechanical stress rather than magnetic flux, so it works on nylon or gut strings that a magnetic pickup cannot see at all, and it responds to the bridge’s motion rather than the string’s.

15.2Signals and Their Imperfections

Frequency Response

The frequency response of any component is its gain against frequency. A perfect one would be flat across the audible range.

Nothing is. Loudspeakers are the worst offenders by a wide margin: even a good one varies by several decibels across its range, while a competent amplifier is flat to a fraction of a decibel. In any audio chain, the transducers, microphone, loudspeaker, and the room, are where essentially all of the frequency-response error lives.

Screenshot of the Oscilloscope simulation

Figure 15.6:An oscilloscope with a signal generator behind it. Set a sine wave and measure its period from the screen; then add a second channel and look at what a sum looks like. This is the instrument the laboratory exercises in Laboratory Exercises assume; fluency with it helps before meeting a real one.

Interactive simulation: Oscilloscope

Linear and Nonlinear Distortion

Two kinds of error, and conflating them causes endless confusion.

Linear distortion changes the balance of the frequencies present. A frequency-response error is linear distortion, and so is a phase shift. It adds nothing new: whatever comes out was in the input, at a different level. It can, in principle, be corrected by an inverse filter, which is what room equalization attempts.

Nonlinear distortion creates frequencies that were not present in the input. If the output is not proportional to the input, Chapter 3’s superposition fails, and a sum of two tones produces components at sums and differences of their frequencies. This cannot be corrected by filtering, because the new components are entangled with the wanted ones.

Two measures are quoted. Total harmonic distortion measures added harmonics of a single input tone. Intermodulation distortion measures the sum and difference components from two tones, and is the more revealing, because harmonics of a musical note are at least musically related to it while intermodulation products are not.

Noise and Dynamic Range

Every stage adds noise, and the dynamic range of a system is the span between its noise floor and the level at which it distorts.

The requirement follows from Chapter 7. An orchestra spans about 50 dB from pianissimo to fortissimo, and a good hall has a background around 25 dB SPL. A system with 90 dB of dynamic range has ample margin; one with 50 dB does not, and either the quiet passages disappear into hiss or the loud ones distort.

15.3Digital Audio

Sampling and the Nyquist Frequency

Here is the central result.

The sampling theorem. A signal containing no frequencies above fmax⁡f_{\max} is completely determined by samples taken at any rate greater than 2fmax⁡2f_{\max}.

Not approximately. Completely. The samples contain every bit of information in the original, and the original can be reconstructed from them exactly.

Left, a waveform with sample points marked as dots on vertical stems. Right, the original waveform and a reconstruction from the samples, lying exactly on top of one another.

Figure 15.7:Sampling and reconstruction. The right panel is the surprising half: the reconstruction is not a join-the-dots approximation but an exact recovery, obtained by summing a sinc\mathrm{sinc} function centered on each sample. Nothing has been lost.

The Nyquist frequency is half the sampling rate: the highest frequency a given rate can represent.

The compact disc samples at 44.1 kHz, giving a Nyquist frequency of 22.05 kHz, comfortably above the 20 kHz limit of hearing. The awkward number is historical: early digital recorders stored data on video tape, and 44.1 kHz was what fitted the existing video line rates.

Aliasing and the Anti-Aliasing Filter

The theorem’s condition, no frequencies above Nyquist, is not optional, and violating it is not a gentle degradation.

Left, a 9 Hz sine and a 1 Hz sine both passing exactly through the same sample points. Right, a folding diagram showing input frequency against the frequency actually heard, rising to Nyquist and then folding back down repeatedly.

Figure 15.8:Left: a 9 Hz signal sampled at 10 Hz produces exactly the same samples as a 1 Hz signal. Nothing in the data can distinguish them. Right: the general rule, every frequency above Nyquist is folded back below it, reappearing as a different frequency altogether.

The consequence is severe. Aliased components are not a distortion of the original; they are new frequencies at unrelated pitches, and once the samples are taken there is no way to remove them.

Waveform and spectrum of Aliasing Sweep

Figure 15.9:A sweep from 200 Hz to 7 kHz, synthesized at 8 kHz with no anti-aliasing filter. Above 4 kHz the tone folds back and descends. Nothing in the generator ever descends; what you are hearing is the folding diagram above, made audible.

What you hear: A rising tone that climbs for about half the clip, then turns round and descends, and then turns again, even though the generator is sweeping steadily upward the whole time.

Listen: Aliasing Sweep

The cure is to filter before sampling. An anti-aliasing filter removes everything above Nyquist while the signal is still continuous, so the theorem’s condition is satisfied. It must come first, after sampling, the aliased components are indistinguishable from real ones.

This is the technical reason for sampling faster than strictly necessary. A perfect filter is impossible, so a real one needs a transition band, and the gap between 20 kHz and 22.05 kHz is where the CD’s filter does its work.

Quantization, Bit Depth, and Dither

Sampling discretizes time. Quantization discretizes amplitude, rounding each sample to the nearest of a finite set of levels, and unlike sampling it is not lossless.

The error is bounded by half a level, and the resulting dynamic range is

dynamic range≈6.02 b+1.76 dB,\text{dynamic range} \approx 6.02\,b + 1.76\ \text{dB},

with bb the number of bits: the useful rule being about 6 dB per bit. A 16-bit CD gives 98 dB, comfortably beyond any listening room. A 24-bit studio format gives 146 dB, which is far beyond any microphone, and exists to provide headroom during processing rather than for final delivery.

Three panels showing a sine wave quantized to three bits with visible steps, the same with dither added showing a noisier but less stepped result, and eight-bit quantization which is nearly smooth.

Figure 15.10:Quantization at three bit depths. The middle panel shows what dither does: adding a small amount of noise before quantizing.

Dither seems perverse, deliberately adding noise to improve quality, and it is one of the more elegant ideas in signal processing. Without it, the quantization error is correlated with the signal: it follows the waveform, producing harmonic distortion that is worst on quiet passages, exactly where it is least welcome. Adding a small random noise decorrelates the error, converting it into a steady, signal-independent hiss.

The total error energy is slightly greater. The audible result is much better, because the ear is far more tolerant of steady noise than of signal-dependent distortion.

Waveform and spectrum of 16-bit, 6-bit undithered, 6-bit dithered

Figure 15.11:The same note at three quantizations. Listen to the tails. The undithered version does not merely get noisy as it decays, it becomes distorted and granular, because the error is following the signal. The dithered version has more noise overall and sounds better, which is the whole argument for dither.

What you hear: The same decaying note three times. The first is clean. The second is clean at first and then breaks up into a gritty, buzzy crackle as it fades. The third has an audible steady hiss but fades away smoothly.

Listen: 16-bit, 6-bit undithered, 6-bit dithered

15.4Perceptual Coding

Using Masking to Throw Things Away

A CD carries about 1.4 megabits per second. An MP3 at 128 kbit/s carries a tenth of that and most listeners cannot reliably tell them apart. Something is being thrown away, and the question is what.

The answer comes straight from Chapter 7. If a component is masked, the listener cannot hear it; so it does not need to be stored.

A plot of level against frequency showing the threshold of hearing in quiet as a dashed curve, a raised masked threshold around a loud 900 Hz tone, and a set of tones of which those above the threshold are marked kept and those below are marked discarded.

Figure 15.12:How a codec decides. It computes the masked threshold, the level below which nothing is audible, given what else is present, and discards everything under it. The discarded components are not approximated or attenuated; they are simply not stored.

A codec works in short blocks, and for each one it transforms to the frequency domain, computes the masked threshold from a psychoacoustic model, allocates bits so that quantization noise in each band sits just below that threshold, and encodes the result.

Waveform and spectrum of All components, Masked components removed

Figure 15.13:A loud 900 Hz tone with three quiet partials, and the same with those partials deleted. They are hard to tell apart because the partials were masked, they were present in the signal and absent from your perception of it, so removing them changed nothing you could hear.

What you hear: Two tones that sound essentially identical. The second has had three quiet partials removed entirely, and it is very hard to hear any difference at all.

Listen: All components, Masked components removed

What a Lossy Codec Keeps

The bit allocation follows the ear’s own priorities, and the consequences are visible in what codecs are good and bad at.

Low frequencies get more bits, because the critical bands are narrower there and masking is less generous.

Steady tones compress well; sharp transients compress badly. A transient needs short blocks to be located in time, and short blocks have poor frequency resolution (Chapter 5’s trade-off, in a new guise). Applause, castanets, and harpsichords are the classic hard cases, and codecs switch block length dynamically for that reason.

Stereo is exploited. Much of the two channels is common, and encoding a sum and a difference is cheaper than encoding both.

What Is Lost for Good

Two honest caveats.

Lossy is lossy. The discarded information is gone. Re-encoding an MP3, decoding and re-encoding, as happens when a file is edited or converted, applies the model to a signal that has already been altered, and the errors accumulate. Archives should be stored losslessly.

The model can be wrong. The masking model is built on average listeners and typical signals. Unusual material can defeat it, and the artifacts are characteristic: pre-echo, where a transient’s quantization noise is spread backwards in time and becomes audible before the event that caused it, and a swirling, watery quality in cymbals where the codec’s decisions change from block to block.

15.5Synthesis

Additive Synthesis: Fourier in Reverse

Three spectra. Additive shows a few individually specified partials; subtractive shows a full harmonic series with a filter curve cutting the upper partials; FM shows a symmetric cluster of sidebands.

Figure 15.14:Three routes to a spectrum. Additive builds it partial by partial, subtractive carves it out of a rich source, and FM generates a whole family of sidebands from two oscillators.

Additive synthesis builds a sound by summing sinusoids with individually chosen amplitudes and envelopes. It is Fourier’s theorem run backwards, and it can produce any periodic sound whatever.

Its weakness is not sound quality but control. A realistic instrument needs dozens of partials, each with its own time-varying amplitude, which is hundreds of parameters per note. The Hammond organ is additive synthesis with nine drawbars, and it sounds like a Hammond organ rather than like anything else, which says something about how far nine partials get you.

Subtractive Synthesis and the Source–Filter Model Again

Subtractive synthesis starts with a spectrally rich source, a sawtooth, a square, or noise, and removes what is not wanted with a filter.

This is exactly the source–filter model of Chapter 13, and the analogy is not loose: the oscillator is the vocal folds and the filter is the vocal tract. A resonant low-pass filter with a swept cutoff is imitating a formant, and a synthesizer player sweeping a filter is doing what a singer does moving their tongue.

It dominated analog synthesis because it is efficient. Two or three controls, cutoff, resonance, and an envelope on the cutoff, produce an enormous range of usable timbres, where additive synthesis needs hundreds.

Waveform and spectrum of Additive, Subtractive, FM

Figure 15.15:The same pitch by three methods. The subtractive example’s filter sweep and the FM example’s falling modulation index are doing the same job, making the spectrum change over the course of the note, which Chapter 5 identified as the thing static synthesis most obviously lacks.

What you hear: Three tones at the same pitch. The first is hollow and organ-like. The second starts bright and darkens as its filter closes. The third is metallic and bell-like, becoming purer as it decays.

Listen: Additive, Subtractive, FM

FM Synthesis and Sampling

FM synthesis, discovered by John Chowning in 1967 and commercialized in the Yamaha DX7 in 1983, uses one oscillator to modulate another’s frequency.

Modulating a carrier at fcf_c with a modulator at fmf_m produces sidebands at

fc±nfm,n=0,1,2,…f_c \pm n f_m, \qquad n = 0, 1, 2, \ldots

whose amplitudes are Bessel functions of the modulation index: the ratio of frequency deviation to modulator frequency. Raising the index spreads energy into more sidebands.

Two features made it commercially decisive. It is cheap: two oscillators produce dozens of partials, which mattered enormously with 1980s hardware. And the index can be varied over the note, so a falling index makes a bright attack settle to a pure sustain, precisely the behavior of a struck bar or a bell (Chapter 12). FM’s metallic and bell-like sounds were therefore much better than anything else available at the time.

If fcf_c and fmf_m are in a simple ratio, the sidebands land on a harmonic series and the sound is pitched. If not, they do not, and the result is inharmonic, which is the same distinction Chapter 12 drew between a string and a gong, arrived at from the other direction.

Sampling, playing back recordings of real instruments, sidesteps synthesis entirely and dominates commercial music production. Its difficulty is that a sample is one note, at one dynamic, at one moment; covering an instrument’s range requires many, and the couplings Chapter 10 described: a piano played louder is also brighter, must be reproduced by switching between samples recorded at different dynamics. A sampler that changes only loudness sounds instantly wrong.

15.6Space in a Recording

Two Speakers, One Image

Two loudspeakers can produce a sound that appears to come from a point between them, where nothing is.

The mechanism is summing localization. Identical signals from both give a phantom image at the center. Making one louder: an intensity difference, pulls the image toward it, and about 15–18 dB places it fully at one speaker. Making one earlier: a time difference, does the same, with about 1 ms sufficing.

Both work because they crudely reproduce what a real source would do at the two ears.

Localization Cues and the HRTF

Real localization uses three cues, and a recording can only approximate them.

Interaural time difference dominates below about 1.5 kHz: a sound from the left reaches the left ear up to 0.7 ms sooner.

Interaural level difference dominates above: the head shadows the far ear, by up to 20 dB at high frequencies.

Spectral cues from the pinna resolve front from back and above from below (Chapter 6), and they are the only cue that can. The whole direction-dependent filter is called the head-related transfer function.

Ordinary stereo reproduces only the first two, and only crudely, so a stereo image is a line between the speakers rather than a space. Binaural recording, made with microphones in the ears of a dummy head, captures the HRTF as well, and over headphones produces a startling sense of height and behindness. Its limitation is that it encodes somebody else’s ears, and that it breaks as soon as the listener turns their head, hence the rise of head-tracked systems.

Reverberation, Real and Artificial

Every recording must decide how much room to include, and the decision cannot be postponed: reverberation recorded into a track cannot be removed.

Modern practice therefore records dry, close-miked, in a treated room, and adds reverberation afterwards. Two methods.

Algorithmic reverberation builds a decaying field from networks of delays and filters. It is efficient, adjustable in every parameter, and can produce spaces that could not be built.

Convolution reverberation uses a measured impulse response of a real hall and convolves the dry signal with it (Chapter 14). It sounds exactly like that hall, from that seat, because it is that hall’s response, at the cost of being fixed, since the response encodes one source position, one listening position, and one room.

And so the book’s last idea is one of its first. Chapter 3 established superposition; Chapter 14 established that a room’s effect is completely described by its impulse response; and convolution reverb is nothing but those two facts applied at forty-four thousand samples per second. A recording engineer placing a soloist in the Concertgebouw is doing linear superposition, very fast.

15.7Summary

15.8Check Your Understanding

Five short, auto-graded questions cycle within one compact activity, using five different response styles.

  1. Multiple choice. Where must an anti-aliasing low-pass filter act: before sampling, after sampling, or only during playback?

  2. True or false. Dither improves low-level digital sound by reducing the total error energy introduced during quantization.

  3. Drag the words. Match dynamic and condenser microphones and omnidirectional and figure-of-eight patterns to their operating principles.

  4. Fill in the blank. At roughly 6 dB per bit, ideal 16-bit audio provides about ___ dB of dynamic range.

  5. Mark the words. Identify the two processes that create new frequency components: “FM synthesis generates sidebands, and nonlinear distortion creates new frequencies; subtractive filtering only rebalances frequencies already present.”

15.9Conceptual Questions

  1. Explain why a condenser microphone tracks transients better than a dynamic one.

  2. Explain why an omnidirectional microphone shows no proximity effect while a cardioid does.

  3. Explain why a single loudspeaker driver cannot reproduce the whole audible range, referring to source size and wavelength.

  4. A guitarist blends a neck and a bridge pickup and notices the tone changes even though nothing about the string or the amplifier has changed. Explain why, referring to the driving-point argument of Chapter 10.

  5. Distinguish linear from nonlinear distortion, and explain why only one of them can in principle be corrected.

  6. State the sampling theorem, and explain what is surprising about the word “completely” in it.

  7. Explain why an anti-aliasing filter must be applied before sampling rather than after.

  8. Explain why adding noise before quantizing improves the perceived quality, given that it increases the total error.

  9. Explain why perceptual codecs handle a sustained organ chord better than applause.

15.10Problems