Introduction

When a cello and an oboe play the same note, you hear the same pitch — but you instantly know they are different instruments. The pitch is the same; the timbre (the tone color, the texture of the sound) is different. Those two pieces of information are tangled together inside every sound wave, and untangling them is one of the central tasks of audio analysis.

The surprising answer comes from a 1963 paper by Bogert, Healy, and Tukey. They coined the word cepstrum — an anagram of spectrum — for the result of a peculiar two-step operation: take the Fourier transform of a sound, take the logarithm of its magnitude, and then take the Fourier transform again.

That second transform turns the spectrum's repetitive harmonic pattern — the tell-tale sign of a pitched sound — into a single sharp spike. The spike's position on the new axis (which they playfully called the quefrency axis, an anagram of frequency) tells you the period of the original pitch, cleanly separated from the spectral envelope that carries timbre. Pitch and timbre, once hopelessly entangled in the waveform, now live in different regions of the cepstrum.

See the Pitch Peak

The demo below simulates a harmonic sound: a base pitch plus its overtones. Drag the slider to change the fundamental frequency and watch how a spike appears in the cepstrum at the quefrency corresponding to that pitch period.

<!-- {{c_html_intro}} -->
<p class="hint">{{hint_para}}</p>
<div class="controls">
  <label for="pitchSlider">{{label_pitch}} <span id="pitchVal">220</span> Hz</label>
  <input id="pitchSlider" type="range" min="80" max="600" value="220" step="5">
</div>
<div class="panels">
  <div class="panel">
    <div class="panel-title">{{label_spectrum}}</div>
    <canvas id="specCanvas" width="340" height="160"></canvas>
  </div>
  <div class="panel">
    <div class="panel-title">{{label_cepstrum}}</div>
    <canvas id="cepCanvas" width="340" height="160"></canvas>
  </div>
</div>
<div class="status" id="status"></div>
/* {{c_css_intro}} */
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; padding: .5rem; }
.hint { font-size: .88rem; color: #444; margin: 0 0 .8rem; line-height: 1.45; }
.controls { margin-bottom: .8rem; }
.controls label { font-size: .9rem; font-weight: 600; display: block; margin-bottom: .3rem; }
input[type=range] { width: 100%; accent-color: #1d3557; }
.panels { display: flex; gap: .8rem; flex-wrap: wrap; }
.panel { flex: 1 1 160px; min-width: 140px; }
.panel-title { font-size: .8rem; font-weight: 700; text-transform: uppercase;
               letter-spacing: .05em; color: #1d3557; margin-bottom: .3rem; }
canvas { border: 1px solid #cdd9e3; border-radius: 8px; background: #f5f8fb;
         display: block; width: 100%; max-width: 340px; }
.status { font-size: .9rem; font-weight: 600; color: #1d3557; min-height: 1.2em;
          margin-top: .6rem; }
// Code not found

Notice that the spike's position on the quefrency axis shifts when you change the pitch — while the smooth envelope of the spectrum (which encodes timbre) stays broad and spread out. The cepstrum does in one step what the ear does automatically: it pulls the periodicity of the harmonic series out of the messy spectrum and reports it as a single number.

How It Works

The elegance of the cepstrum comes from a chain of mathematical identities.

Step 1 — The source-filter model. A voiced sound is well modeled as a glottal pulse train (the pitch source, with fundamental frequency f0f_0) convolved with a vocal-tract filter (the timbre). Convolution in the time domain multiplies their Fourier transforms in the frequency domain:

X(f)=H(f)G(f)X(f) = H(f) \cdot G(f)

where H(f)H(f) is the smooth spectral envelope (timbre) and G(f)G(f) is the comb-like harmonic series (pitch).

Step 2 — The logarithm turns multiplication into addition. Taking logX(f)\log|X(f)| gives:

logX(f)=logH(f)+logG(f)\log|X(f)| = \log|H(f)| + \log|G(f)|

The smooth envelope and the comb are now added, not multiplied.

Step 3 — A second Fourier transform separates them. logH(f)\log|H(f)| varies slowly with frequency (it is the broad shape of the spectrum), while logG(f)\log|G(f)| oscillates rapidly (one spike every 1/f01/f_0 Hz). After the second transform, slow variation maps to low quefrency and rapid oscillation maps to high quefrency — specifically to a spike at quefrency q=1/f0q = 1/f_0.

The result: timbre lives near the origin, pitch is a lone spike far out. A simple liftering step (the cepstrum's word for filtering in the quefrency domain) isolates whichever one you need. This clean separation is why cepstrum-based pitch detectors outperformed every earlier method when they appeared in the 1960s, and why the idea remains central to speech coding and music analysis today.

Where It Matters

The cepstrum unlocked a family of techniques that are now woven into nearly every corner of audio technology:

  • Pitch detection in speech and music: the cepstrum peak directly gives the fundamental frequency. It works even on noisy recordings where simple autocorrelation fails, because the log-spectrum averaging suppresses noise before the second transform.
  • Mel-Frequency Cepstral Coefficients (MFCCs): the standard feature vector for automatic speech recognition since the 1980s. MFCCs warp the quefrency axis to the mel scale (which mimics human hearing) and keep only the first dozen coefficients — the low-quefrency region that carries timbre, stripped of pitch. Every time you talk to a voice assistant, MFCCs are almost certainly in the pipeline.
  • Speaker recognition and verification: voices differ in their spectral envelopes; MFCCs capture exactly that. The low-quefrency cepstrum is a compact fingerprint of a speaker's vocal tract.
  • Echo and reverberation analysis: the cepstrum was originally invented for seismology — detecting delayed echoes from geological layers. A reflected signal produces a periodic ripple in the spectrum, which becomes a spike in the cepstrum at the delay time.
  • Music transcription and chord detection: the harmonic content of musical instruments maps cleanly onto the cepstrum. Automatic music transcription systems use cepstral features to separate multiple simultaneous pitches.

Understanding the cepstrum means understanding Fourier analysis at a deeper level — it is the idea that the spectrum itself can be treated as a signal and analyzed all over again.

Conclusion

The cepstrum is a perfect example of a simple idea with enormous reach. Bogert, Healy, and Tukey noticed that taking the spectrum of the log-spectrum untangles two kinds of information that are hopelessly mixed in a raw waveform: the pitch, encoded in the periodicity of the harmonic series, and the timbre, encoded in the smooth spectral envelope.

That single fold — log then re-transform — has powered pitch detectors, speaker recognizers, automatic speech transcription, and seismic echo finders for more than sixty years. The whimsical vocabulary they invented (cepstrum, quefrency, liftering) is still in use today, a reminder that the best ideas often arrive with a sense of play.

Next time you ask a voice assistant a question, remember: somewhere inside, the math is taking the spectrum of a spectrum, and a lone spike in quefrency space is quietly reporting your fundamental frequency.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/cepstrum-pitch/Content licensed under CC BY-NC 4.0.