Cepstrum and MFCC

A voice is a buzz played through a throat, and a spectrum shows both at once. Take a logarithm, then one more transform, and pitch and vowel land in different places.

Learn how speech engineers pull the pitch out of a voice and the vowel out of the same voice, and how that trick became the features behind speech recognition and speaker identification.

Pick a vowel, slide the pitch, then slide the cut-off. Watch the pitch show up as one spike in the lower plot, and the vowel show up as the smooth purple curve on top. Then we build, piece by piece, the logarithm trick, the cepstrum, the mel scale, the filter bank, the MFCC and a speaker identifier.

You need the idea of a spectrum (how much of each pitch is in a sound) and a little comfort with logarithms. We teach convolution and the rest from zero.

Based on Lecture 13 (the slide deck titled Cepstrum) of Stanford EE269: Signal Processing for Machine Learning, taught by Mert Pilanci. Course slides. Every idea is re-taught here in our own words and devices; it builds on Lecture 12, Linear Systems.

Split a voice in two

125 Hz
22

A synthetic voice, computed live in your browser: a train of pulses at the pitch you choose, passed through three resonators set to typical adult male formants for each vowel (Peterson and Barney, 1952), sampled at 8,000 per second. The analysis frame is 512 samples (64 ms) with a Hamming window. Illustrative, not a recording. The pitch is rounded to a whole number of samples per period.

Chapter 0

Why a Voice Is Hard to Pull Apart

See why a filter cleans up added noise but cannot separate two signals that were convolved, and meet the problem the cepstrum solves

You say “ah” into your phone. The phone records a wiggly line, 8,000 numbers every second. Two different questions hide inside that line. How high is your voice? And which vowel did you say?

Pitch and vowel are separate facts. You can say “ah” low, and you can say it high. You can sing “ee” on the same note as the “ah”. But the recording stores one line, and both facts are mixed into it. A speech recogniser wants the vowel and wants to ignore the pitch. A pitch tracker wants the opposite.

This lecture, number 13 of Stanford EE269, builds a tool that unmixes them. First we need to see why the mix is hard.

The easy mix: noise added on top

Start with the case your tools already handle. A signal is a list of numbers over time, written x[n], where n counts the samples. Suppose the signal carries a low hum of information, and a hiss of noise w[n] is added on top. The recording is

y[n]
What the microphone recorded: one number for each sample n.
x[n]
The useful signal, such as a spoken word.
w[n]
The noise that was added, sample by sample.

Slide 2 says that a linear system (a machine whose output for a sum is the sum of its outputs) handles this well. A filter is such a machine: it keeps some frequencies and blocks others. Write the filter as a matrix H that turns a vector of samples into a new vector. Then the slide's second line follows from linearity:

H
The filter as a matrix. Each row mixes a few neighbouring samples.
y
All the recorded samples stacked into one vector.
Hx
What the filter does to the signal alone.
Hw
What the filter does to the noise alone. The two effects simply add.

This is why a filter can clean a recording. If the noise lives at frequencies where the signal has nothing, choose H to block exactly those frequencies. Then Hw is almost zero, and Hy is almost Hx. Try it below.

Cut the mix at a frequency

Three rows share one frequency axis, 0 to 4,000 Hz. Pick how the two parts were mixed, then drag the cut-off. In the bottom row, the part to the right of the teal line is what a low-pass filter throws away.

2,000 Hz

Illustrative spectra. The signal x is the harmonics of a 125 Hz buzz, fading out above about 2,000 Hz. In Added mode, w is a band of noise from 2,400 to 3,800 Hz. In Convolved mode, w is the response of a vocal tract resonating for the vowel “ah” (the exact filter used in the hero). The cut-off is an ideal low-pass filter. Energy is the sum of squared bar heights.

Look at the Added setting. The noise sits in its own region, so a cut at 2,000 Hz removes all of it and keeps nearly all of the signal. That is the easy world: the two parts live in different places, and a filter can reach them separately.

The hard mix: one signal smeared by another

Now switch to Convolved. This is what a voice does. Your vocal cords open and close about 125 times a second. Each puff of air is a short click. The click then travels through your throat and mouth, which ring like a bottle that has been tapped.

The ringing does not get added to the clicks. It is stamped onto every click. That operation is convolution: put a copy of the filter's response at each click, and add up the copies. Slide 3 writes it as

