Skip to main content

Module audio

Module audio 

Source
Expand description

Audio analysis: the Goertzel single-frequency detector, peak/RMS envelope followers, a Mel filterbank, and MFCC feature extraction. These are DSP front-ends (e.g. for a keyword-spotting pipeline); classifiers and neural nets live in embedded-nn.

Structs§

GoertzelDetector
A Goertzel single-frequency detector: computes the DFT magnitude at one target frequency via a simple two-pole recursive filter, without a full FFT. Ideal for detecting a known tone (e.g. DTMF, a pilot tone) from a stream of samples on constrained hardware.
GoertzelDetectorQ15
Q15 Goertzel detector: same two-pole recurrence as GoertzelDetector, with Q2.14 2 cos(ω) and i32 delays so a typical block (N ≲ 256) does not wrap.
PeakEnvelopeFollower
Peak envelope follower with independent attack/release time constants, as used for audio dynamics processing (compressors, limiters, VU-style level meters).
PeakEnvelopeFollowerQ15
Q15 peak envelope follower (same attack/release recurrence as PeakEnvelopeFollower).
RmsEnvelopeFollower
RMS envelope follower: a single-pole exponential moving average of instantaneous power, reported as an RMS level.
RmsEnvelopeFollowerQ15
Q15 RMS envelope follower.

Functions§

hz_to_mel
Converts a frequency in Hz to the Mel scale: 2595 * log10(1 + hz / 700).
mel_filterbank_f32
Applies a triangular Mel filterbank to a one-sided power (or magnitude-squared) spectrum, producing one energy value per Mel band — the standard first step of MFCC / speech feature extraction.
mel_to_hz
Converts a Mel-scale value back to Hz: 700 * (10^(mel / 2595) - 1).
mfcc_f32
Computes MFCC (Mel-Frequency Cepstral Coefficient) features from a single real-valued audio frame: FFT power spectrum, Mel filterbank, log compression, and a DCT-II to decorrelate the log-Mel-energies into cepstral coefficients. This is the standard speech/audio feature-extraction pipeline.