Voice-enabled pervasive computing
Practical study notes on voice-enabled pervasive computing: signal capture, processing (ASR, VAD, MFCC), beamforming, TTS, latency, power and privacy considerations for engineers.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Voice interfaces let users control pervasive devices without hands or screens. Engineers use voice techniques when designing smart homes, wearables, phones and context-aware devices to capture commands, recognise speakers, generate speech, and preserve privacy under tight power and latency constraints.
Key ideas
Band-limited signal: a signal whose frequency content is zero above some maximum frequency f_max. Important because of sampling.
Nyquist–Shannon sampling theorem (exact statement, assumptions and short derivation): If a continuous-time signal x(t) has no frequency components above B Hz (i.e. it is band-limited to B), then it can be exactly reconstructed from its samples x[n] = x(nT) if the sampling frequency f_s = 1/T satisfies f_s > 2B. Assumptions: x(t) is square-integrable and strictly band-limited to B. Derivation sketch universities expect: (1) express x(t) via inverse Fourier transform limited to |f| ≤ B, (2) sample at t = nT and show sampled signal's Fourier transform is a periodic replication of original spectrum scaled by 1/T, (3) if f_s > 2B the replicas do not overlap, (4) apply an ideal low-pass filter with cutoff B to recover original spectrum, yielding exact reconstruction.
Digitisation chain: microphone (transducer) → pre-amplifier → anti-aliasing filter (cutoff ≤ f_s/2) → ADC (sampling + quantisation) → digital preprocessing (VAD, denoise) → feature extraction (e.g. MFCC) → acoustic model/ASR or speaker model. Define VAD (voice activity detection): algorithm that decides which frames contain speech.
Feature extraction: MFCC (Mel-Frequency Cepstral Coefficients): steps: window the signal into short frames (e.g., 20–40 ms; typical frame shift ≈ 10 ms), apply a window function (e.g., Hamming), compute the DFT and power spectrum (magnitude squared), pass it through a bank of triangular filters spaced on the mel scale (mel scale maps linear frequency to perceived pitch), take log energies, then apply DCT to decorrelate and obtain cepstral coefficients; optionally apply pre-emphasis before framing and cepstral mean/variance normalization and append Δ/ΔΔ coefficients for ASR. Assumptions: short-time stationarity for frames.
ASR (automatic speech recognition) pipeline: features → acoustic model (e.g., DNN-HMM) → decoder (language model + lexicon) → output text; or end-to-end models (e.g., CTC, RNN-T) for low-latency streaming. Define acoustic model as mapping from audio features to phonetic probabilities.
Wake-word detection: lightweight always-on classifier optimised for low power, low false reject rate (FRR), and low false accept/false alarm rate (FAR). Often uses keyword-specific models and on-device embeddings with a low CPU footprint.
Beamforming (delay-and-sum): with an array of M microphones, steer sensitivity to a direction by delaying each mic’s signal by the expected arrival-time difference and summing. For a plane wave arriving at angle θ (measured from the array normal; 0° = broadside, 90° = endfire) and microphone spacing d on a linear array, time delay between adjacent mics is τ = (d·sin θ)/c, where c is speed of sound. Assumption: far-field plane-wave.
Noise reduction and speech enhancement: methods include spectral subtraction, Wiener filtering and statistical model-based denoising. These improve SNR (see definition below) before feature extraction.
Text-to-speech (TTS): converts text to waveform using concatenative or neural methods (e.g., Tacotron + vocoder). Requirements in pervasive systems: low memory, low latency.
Latency and power trade-offs: define latency as time from spoken input to system response; define power budget in watts. Engineers must balance on-device vs cloud processing based on privacy, latency, and energy.
Privacy: voice data is sensitive. Define on-device processing as processing that keeps raw audio on the device; edge/cloud processing sends audio or features off-device. Legal and user-trust constraints often require on-device wake-word and metadata-only uploads.
Diagrams to draw when asked in exams:
- For sampling theorem: draw frequency axis showing original spectrum limited to ±B, then copies spaced by f_s; show overlap when f_s ≤ 2B and non-overlap when f_s > 2B. Label axes (frequency in Hz) and the copies at multiples of f_s.
- For beamforming: draw linear microphone array with spacing d, incident plane wave at angle θ, show path difference d·sin θ and label delay τ.
- For MFCC pipeline: draw boxes in a left-to-right flow: frame → window → DFT → Mel filterbank → log → DCT → MFCC coefficients.
Formulas
f_s > 2B — f_s: sampling frequency (Hz), B: maximum signal frequency (Hz). Applies for exact reconstruction of band-limited signals (Nyquist condition).
SNR = P_signal / P_noise — P_signal: average signal power (W), P_noise: average noise power (W). Unitless ratio. Use for linear SNR.
SNR_dB = 10 · log10(P_signal / P_noise) — SNR_dB in decibels (dB). Use when expressing SNR on a log scale.
τ = (d · sin θ) / c — τ: time delay between adjacent microphones (s), d: spacing (m), θ: incident angle measured from array normal (radians or degrees), c: speed of sound in air (~343 m/s at 20 °C). Applies to far-field plane-wave assumption.
X[k] = Σ_{n=0}^{N-1} x[n] · e^{-j 2π k n / N} — discrete Fourier transform (DFT). X[k] complex spectrum, x[n] time samples, N samples, units: same as x for magnitude. Applies for frame spectral analysis.
mel(f) = 2595 · log10(1 + f/700) — f in Hz → mel units. Used to build mel-filterbank.
c_m = Σ_{k=1}^{K} log(E_k) · cos[m · π · (k - 0.5) / K] — DCT for MFCC coefficient c_m, where E_k are mel-filter energies, K number of mel filters. Units: dimensionless after log.
Worked examples
- Sampling rate needed for speech content up to 7 kHz
- Given: maximum signal frequency B = 7 kHz.
- From Nyquist: f_s > 2B = 14 kHz.
- Choose standard sampling rate f_s = 16 kHz (common for wideband speech).
- Answer: > 14 kHz; choose 16 kHz.
- SNR calculation
- Given: signal average power P_signal = 0.01 W, noise average power P_noise = 0.0001 W.
- Linear SNR = P_signal / P_noise = 0.01 / 0.0001 = 100.
- SNR in dB = 10 · log10(100) = 10 · 2 = 20 dB.
- Answer: SNR = 100 (linear), 20 dB.
- Beamforming delay for linear array
- Given: microphone spacing d = 0.05 m, incident angle θ = 30°, speed of sound c = 343 m/s.
- Compute τ = (d · sin θ) / c = (0.05 · sin 30°)/343.
- sin 30° = 0.5 → numerator = 0.025 m.
- τ = 0.025 / 343 ≈ 7.29e-5 s = 72.9 µs.
- Answer: Delay between adjacent mics ≈ 72.9 µs.
- Short algorithm trace (MFCC steps, small frame)
- Frame of N = 4 samples: x = [0, 1, 0, -1] (units arbitrary). Apply Hamming window (sample values change); compute DFT (list magnitude squared), apply 3 mel filters (example triangular weights), compute log energies, apply DCT to get first two MFCCs. (Instructor: in exam a small numeric DFT is expected; here students must show each arithmetic step.)
Common mistakes
- Forgetting units for τ (seconds) and for d (meters); mixing degrees and radians without clear conversion in trigonometric functions.
- Assuming beamforming works unchanged in near-field; the τ formula is for far-field plane waves only.
- Forgetting privacy implications: stating "send everything to cloud" without discussing on-device wake-word or consent.
For your exam
Expected question types: definitions (define MFCC, beamforming, wake-word), short notes (compare on-device vs cloud ASR), derivations (Nyquist theorem, delay-and-sum beamformer), numericals (compute sampling rate, SNR, mic delay), algorithm traces (MFCC steps on a short signal), system design questions (design low-power wake-word detector for a wearable). Full-marks answers must: state clear definitions, list assumptions, show step-by-step derivations with labelled diagrams where requested, carry units through calculations, and discuss trade-offs (latency, power, privacy) for design questions.
Quick check
- What minimum sampling rate is required for a signal band-limited to 3.4 kHz?
- Write the formula to convert power ratio to decibels.
- For a microphone spacing of 6 cm and sound speed 343 m/s, what is the delay for θ = 90° (endfire)? Answers: 1) > 6.8 kHz, commonly 8 kHz (telephony). 2) SNR_dB = 10·log10(P_signal/P_noise). 3) τ = (0.06·sin 90°)/343 = 0.06/343 ≈ 175 µs.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?