Spectral Audio Features

Spectral audio features are compact scalar descriptors that summarize the shape of a magnitude spectrum — where its energy sits, how wide it is spread, how tonal or noise-like it is, and how quickly it changes over time. Instead of the full spectrum, each analysis window is reduced to a single number, producing one curve per feature. This makes spectral features ideal for sound characterization, building customer-specific metrics, and extracting inputs for AI/ML models.

Each feature is available in two forms: vs. Time (one value per overlapping FFT block along the time axis) and vs. RPM (one value per RPM step, sampled at the detected tacho / pulse-decoded speed crossing) — the latter is the tool of choice for run-up / coast-down characterization.

Signal Chain

All features operate on the linear RMS magnitude spectrum (not dB, not power):

signal → overlapping blocks → window → FFT → |X| magnitude → RMS scaling → drop DC & Nyquist → feature

Let ak be the linear magnitude of bin k, fk its frequency, and S = Σ ak the spectral sum.

Magnitude Frequency (Hz) Centroid Spread Rolloff (95%)

The Features

Spectral Centroid (Hz)

Center of gravity of the spectrum — the primary correlate of perceived brightness.

Centroid = Σ(fk · ak) / S

Spectral Spread (Hz)

Standard deviation of the spectrum about its centroid — how wide the energy is distributed (bandwidth).

Spread = √( Σ((fk − Centroid)² · ak) / S )

Spectral Skewness (dimensionless)

Asymmetry of the spectral distribution around the centroid. Positive → energy leans toward lower frequencies with a high-frequency tail.

Skewness = ( Σ((fk − Centroid)³ · ak) / S ) / Spread³

Spectral Kurtosis (dimensionless)

Peakedness / tailedness of the spectral distribution. High values indicate a sharp, concentrated spectrum.

Kurtosis = ( Σ((fk − Centroid)⁴ · ak) / S ) / Spread⁴
This is the raw fourth-moment ratio (it is not reduced by 3), matching the reference implementation.

Spectral Slope (1/Hz)

Slope of a linear regression of magnitude against frequency — the overall spectral tilt. Negative for spectra that fall off with frequency.

Slope = Σ((fk − f̄) · ak) / ( S · Σ(fk − f̄)² )

Spectral Decrease (dimensionless)

Perceptually-motivated measure of how the amplitude decreases from the lowest bin upward; emphasizes the low-frequency slope.

Decrease = Σk≥1[ (ak − a0) / k ] / Σk≥1 ak

Spectral Rolloff (Hz)

Frequency below which a given fraction (default 95%) of the total spectral magnitude is contained. A robust indicator of spectral "skew" toward high frequencies.

smallest fR such that Σfk≤fR ak ≥ threshold · S

Spectral Flatness (0…1)

Ratio of geometric to arithmetic mean of the magnitude spectrum (Wiener entropy). Near 1 → noise-like / flat; near 0 → tonal / peaky.

Flatness = exp( (1/N) Σ ln ak ) / ( (1/N) Σ ak )

Spectral Crest (ratio)

Peak-to-average ratio of the magnitude spectrum — large when a single tone dominates.

Crest = max(ak) / mean(ak)

Spectral Entropy (0…1)

Shannon entropy (base 2) of the spectrum treated as a probability distribution pk = ak/S, scaled by log₂(N). High → disorder / noise; low → concentrated / tonal.

Entropy = −Σ pk · log₂(pk) / log₂(N)

Spectral Flux (magnitude)

Amount of change between consecutive spectra — the L2 norm of the frame-to-frame magnitude difference. A high flux marks transients and onsets.

Fluxt = √( Σ (ak,t − ak,t−1)² )
The first frame (vs. Time) and first RPM step (vs. RPM) have no predecessor and are reported as 0.

Parameters

ParameterDefaultNotes
Spectrum Size (FFT)4096Block length in samples
WindowHanningApplied before the FFT
Overlap50%vs. Time only
RPM Step50 rpmvs. RPM only
Rolloff Threshold0.95Spectral Rolloff only
Flux NormL2Spectral Flux only

vs. Time and vs. RPM

The vs. Time variant frames the signal into overlapping FFT blocks and reports one feature value per block. The vs. RPM variant instead places one FFT block at each RPM step crossing (using the pulse-decoded speed where available, otherwise a tacho channel), so features can be read directly against engine / motor speed during a run-up.

Applications

Formulas follow the MPEG-7 audio descriptor family and Peeters (2003, CUIDADO). All features are computed on the linear magnitude spectrum; only Spectral Crest offers an optional decibel form.