y[n]
The recorded speech.
x[n]
The source: the buzz of puffs from the vocal cords.
w[n]
The filter: how the throat and mouth ring after one puff. (The slide's side notes call the airflow w and the tract h; we keep x for the source and w for the filter, so the symbols match the equations.)

Here is the smallest example that shows the stamping. Let the source be two clicks, three samples apart, and let the filter ring for three samples.

x = [1, 0, 0, 1, 0, 0]   w = [1, 0.5, 0.25]  →  y = [1, 0.5, 0.25, 1, 0.5, 0.25]

Read y as two stamps of w, one at sample 0 and one at sample 3. If the clicks came faster, the stamps would overlap and add, and the picture would blur. Real speech has 64 samples between clicks at 125 Hz, so the tract's ringing fades before the next click arrives, but the recording still contains both facts at once.

Now look back at the device. In Convolved mode, the filter is not a separate band. Its three humps stretch across the whole axis, and each harmonic of the source is scaled by the height of the hump under it. A low-pass cut removes the upper part of y, but nothing in y says “this bar is source, this bar is filter”. They are baked together.

That is the heart of the lecture. Slide 3 states the goal in one line: develop an operator that separates convolved components by transforming convolution into addition. Once the parts are added, ordinary filtering works again.

Why anyone cares

The two parts answer different questions. The source tells you the pitch, and a little about who is speaking. The filter tells you the shape of the mouth, which is the vowel or consonant. A system that reads words wants the filter. A system that tracks a melody wants the source. A system that changes your voice to sound higher wants to change the source and keep the filter.

Every one of them starts by pulling the two parts apart from a single recording. The next chapter shows the key move, and it uses a function you already know.

  1. The logarithm trick: why the log of a product is a sum, and how that fixes the spectrum.
  2. The cepstrum: one more transform, and pitch becomes a spike.
  3. Liftering: cut the cepstrum in two and read the vowel and the pitch separately.
  4. The mel scale: how the ear stretches frequency.
  5. The mel filter bank: 22 triangles that listen like an ear.
  6. MFCC: the cosine step that makes the final features.
  7. Speaker identification: frames, features and a nearest-neighbour vote.
  8. Why the vote works: how many small guesses make one strong answer.
  9. The field guide: numbers, code and where to go next.
A recording is y = x + w, and the noise w sits at frequencies where x has nothing. What is the simplest way to remove it?

Chapter 1

The Logarithm Trick

Turn a product into a sum in two steps, and see the voice's two parts add up on the page

You cannot un-stamp a stamped signal in time. But you can move to another view of the same signal, where stamping is a plain multiplication. Then one more small change makes the multiplication an addition.

Step one: the spectrum

The discrete Fourier transform, or DFT, answers a simple question: how much of each pure pitch is in this stretch of samples? Feed it N samples. It returns N numbers, one for each frequency. The number for frequency k is written Y[k], and it tells you the strength and the timing of that one pitch. (Our DFT lesson builds it from zero.)

The result is the spectrum. A voiced vowel gives a spectrum with a clear look: a row of narrow spikes, evenly spaced, under a slow rolling hill. The spikes are the harmonics of the buzz. The hill is the throat's resonance.

Now the key fact, from Lecture 12. The convolution theorem says that stamping in time becomes multiplying in frequency. In symbols, slide 4 writes it as

Y[k]
The spectrum of the recording, at frequency number k.
X[k]
The spectrum of the source: spikes at the harmonics.
W[k]
The spectrum of the filter: the rolling hill. The two are multiplied, frequency by frequency.

Check it on the tiny example from Chapter 0. With six samples, x = [1, 0, 0, 1, 0, 0] and w = [1, 0.5, 0.25, 0, 0, 0]. At frequency 0, the DFT is just the sum of the samples. X[0] = 2, W[0] = 1.75, and y adds up to 3.5. And 2 × 1.75 = 3.5.

At frequency 3, the DFT alternates plus and minus signs. X[3] = 1 − 1 = 0. W[3] = 1 − 0.5 + 0.25 = 0.75. The recording gives 1 − 0.5 + 0.25 − 1 + 0.5 − 0.25 = 0, and 0 × 0.75 = 0. Both frequencies match. This is the theorem at work: the spike pattern X picks which frequencies survive, and W scales each one.

Why does it hold? Think of the source as a list of clicks. A click at sample n0 puts a copy of the filter w into the recording, delayed by n0 samples. The DFT of a delayed copy is W[k] times a phase factor, a spin of frequency k by an angle that depends only on k and n0. The recording is the sum of such copies, one per click, so its DFT is W[k] times the sum of all the clicks' phase factors. That sum is exactly X[k], the DFT of the clicks alone. The product X[k] W[k] has appeared, with nothing assumed.

Step two: the logarithm

A product of two unknowns is still stuck together. A sum is easier. Think of a bar that is the sum of two blocks: you can see how tall each block is. A product has no such blocks.

A logarithm asks “what power gives this number?”. It has one famous habit: log(a × b) = log(a) + log(b). Multiplication turns into addition. Apply it to every frequency of the spectrum, and slide 4 gets its key line:

log Y[k]
The log of the recording's spectrum, one number per frequency. We use the natural log (written ln) in the devices.
log X[k]
The source's contribution: a fast zig-zag, because of the spikes.
log W[k]
The filter's contribution: a slow curve, because the hill is smooth.

The spectrum Y[k] is a complex number: it has a size and an angle. The log of a complex number is the log of its size plus the angle times i. Sizes add, and angles add too. The standard real cepstrum keeps only the sizes, and that is what the rest of this lesson uses.

Watch a product become a sum

The voice from the hero, split into its source and its filter. Switch between Linear and Log, then drag the probe to any frequency. In Log view the top two rows stack up to make the bottom row.

1,100 Hz

The vowel “ah” at 125 Hz. The filter W is the exact response of the three resonators in the hero. The source X is the measured spectrum of the recording divided by W, so it is the pulse train's spectrum smeared slightly by the analysis window. Each row is scaled so the recording's tallest spike is 1, so the numbers are relative units.

In Linear view, the bottom row is a mess to read: spikes whose heights are scaled by a hill. In Log view, the same row is just the zig-zag sitting on top of the curve. Each part is still there, visible and separate in shape. That is the whole trick.

A worked eight-point example

Take eight spectrum sizes, a stand-in for a frame where the source gives alternating big and small values: |Y| = [10, 2, 8, 1.5, 9, 1.8, 7, 2.2]. The pattern big, small, big, small is the source's spikes. Take natural logs.

k01234567
|Y[k]|10281.591.872.2
ln |Y[k]|2.300.692.080.412.200.591.950.79

The logs have the shape “a slow level of about 1.4, plus a wiggle of about 0.76 that flips sign at every sample”. The average of the eight logs is 1.375, and the alternating part has strength 0.756 (we compute it in Chapter 2). The slow part is the filter. The fast flip is the source. One average and one alternation: two numbers, two causes.

One more fix, because real spectra contain zeros. The log of zero is minus infinity, and a single −∞ ruins everything after it. Real code adds a tiny floor, such as 10−9, before the log. The symptom of forgetting the floor is a cepstrum full of not-a-number values; you measure it by checking for zeros in the spectrum; the fix is the floor.

Why does taking the logarithm of the spectrum help separate source from filter?

Chapter 2

The Cepstrum: A Spectrum of a Spectrum

Transform the log spectrum once more and watch the voice's pitch turn into a single spike

Chapter 1 left you with a curve: the log spectrum of a vowel. It has a slow hill from the throat and a fast zig-zag from the buzz. Look at it long enough and a new idea arrives. This curve is itself a signal. It just happens to run along frequency instead of time.

We have a tool for finding slow and fast parts of a signal: the Fourier transform. So transform the log spectrum. Slide 4 puts the result in one line.

The cepstrum is the DFT (or DCT) of the log spectrum. Slide 4 offers two equivalent routes: apply a linear filter to log Y[k] directly, or take its DFT and process the result.

A new axis with a silly name

The transform of a time signal gives a frequency axis. The transform of a log spectrum gives an axis that is a bit of both. Its units are time, because it is the transform of something that ran along frequency.

The inventors named it by flipping the first four letters of “frequency”: quefrency. They flipped the others too. Spectrum became cepstrum. Filter became lifter. The names are a joke, but they are standard.

A point on the quefrency axis is a number of samples, or the matching time in milliseconds. Small quefrency means a slow wiggle along frequency. Large quefrency means a fast wiggle.

The eight-point example, finished

Return to the eight logs from Chapter 1: [2.30, 0.69, 2.08, 0.41, 2.20, 0.59, 1.95, 0.79]. The DFT at index 0 is just the sum divided by 8, the average level.

c[0] = (2.303 + 0.693 + 2.079 + 0.405 + 2.197 + 0.588 + 1.946 + 0.788) ÷ 8 = 10.999 ÷ 8 = 1.375

The fastest possible wiggle is the one that flips sign at every sample. It sits at the top index, 4. Its strength multiplies each log by +1 or −1, alternating, then averages.

c[4] = (2.303 − 0.693 + 2.079 − 0.405 + 2.197 − 0.588 + 1.946 − 0.788) ÷ 8 = 6.051 ÷ 8 = 0.756

The other indices are small, between 0.05 and 0.06. So all of this frame's story is two numbers: a level of 1.375 and an alternation of 0.756. The first is the filter's average height. The second says “the source has a strict big-small pattern”. In a real voice, the second number sits at the quefrency of the pitch.

Why pitch becomes a spike

The vocal cords click 125 times a second. In the spectrum, a click train shows up as spikes 125 Hz apart. Our frame has 512 samples at 8,000 samples per second, so each DFT bin is 8,000 ÷ 512 = 15.6 Hz wide. The spikes are 125 ÷ 15.6 = 8 bins apart.

The log spectrum therefore repeats a bump every 8 bins. A pattern that repeats every 8 bins has one strong cosine in its DFT, at index 512 ÷ 8 = 64. And 64 samples at 8,000 per second is 8 milliseconds, the time between two clicks. The cepstrum has a spike at the pitch period. Divide the sample rate by the spike's position and you get the pitch: 8,000 ÷ 64 = 125 Hz.

Meanwhile the throat's hill is very smooth. It needs only a few slow cosines, so it lives at small quefrency, below about 3 or 4 milliseconds. Pitch spike at 8 ms, hill below 4 ms: the two causes sit in different places. This is slide 5's four-row picture in words: the windowed speech wave, its spectrum, its log spectrum, and the cepstrum, where the filter's part crowds near the origin and the source's part appears as a separate peak.

Make a cepstrum, step by step

Four panels, in order: the samples, the size of their DFT, the log of that, and the DFT of the log. Press Run the steps to watch them build, or tap a step. Then change the pitch and see the final spike move.

125 Hz

The vowel “ah”, synthetic, 8,000 samples per second, 512-sample Hamming-windowed frame. The cepstrum here is the inverse DFT of the natural log of the magnitude spectrum, with a 10−9 floor. The pitch is the highest cepstrum peak between 70 and 400 Hz.

Run the steps once. In panel 2 the spikes are easy to see but their heights are wildly uneven, because the hill scales them. In panel 3 the log has evened them out. In panel 4 a single spike stands up, far to the right of a cluster of small values near the origin.

DFT or DCT?

Slide 4 says “DFT (or DCT)”. The size of a spectrum is a mirror image: the frequencies above half the sample rate repeat those below. A mirror-symmetric signal has a transform made only of cosines. A transform made only of cosines is called a discrete cosine transform, or DCT. So for the real cepstrum, the DFT and the DCT carry the same information. Chapter 6 uses the DCT form on purpose, because it needs fewer numbers.

When the spike lies

The spike has a well-known failure. A click train of period T also makes smaller copies of its peak at 2T, 3T and so on. If the peak at 2T happens to be taller, a tracker that picks the tallest peak reports half the true pitch. You see it as a pitch track that suddenly drops an octave. You measure it by checking the cepstrum at half the reported quefrency: if there is a peak there, you picked a multiple. The usual fix is to search only a plausible pitch range, as the device does (70 to 400 Hz), and to prefer the earliest strong peak.

A voice has a pitch of 125 Hz and is sampled at 8,000 samples per second. Where does the cepstrum show a spike?

Chapter 3

Liftering: Cut the Cepstrum in Two

Keep the low end to read the vowel, keep the high end to read the pitch, and learn where to make the cut

A sound engineer has two faders on a desk. One controls the bass, one controls the treble. Pushing the bass fader down does not touch the treble. That is what we now do to the cepstrum, with one difference: the sliders are on the quefrency axis, not the frequency axis.

Chapter 2 showed that the filter's part lives near the origin of the cepstrum, and the source's part sits at a spike farther out. Slide 6 shows the same picture on a real speech frame: the windowed speech wave, its jagged log spectrum, its cepstrum, and then a smooth curve rebuilt from only the first few cepstrum values. That last step is the point of this chapter.

The lifter

A lifter is a filter that works on the cepstrum. It multiplies each cepstrum value by a weight. A low-quefrency lifter keeps the values near the origin and zeroes the rest. A high-quefrency lifter does the opposite. In symbols, with L as the cut-off quefrency:

log Ŵ[k]
The rebuilt smooth log spectrum: our estimate of the filter's part. The hat means “estimate”.
c[q]
The cepstrum from Chapter 2, at quefrency q samples.
|q| < L
Keep only quefrencies closer to the origin than L. The cepstrum is mirror-symmetric, so we keep both sides.

Transform the kept values back and you get a smooth curve: the spectral envelope. Its peaks are the formants, the resonances of the throat. The vowel “ah” has its first two formants near 730 and 1,090 Hz; “ee” has one low and one high, near 270 and 2,290 Hz. Formant positions tell you which vowel was said.

Now flip the lifter. Keep only quefrencies at or beyond L, and transform back. The slow hill is gone. What is left is the fast ripple, a cosine that repeats at every harmonic. This is the excitation, the source's part. The spacing between its ripples is the pitch.

There is a second way to see the lifter. Keeping the low quefrencies is the same as smoothing the log spectrum along frequency with a sliding average. If the average is wider than the gap between two harmonics, the narrow spikes wash out and only the slow hill survives. A wider average means a lower cut-off. This also explains the rule about the pitch period: a smoothing window must be wider than one harmonic gap, or it follows the spikes instead of averaging them.

One practical detail. A hard cut at L makes the rebuilt curve ring, like a bell struck hard, because chopping a signal abruptly adds ripples of its own. The device below fades the last few kept values smoothly to zero instead. A smooth lifter is the standard cure for the ringing.

Fade the bass or the treble

Top: the log spectrum (grey) and what survives your lifter. Bottom: the cepstrum, with the part you keep in colour. Choose Envelope or Excitation, then drag the cut-off.

22
125 Hz

Synthetic voice with typical adult male formants (Peterson and Barney, 1952): “ah” 730, 1,090, 2,440 Hz; “ee” 270, 2,290, 3,010 Hz; “oo” 300, 870, 2,240 Hz. Cepstral envelopes find the broad peaks, not every formant: two close formants, such as 730 and 1,090 Hz, can merge into one. The lifter fades smoothly over its last 8 values.

Choosing the cut-off

The cut-off is a trade, and each side fails in a visible way.

Set it too low, say 6, and the envelope is a smooth lump. Formants that are close together merge. The symptom: “ah” and “oo” look alike. You measure it by counting the envelope's peaks: one where the vowel has two. The fix is to raise the cut-off until the peaks stop moving.

Set it too high, say 60 with a pitch of 125 Hz, and the lifter lets part of the pitch spike in. The envelope grows small ripples spaced exactly at the pitch. The symptom: dozens of tiny peaks. You measure it by their spacing: 125 Hz apart is a giveaway. The fix is a hard rule: the cut-off must stay well below the pitch period. The pitch period of the highest voice you expect (250 Hz is 32 samples at 8,000 per second) sets the ceiling.

A cut-off near 20 works for an 8 kHz voice because the envelope of speech needs only about 20 smooth cosines. That is the compression hiding here: 257 spectrum values are described by about 20 numbers.

What the split buys you

With the voice in two parts, each job becomes easy. Read the spike in the high part, and you have a pitch tracker. Read the smooth part, and you have a description of the vowel that ignores the pitch. Change the high part and keep the smooth part, and the voice sounds higher or lower but says the same word.

The lecture's own use is the second one. A speech recogniser or speaker identifier wants a compact picture of the throat's shape from each short slice of sound. The low end of the cepstrum is exactly that picture. The rest of the lecture sharpens it with a trick borrowed from human hearing.

The classical name for this whole move is homomorphic deconvolution: undo a convolution by mapping it to addition with a log, undoing the addition with a lifter, and mapping back. You do not need the name to use the idea.

You want the shape of the vocal tract, not the pitch. Which part of the cepstrum do you keep?

Chapter 4

The Mel Scale: How the Ear Stretches Frequency

Measure pitch the way listeners hear it, with fine steps at low frequencies and coarse steps at high ones

Sit at a piano and press the A below middle C, then the A above it. Press the next A up, then the next. Every jump sounds the same size: one octave. But the frequencies are 110, 220, 440, 880 Hz. Each jump doubles the frequency.

Your ear does not count hertz. For high notes it counts ratios. The next jump of 110 Hz, from 880 to 990 Hz, sounds small, a little more than a whole step. The first jump of 110 Hz, from 110 to 220, was a full octave. Equal steps in hertz are not equal steps in what you hear.

A scale made from listening tests

Slide 8 introduces a scale built to match that. The mel scale is a perceptual scale of pitches: people listened to tones and judged how far apart they sounded, and the numbers were fitted to the answers. The unit is the mel. The slide anchors it at one point: 1,000 mels equals 1,000 Hz. (The slide prints this as “1 mels”; the intended anchor is 1,000 mels.)

It also gives a formula to convert f hertz into m mels:

m
The pitch in mels, the number we feed the machine.
2595
A scale factor, chosen so that 1,000 Hz comes out as 1,000 mels.
f
The frequency in hertz.
700
The corner. Below about 700 Hz the curve is nearly a straight line. Above it, the curve bends like a logarithm.

Check the anchor. At f = 1,000: 1 + 1,000 ÷ 700 = 2.4286. The base-10 log of 2.4286 is 0.3854. Multiply by 2,595 and you get 1,000.0 mels. Good. That check is also your debugging tool: if your code gives about 2,303 mels at 1,000 Hz, you used the natural log by mistake.

Two regimes, one formula

Why 700? Look at the two ends of the formula. When f is much smaller than 700, the log of 1 + f/700 is almost f/700 divided by 2.3. The curve is nearly a straight line with slope 2,595 ÷ (700 × 2.3026) = 1.61 mels per hertz. When f is much bigger than 700, the “1 +” hardly matters, and the formula is a pure log of f. So the mel scale is linear for low voices and logarithmic for high ones, joined smoothly around 700 Hz.

Work two steps of the same size, 100 Hz each, to see the effect.

200 → 300 Hz: 401.97 − 283.23 = 118.7 mels    3,900 → 4,000 Hz: 2,146.06 − 2,121.83 = 24.2 mels

The same 100 Hz step is almost five times larger in mels near 200 Hz than near 4,000 Hz. Low-frequency detail gets room. High-frequency detail gets squeezed. Other anchors, for later: 4,000 Hz is 2,146 mels, and 8,000 Hz is 2,840 mels.

The formula also runs backwards. Solve for f and you get f = 700 (10m/2595 − 1). Try m = 500 mels. First 500 ÷ 2,595 = 0.1927. Then 100.1927 = 1.558. Subtract 1 to get 0.558, and multiply by 700 to get 391 Hz. As a check, m = 1,000 gives 700 × (2.4286 − 1) = 1,000 Hz. Chapter 5 uses this inverse to turn evenly spaced mel values back into hertz.

Bend the frequency axis

The curve turns hertz into mels. Choose how the ticks are spaced and read where their guide lines land on the other axis. Drag the frequency, then press Hear a 100 Hz step.

1,000 Hz

The curve is the lecture's formula, m = 2595 log10(1 + f/700). The two tones are pure sine waves played one after the other (the chosen frequency, then 100 Hz higher). Whether they sound close or far apart depends on your ears and speakers.

Try the audio at 200 Hz, then at 4,000 Hz. The second pair sounds like a smaller step. That is the scale doing its job: it makes the machine's numbers move by about as much as the listener hears.

Why a machine wants it

A speech system must decide how much detail to keep at each frequency. The vowel table from Chapter 3 gives the answer: the formants that separate vowels sit mostly below 3,000 Hz, and the first two are below 2,300 Hz. A scale that spends most of its numbers there matches where the information is. A flat hertz scale would spend as many numbers on the thin band from 3,000 to 4,000 Hz as on the band from 200 to 1,200.

The mel scale is a model, not a law. Several slightly different formulas exist, with different constants. The slide uses 2,595 and 700, and so do we. What matters for the pipeline is the shape: fine at the bottom, coarse at the top.

The next chapter uses it to place a row of listening windows: equal spacing in mels, so the windows pack tightly where the ear is sharp and spread out where it is not.

Two steps of 100 Hz each: one from 200 to 300 Hz, one from 3,900 to 4,000 Hz. What does the mel formula say?

Chapter 5

The Mel Filter Bank: 22 Triangles That Listen

Squeeze 257 spectrum values into 22 band energies, with narrow bands where the ear is sharp and wide bands where it is not

Look at a graphic equaliser on a stereo: a row of sliders, each one a band of pitch. Each slider covers a few hundred hertz, and together they cover the whole range. The ear works like a rough equaliser. The inner ear splits sound into overlapping bands and reports how much energy each one holds.

Slides 9 and 10 build that bank in software. The picture on the slide is a row of triangles, close together at the left, wider at the right, between 0 and 4,000 Hz. This chapter explains how to draw them and what each one computes.

One filter: a triangle of weights

Start with the spectrum of one frame. For our 512-sample frame at 8,000 samples per second, that is 257 numbers X[k], one for every 15.6 Hz from 0 to 4,000 Hz. A filter here is a list of 257 weights between 0 and 1. The weight says how much that frequency counts for this band.

The slide's weights are triangular. The weight rises in a straight line from 0 at the band's left edge to 1 at its centre, then falls to 0 at the right edge. Slide 9 calls the weight function Vr[k] for the r-th filter, and defines the band's energy as

MF[r]
The mel-frequency spectrum at band r: one number for how much energy fell in that band.
∑k
Add up over every DFT bin k.
Vr[k]
The triangle: a weight between 0 and 1 for band r at bin k.
X[k]
The frame's DFT, from Chapter 1. The bars and the square turn the weighted value into energy.

Read it as a recipe. For each bin, scale the spectrum by the triangle, square the result to get energy, and add. Bins in the middle of the triangle count fully. Bins near its edges count a little. Bins outside do not count.

Where the triangles go

Here the mel scale from Chapter 4 earns its place. Pick the number of filters R. The lecture uses 22. Convert the top frequency, 4,000 Hz, to mels: 2,146. Now place R + 2 = 24 edge points equally spaced in mels from 0 to 2,146, which means steps of 2,146 ÷ 23 = 93.3 mels. Convert each edge back to hertz with the inverse formula f = 700 (10m/2595 − 1).

0, 60, 126, 197, 275, 359, 450, 550, 658, 775, 902, 1,040, 1,190, 1,354, 1,531, 1,724, 1,933, 2,160, 2,407, 2,675, 2,966, 3,283, 3,627, 4,000 Hz

Filter r runs from edge r − 1, peaks at edge r, and ends at edge r + 1. So neighbouring triangles overlap by half, and every frequency is seen by two filters. Filter 1 spans 0 to 126 Hz. Filter 22 spans 3,283 to 4,000 Hz, which is 717 Hz wide, about 5.7 times wider than filter 1. Equal in mels, unequal in hertz. The slide describes this as bandwidths that are constant below 1 kHz and grow exponentially after; the mel spacing gives the same shape, with the widths rising smoothly.

One band, with numbers

Take filter 3, which spans 126 to 275 Hz and peaks at 197 Hz. Nine bins fall inside it, bins 9 to 17. Their weights climb 0.20, 0.42, 0.64, 0.86, peak near 0.93 at bin 13, then fall 0.72, 0.52, 0.32, 0.12.

Suppose a flat spectrum, X[k] = 1 everywhere. Then MF[3] = 0.202 + 0.422 + … + 0.122 = 3.15. Do the same for filter 22, which holds 45 bins, and you get 15.31. A flat spectrum gives filter 22 almost five times the energy of filter 3, only because it is wider. Keep this in mind: the formula sums energy and does not divide by width. The log step in the next chapter turns that factor of five into a fixed offset for filter 22, the same in every frame.

Listen through the triangles

Top: the power spectrum of a voiced frame (grey) and the filter triangles (pink). Bottom: one bar per filter, the energy it collects. Change the number of filters, the vowel, or pick one filter to inspect.

5

Voiced frame from the synthetic voice (125 Hz pitch), 512 samples at 8,000 per second, so 257 bins of 15.6 Hz. Edges are equally spaced in mels from 0 to 4,000 Hz, as in the text. Bars show MF[r] as a share of the tallest bar. The lecture uses 22 filters; 10 and 40 are for comparison.

Switch from 22 to 10 filters, and the “ah” bump around 700 Hz blurs into its neighbours. Switch to 40, and the bars get finer but the low filters each hold only a few bins. The lecture's 22 is a middle choice.

Why this is the same as filtering the sound

Slide 9 adds a line that is easy to skip: the bank is identical to convolutions with 22 filters. Here is why. Multiplying a spectrum by a triangle is exactly what a band-pass filter does to a sound: it passes the band and blocks the rest. A filter's effect in time is a convolution (Chapter 0).

So you can think of 22 microphones, each tuned to one band, listening at once. By a standard result, the energy in a signal equals the energy of its spectrum, so measuring the energy that comes out of each filter gives the same number as summing the weighted spectrum. We compute it on the spectrum because the DFT is already there.

The failure to watch for: a band narrower than one DFT bin can fall between two bins and collect nothing. Then MF[r] = 0, and the next chapter's log gives minus infinity. The measurement is a zero in the bar list; the fixes are the floor from Chapter 1, fewer filters, or a longer frame.

The 22 mel filters are placed with equal spacing in mels between 0 and 2,146 mels. What is the result in hertz?

Chapter 6

MFCC: The Cepstrum of the Mel Spectrum

Take the log of the 22 band energies, project them on cosines, and keep a dozen numbers that describe the vowel, not the loudness

You now hold 22 band energies for one 30 millisecond slice of speech. That is a small, ear-shaped picture of the spectrum. One more step makes it a feature that machines love, and you have already seen the step. It is Chapter 2 again, on the new 22-point curve.

The recipe on slide 11

Take the logarithm of each band energy, as in Chapter 1. Now the 22 values are a curve over the band number r. It has a slow part, which is the vocal tract's envelope, and fast parts from small details. Apply the cepstrum idea: transform the curve with cosines and keep the slow ones. The slide names the result the Mel Frequency Cepstral Coefficient, or MFCC:

MFCC[m]
The m-th coefficient. Small m means a slow cosine over the bands; larger m means a faster one.
∑r=1R
Add over all R bands. R is 22 in the lecture.
log(MF[r])
The log of band r's energy from Chapter 5. This is the logarithm trick again.
cos(…)
A cosine wave sampled at the middle of each band (the r + 1/2). The factor m sets how fast it wiggles across the bands.

The slide then restates it in one line: MFCC[m] = ⟨log MF[r], cm[r]⟩. An inner product of two lists multiplies them entry by entry and adds. So each MFCC asks one question: how much does the log mel curve look like cosine number m?

Try it on a toy with R = 4 bands whose logs are [2, 3, 3, 2], a bump in the middle, using the π/R form of the cosine (explained next). For m = 0 the cosine is 1 everywhere, so MFCC[0] = 2 + 3 + 3 + 2 = 10. For m = 1 the cosine values (angles π/8, 3π/8, 5π/8, 7π/8) are 0.924, 0.383, −0.383, −0.924. The sum is 2(0.924) + 3(0.383) + 3(−0.383) + 2(−0.924) = 0: the bump leans neither left nor right. For m = 2 the values are 0.707, −0.707, −0.707, 0.707, and the sum is −1.41: a negative score means the curve is higher in the middle than at the edges. Each coefficient answers one shape question.

A note on the angle. The slide writes 2π/R. Many speech references write π/R, the standard DCT-II (a discrete cosine transform whose cosines are fully independent for m from 0 to R − 1). We use the π/R form in the device, because it keeps every coefficient useful. The idea is the same: project on cosines.

The whole data flow

Here is the pipeline for one frame, with every shape. Slide 7's three stacked pictures show the same chain for a whole utterance: a spectrogram, then the mel-filtered version, then the MFCCs, each smaller and smoother than the one before.

frame [240 samples] → window and DFT → |X| [257] → mel filter bank → MF [22] → log → log MF [22] → cosines → MFCC [13]

From 240 samples to 13 numbers. The lecture does not fix how many coefficients to keep. Twelve or thirteen is common practice: it keeps the slow cosines (the throat) and drops the fast ones (fine detail and leftover pitch).

Project on a cosine

Top: the 22 log band energies of a voiced frame (pink bars), the cosine you picked (teal), and the curve rebuilt from the first few coefficients (white line). Bottom: all 13 MFCCs. Choose a coefficient, then choose how many to keep.

1
13
0 dB

Synthetic voiced frame, 240 samples (30 ms at 8,000 per second) in a 512-point DFT, 22 mel filters up to 4,000 Hz. The cosines use the π/R form (DCT-II). The rebuilt curve uses the inverse transform of the first K coefficients. Loudness multiplies the signal before everything else.

Try coefficient 0. Its cosine is flat, so MFCC[0] is the sum of all log energies: the overall level. Coefficient 1 is one slow half wave, high on one side and low on the other: it measures the tilt of the spectrum. Each higher coefficient adds one more wiggle. A few coefficients rebuild the curve closely, and that is why keeping 13 loses little.

Why the cosine step helps

Two reasons. First, compression: 22 numbers become 13, and the dropped ones carry mostly detail. Second, decorrelation. Neighbouring triangles overlap by half, so neighbouring band energies rise and fall together. A learning algorithm that treats each feature as separate gets confused by features that repeat each other. The cosines mix the bands so that each coefficient says something new.

We measured it on 300 random synthetic frames from this lesson's voice (illustrative, not a recording). Neighbouring log band energies had an average absolute correlation of 0.76. Neighbouring MFCCs 1 to 12 had 0.38. The cosine step roughly halved the overlap.

A failure with a clean fix: loudness

Drag the loudness slider. Only MFCC[0] moves. The reason is short. Making a sound louder by a factor g multiplies every band energy by g2. The log turns that into the same added number for every band. A constant added to every band looks like the flat cosine, and the other cosines have no flat part, so they do not change.

The symptom of ignoring this: a quiet speaker and a loud speaker land far apart in feature space. You measure it as a big jump in coefficient 0 with the others still. The fix is common practice: drop MFCC[0], or normalise it per recording.

You play the same speech twice as loud. Which MFCCs change?

Chapter 7

Speaker Identification: Frames, Features, Neighbours

Cut speech into overlapping 30 ms frames, turn each into 13 numbers, and label each frame by its nearest neighbours

Ten people each say a few words into a microphone. Later, you hear a new clip and must say which of the ten spoke. You have no names in the audio, only waves. How would you build the answer?

Slides 12 to 14 give the lecture's recipe. It uses the AN4 dataset from Carnegie Mellon: five male and five female speakers, saying words and numbers. The pipeline has four moves, and we take them in order.

Move one: cut the sound into frames

A whole word is too long to analyse in one go. The shape of the mouth changes many times a second, and one DFT over the whole word would average all of those shapes into mush. So we cut the recording into short slices, frames, short enough that the mouth barely moves inside one.

The slide's choice: frames of 30 ms, with an overlap of 75%. For an illustration at 8,000 samples per second, 30 ms is 240 samples. An overlap of 75% means each frame shares three quarters of its samples with the one before, so the frame start moves ahead by only 25% of 240, which is 60 samples (7.5 ms). The AN4 sampling rate is not on the slides, so treat 8,000 per second as our arithmetic, not theirs.

Count the frames. For N samples, a frame of length L and a hop of H, the number of full frames is floor((N − L) ÷ H) + 1. One second is N = 8,000, so floor(7,760 ÷ 60) + 1 = 129 + 1 = 130 frames. Each frame becomes 13 MFCCs, so the second becomes a table of shape 130 × 13. That table is the whole input to the classifier, and slide 12 draws it as a row of short vertical bars under the waveform, one per frame.

Slice the sound into frames

Top: one second of a synthetic voice that says “ah”, then “ee”, then “oo”, with the current frame shaded. Middle: the MFCC table, one column per frame. Bottom: the 13 numbers of the current frame. Choose an overlap, then scrub through the frames.

30

Synthetic utterance at 8,000 samples per second, 240-sample frames (30 ms), Hamming window, 22 mel filters, 13 MFCCs (the DCT-II form). The three sounds are joined without gaps, so the changes are sharper than in real speech. The sampling rate is our assumption; the slides give only 30 ms and 75%.

Scrub across the table. Inside the “ah” the columns look alike. At the switch to “ee” the pattern jumps. This is the feature working: similar sounds give similar columns.

Move two: nearest neighbours, from zero

Now each frame is a point in 13-dimensional space. Points from the same speaker saying similar sounds should sit close together. To classify a new point, the simplest rule is to ask its neighbours.

The k-nearest-neighbour classifier (kNN) has no training in the usual sense. It stores every labelled training frame. To label a new frame, it measures the distance to every stored frame, picks the k closest, and lets them vote. The distance is the ordinary straight-line (Euclidean) distance: subtract the two lists entry by entry, square, add, take the square root. (See our distance and classification lesson.)

Worked example with k = 3. A new frame has three nearest stored frames with labels speaker A, speaker B, speaker A. The vote is A twice and B once, so the frame is labelled A. With k = 1, the single closest frame decides, and one odd frame can mislead. A larger k smooths the decision, until it blurs the boundary between speakers.

Let the neighbours vote

Each dot is one training frame from speaker A (orange) or speaker B (blue), placed by two of its MFCCs. Tap or drag in the plot to put a new frame there, shown as a white diamond, then see which neighbours vote. Change k to change the vote.

Synthetic speakers: A has a slightly longer vocal tract and a lower voice, B a slightly shorter tract and a higher voice, each saying the vowels “ah”, “ee” and “oo” with random variation. 160 training frames. The plot shows two of the 13 coefficients, MFCC 1 and MFCC 2, and the distance is measured in just those two so that you can see it. Chapter 8 uses all 12 of MFCC 1 to 12.

Moves three and four: predict every frame, then vote

At test time, the lecture predicts one label for every frame of the test signal. Then it takes the label that occurs most often, and declares that the speaker. Slide 13 states it plainly: “most frequently occurring label is declared as the speaker”. Chapter 8 shows why this second vote is the secret to the accuracy.

Slide 14 shows the time signals of two speakers, speaker 1 in blue and speaker 2 in red. Below them it plots the frame-based MFCC features of each, as one bar per coefficient. In that plot the first coefficients are large and the later ones shrink toward zero, which is the shape you would expect from a smooth spectral envelope. The two speakers' bars differ, and the classifier uses that difference.

Two things that can go wrong

First, a single frame is a weak witness. The same vowel from two speakers can land close together, as the overlap in the plot shows. The symptom is a wrong label on a share of frames. You measure it as per-frame accuracy, well below the clip accuracy. The fix is the vote over frames.

Second, overlap can fool your own test. With 75% overlap, neighbouring frames are near copies. If frames from the same recording land in both the training set and the test set, the neighbour is often a copy of the test frame, and accuracy looks great for the wrong reason. The symptom is a score that collapses on a new recording. You measure it by splitting by recording, not by frame. The fix is to hold out whole recordings.

Why is speech cut into overlapping 30 ms frames before computing MFCCs?

Chapter 8

Why Many Weak Guesses Make a Strong Answer

Read the lecture's results, then see why a vote over frames lifts a mediocre per-frame guess to a reliable clip label

Ask one person on the street whether a coin is fair, after one flip. You learn almost nothing. Ask the same question after a hundred flips and you can answer with confidence. The speaker identifier works the same way. One frame is one flip. A clip is a hundred.

What the lecture reports

Slide 15 plots Speaker Recognition Experiments (5-NN): total accuracy for four setups, labelled raw data, window size 100, window size 500 and window size 10,000. Read off the plot, the accuracy climbs from about 12% on raw data to about 25% for the two middle settings and to about 55% for the last. These are rough readings of a line chart, not numbers the slide prints. The slide does not spell out what the windows are, so take the lesson from the gap alone.

Put that gap next to chance. Ten speakers means a random guess is right 10% of the time. About 12% is hardly better than chance. Slide 16, the MFCC pipeline of Chapter 7, reports a very different number: an average accuracy of 92.93% on validation data. The slide does not say whether it scores frames or whole clips. Its cells hold counts in the thousands, so they most likely count frames. Either way, MFCC features land in a far better place than the plot on slide 15.

Reading a confusion matrix

Slide 16 draws the result as a confusion matrix, a table with one row for each true speaker and one column for each predicted speaker. The cell in row i and column j counts the clips (or frames) of speaker i that the classifier called speaker j. The diagonal holds the right answers.

The slide's table has ten rows and columns, labelled with short speaker codes, and it adds a column and a row of percentages along the edges. To read one, use a toy table with three speakers (made up, for practice):

true ↓ / predicted →ABCrow total
A9064100
B5887100
C3988100

Accuracy is the diagonal over everything: (90 + 88 + 88) ÷ 300 = 88.7%. Row A says 90 of the 100 true A clips were called A: that is A's recall, 90%. Column A says that 98 clips were called A, and 90 of them truly were: A's precision, 90 ÷ 98 = 91.8%. Off-diagonal cells show who is confused with whom, here C with B most of all. Slide 16 prints a table of this kind with ten speakers, and its 92.93% is the average accuracy over them.

The vote, in arithmetic

Why does a vote over frames help so much? Suppose each frame, on its own, is right with probability p, and frames err independently. A clip with n frames, labelled by majority, is right when more than half the frames are right. For two speakers with p = 0.7:

n = 1: 70.0%    n = 3: 78.4%    n = 5: 83.7%    n = 15: 95.0%    n = 41: 99.6%

Check n = 3 by hand. The vote is right when at least 2 of 3 frames are right. That is three ways to get exactly two right (each 0.7 × 0.7 × 0.3 = 0.147, total 0.441) plus one way to get all three (0.343). The sum is 0.784, the table's 78.4%.

With ten speakers the vote is even stronger. A frame that errs usually spreads its wrong answers across nine other speakers, while right answers all pile on one. The correct speaker needs only the most votes, not more than half.

Vote over a clip

An unknown speaker talks for n frames. Each frame is classified alone by 5-nearest-neighbours, shown as one coloured tile, orange for A and blue for B. The most common colour wins. Press New clip a few times, then change n. The curve shows how often the vote is right.

9

The two synthetic speakers from Chapter 7, with 160 training frames and 200 held-out test frames (100 per speaker; the test frames are different frames from the training frames). The curve is measured by drawing 300 random clips of each length from the test frames. Real frames from one recording are correlated, so a real curve rises more slowly than this one.

Set n to 1 and press New clip several times. You see the raw per-frame error. Then set n to 25. A few tiles of the wrong colour do not matter: the clip colour is almost always right. The curve flattens near 100%.

Where the arithmetic is too kind

The independence assumption is the weak point. Frames that overlap by 75% share most of their samples, and frames in the same vowel look alike. If the speaker says one hard sound for a whole clip, all those frames err together, and the vote repeats the same mistake many times.

The symptom is a measured clip accuracy below what the binomial table predicts. You measure it directly: hold out whole clips and count. The fixes are longer clips with more varied sounds, features that vary less with the sound, and a better frame classifier. Slide 16's 92.93% is a measured number, so it is worth more than any table, even though the slide does not say whether it scores frames or clips.

Each frame is right with probability 0.7, and frames err independently. A clip has three frames and is labelled by majority vote between two speakers. How often is the clip right?

Chapter 9

The Field Guide

Keep the lecture on one page: the numbers, the checklist, the code, and where to go next

Lecture 13 is one idea told in two halves. The first half says: when two things are convolved, take the log of the spectrum and they add, then split them on the quefrency axis. The second half says: bend the frequency axis like an ear, listen through 22 triangles, take logs, project on cosines, and you have 13 numbers per 30 ms that describe the vowel and speaker, not the pitch or the loudness.

The numbers that matter

WhatNumberWhy it matters
Pitch of 125 Hz at 8,000 samples per secondspike at quefrency 64 samples (8 ms)Sample rate divided by the spike gives the pitch
DFT of 512 samples at 8,000 per second257 bins, 15.6 Hz eachThe spectrum the mel bank listens to
Mel anchor1,000 Hz = 1,000 mels; 4,000 Hz = 2,146; 8,000 Hz = 2,840Slide 8 formula, a quick sanity check for code
The same 100 Hz step118.7 mels near 200 Hz; 24.2 mels near 4,000 HzFine steps low, coarse steps high
Mel filter bank (lecture: 22 filters)edges every 93.3 mels; widths from 126 Hz to 717 HzNarrow where the ear is sharp
Frame (lecture: 30 ms, 75% overlap)240 samples, hop 60, 130 frames per second at 8 kHzThe input table is 130 × 13 per second
MFCCs kept12 or 13 (common practice; not fixed on the slides)Keeps the throat, drops fine detail
Speaker identification on AN4 (10 speakers)92.93% average accuracy; chance is 10%Slide 16: MFCC features with a kNN; the slide does not say if frames or clips are scored
Vote over frames, p = 0.7, two speakers70.0% at n = 1; 95.0% at n = 15Many weak guesses, independent errors

The words, in one line each

TermMeaning
Source and filterThe buzz of the vocal cords and the ringing throat; they are convolved in time and multiplied in the spectrum.
CepstrumThe DFT (or DCT) of the log spectrum. Its axis is quefrency, in samples or milliseconds.
LifterA filter on the cepstrum. Low quefrency keeps the envelope; high quefrency keeps the pitch ripple.
FormantA peak of the spectral envelope: a resonance of the throat. Formant positions tell vowels apart.
MelA unit of perceived pitch. 1,000 mels is 1,000 Hz; the scale is linear at low frequency, logarithmic at high.
MFCCCosine projections of the log mel band energies: how much the log mel curve looks like cosine m.
kNN voteLabel a frame by its k nearest stored frames, then label the clip by the most common frame label.

A checklist before you trust your features

  1. Apply a window (Hamming) to every frame before the DFT.
  2. Add a small floor before every log, so a zero cannot give minus infinity.
  3. Keep any lifter cut-off well below the shortest pitch period you expect.
  4. Test the mel formula: 1,000 Hz must come out as about 1,000 mels.
  5. Drop MFCC[0], or normalise it per recording, so loudness does not leak in.
  6. Split training and test data by recording, never by frame.
  7. Classify every frame, then vote, and report the measured clip accuracy.

The whole pipeline as code

A small numpy version of Chapters 5 to 8. The comments carry the shapes. It runs as written; the voting function expects labelled training frames that you built with mfcc_frame from your own recordings.

pythonimport numpy as np

def mel(f):  return 2595 * np.log10(1 + f / 700)
def imel(m): return 700 * (10 ** (m / 2595) - 1)

def mel_bank(R=22, n_fft=512, fs=8000, fmax=4000):
    edges = imel(np.linspace(0, mel(fmax), R + 2))          # R+2 edges in Hz
    freqs = np.arange(n_fft // 2 + 1) * fs / n_fft          # [257]
    V = np.zeros((R, len(freqs)))
    for r in range(1, R + 1):
        a, b, c = edges[r - 1], edges[r], edges[r + 1]
        tri = np.minimum((freqs - a) / (b - a), (c - freqs) / (c - b))
        V[r - 1] = np.clip(tri, 0, None)                    # one triangle
    return V                                                # [22, 257]

def mfcc_frame(frame, V, n_coef=13, n_fft=512):
    X = np.abs(np.fft.rfft(frame * np.hamming(len(frame)), n_fft))   # [257]
    MF = (V ** 2) @ (X ** 2)                                # [22]  sum_k |V_r X|^2
    logmf = np.log(MF + 1e-9)                               # [22]  the log trick
    R = len(logmf)
    m = np.arange(n_coef)[:, None]
    C = np.cos(np.pi / R * (np.arange(R) + 0.5) * m)        # [13, 22]  DCT-II
    return C @ logmf                                        # [13]

def frames(sig, L=240, H=60):                               # 30 ms, 75% overlap at 8 kHz
    n = (len(sig) - L) // H + 1
    return np.stack([sig[i * H : i * H + L] for i in range(n)])      # [n, 240]

def identify(sig, V, train_X, train_y, k=5):                # train_X [N, 12], train_y [N] ints
    F = np.stack([mfcc_frame(f, V)[1:] for f in frames(sig)])        # [n, 12], drop MFCC[0]
    d = ((F[:, None, :] - train_X[None]) ** 2).sum(-1)               # [n, N]
    nn = np.argsort(d, axis=1)[:, :k]                       # k nearest per frame
    per_frame = np.array([np.bincount(v).argmax() for v in train_y[nn]])
    return np.bincount(per_frame).argmax()                  # most common label wins

Where this sits

Lecture 12 gave the convolution theorem that this lecture leans on. This lecture turned it into a feature extractor. For many years MFCCs were the standard input to speech systems. Many modern neural models skip the last cosine step and feed the log mel spectrum straight in, but the mel scale, the filter bank and the log are the same ones you built here. Lecture 14 turns to Bayes classifiers, which put probabilities on the labels instead of counting votes.

Keep going

Credit and sources. This lesson follows Lecture 13 of Stanford EE269, Signal Processing for Machine Learning, taught by Mert Pilanci (deck dated October 11, 2021). See the course site and the slides page. The vowel formant values are typical averages from Peterson and Barney (1952). All voices in the devices are synthetic, computed in your browser.

The takeaway. A voice is a source convolved with a filter. The log turns that product into a sum, a second transform pulls the two parts apart, and the mel scale plus cosines shrink the filter's shape to a dozen numbers that identify a vowel or a speaker.
Put the MFCC steps in order for one 30 ms frame.

Now press Present or Teach and explain the chain out loud, from memory: why a voice is a convolution, how the log makes it a sum, where the pitch spike sits, how the mel bank is placed, and why a vote over frames works. Then go back to the hero and split a voice again.

EE269 Lecture 13: Cepstrum and MFCC
The course site · Course slides · Back to Gleams