Skip to main content

Module audio

Module audio 

Source
Expand description

Audio & TinyML feature extraction: the Goertzel single-frequency detector, peak/RMS envelope followers, a Mel filterbank, and MFCC feature extraction — the standard preprocessing pipeline for embedded speech/audio keyword-spotting and TinyML models.

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.
PeakEnvelopeFollower
Peak envelope follower with independent attack/release time constants, as used for audio dynamics processing (compressors, limiters, VU-style level meters).
RmsEnvelopeFollower
RMS envelope follower: a single-pole exponential moving average of instantaneous power, reported as an RMS level.

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 TinyML feature-extraction pipeline.