Quiz 2

Learning Objectives

484 words
2 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Learning Objectives - Extract MFCC features for speech recognition - Analyze pitch, formants, and energy - Understand cepstral analysis - Week 2: Fourier analysis, filtering - Understanding of frequency domain ## 1. Short-Term Analysis Speech is analyzed in overlapping frames: - Frame size: 20-30ms (320-480 sample...

Learning Objectives

  • Extract MFCC features for speech recognition
  • Analyze pitch, formants, and energy
  • Understand cepstral analysis
  • Week 2: Fourier analysis, filtering
  • Understanding of frequency domain

1. Short-Term Analysis

Speech is analyzed in overlapping frames:
  • Frame size: 20-30ms (320-480 samples at 16kHz)
  • Frame shift: 10ms (160 samples at 16kHz)
  • Window function: Hamming window (reduces spectral leakage)

2. Mel-Frequency Cepstral Coefficients (MFCCs)

The most common feature for speech recognition. Extraction Steps:
  1. Pre-emphasis (boost high frequencies)
  2. Frame blocking and windowing
  3. Compute power spectrum (FFT)
  4. Apply Mel filterbank (triangular filters spaced on Mel scale)
  5. Log compression of filterbank energies
  6. Discrete Cosine Transform (DCT) -> MFCCs Mel Scale: Perceptually motivated frequency scale.
Mel(f)=2595log10(1+f/700)Mel(f) = 2595 \log_{10}(1 + f/700)
Human hearing is more discriminative at low frequencies -> Mel scale has higher resolution at low frequencies.

3. Pitch (Fundamental Frequency F0)

Pitch period = time between vocal fold openings. F0 = 1/pitch period.
  • Typical F0: Male ~100-150 Hz, Female ~180-250 Hz, Children ~250-400 Hz
  • Pitch detection: Autocorrelation, cepstral method, YIN algorithm

4. Energy & Zero-Crossing Rate

Energy: Sum of squared samples. Higher for vowels, lower for consonants. Zero-Crossing Rate: Number of times signal crosses zero. Higher for unvoiced sounds (noise-like), lower for voiced (periodic).
Q1: What are MFCCs and why are they effective for speech recognition?
MFCCs represent the spectral envelope in a compact, perceptually relevant form. They capture: vocal tract shape (formants), are robust to noise, decorrelated (DCT), and based on human hearing (Mel scale). Q2: What is the Mel scale and why is it used?
Psychophysical scale of perceived pitch. Human hearing has better frequency resolution at low frequencies. Mel scale approximates this: linear below 1kHz, logarithmic above. Filterbank has more filters at low frequencies. Q3: How is pitch (F0) estimated from speech?
Autocorrelation method: compute correlation of signal with itself at different lags. Peak at lag corresponding to pitch period. Cepstral method: peak in cepstrum at pitch period (quefrency). YIN algorithm: cumulative mean normalized difference function. Q4: What features distinguish voiced from unvoiced sounds?
Voiced: high energy, low ZCR, clear pitch, periodic waveform, strong formants. Unvoiced: low energy, high ZCR, no pitch, noise-like, flat spectrum. Q5: What are delta and delta-delta features?
First and second derivatives of MFCCs (velocity and acceleration). Capture temporal dynamics (how features change over time). Essential for good recognition accuracy. Deltas: difference between adjacent frames. Delta-deltas: difference of deltas. Q6: Write Python to extract MFCCs using librosa:
python
import librosa
# Load audio
y, sr = librosa.load('speech.wav', sr=16000)
# Extract 13 MFCCs
mfccs = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=13, n_fft=512, hop_length=160)
# mfccs shape: (13, num_frames)
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.