Extracts engine order magnitudes and positional deviations from audio recordings via pitch-adaptive spectral analysis.
This tool implements the spectral analysis pipeline described in:
Doerfler & Wyse, "Analysis-Driven Procedural Generation of an Engine Sound Dataset with Embedded Control Annotations", EUSIPCO 2026. [arXiv]
Engine sounds are characterised by their engine orders -- sinusoidal components at integer and half-integer multiples of the crankshaft rotation frequency. This package extracts per-order features from multi-channel engine recordings (stereo audio + RPM/torque control channels) through three processing stages:
- Angle-domain resampling: Time-warps each frame so the fundamental frequency is held constant, using cubic-spline interpolation.
- Frequency-aligned FFT analysis: Scales the Blackman analysis window to span P = 20 fundamental periods and zero-pads by factor z = 4, locking each order to a fixed bin index regardless of RPM.
- Centroid-based order estimation: Estimates true order positions via spectral centroid within tapered rectangular regions, with magnitude recovery through parabolic interpolation.
The output is a JSON file containing per-order magnitudes A_h and deviations delta_h indexed by (RPM, torque) operating point.
pip install -e .- Python >= 3.9
- numpy, scipy, librosa, matplotlib
# Analyse a single file
engine-order-analysis /path/to/recording.wav
# Analyse a folder of WAV files
engine-order-analysis /path/to/folder/
# Specify output path and generate plots
engine-order-analysis /path/to/recording.wav -o results.json --plot
# Custom sample rate and chunk size
engine-order-analysis /path/to/folder/ --sample-rate 16000 --chunk-size 65536from engine_order_analysis import run_analysis
# Run on a single file
output_path = run_analysis(
input_path="/path/to/recording.wav",
output_path="results.json",
plot=True,
)
# Run on a folder
output_path = run_analysis(input_path="/path/to/folder/")Each WAV file must contain 4 channels at 48 kHz (resampled to 16 kHz for analysis):
| Channel | Content |
|---|---|
| 1-2 | Stereo engine audio |
| 3 | RPM signal (value x 0.0001) |
| 4 | Torque signal (value x 0.001) |
This is the format used by the Procedural Engine Sounds Dataset.
The JSON output maps "RPM,torque" keys to per-order analysis results:
{
"3200,150": {
"magnitudes": [[0.023, 0.015, ...], ...],
"deviations": [[0.001, -0.003, ...], ...]
}
}- magnitudes: List of frames, each containing 128 values (orders 0.5 to 64.0).
- deviations: Order-normalised offset between estimated and nominal order positions. Positive = sharp, negative = flat.
With --plot, four heatmap PNGs are generated: magnitudes and deviations each plotted against RPM and torque.
@inproceedings{doerfler2026eusipco,
title={Analysis-Driven Procedural Generation of an Engine Sound Dataset
with Embedded Control Annotations},
author={Doerfler, Robin and Wyse, Lonce},
booktitle={Proc. 34th European Signal Processing Conference (EUSIPCO)},
year={2026},
address={Bruges, Belgium}
}CC BY-NC 4.0