Spafe
Native Rust implementation of the core spafe audio feature extraction APIs.
The crate provides filter banks, spectrograms, cepstral features, spectral descriptors, frequency estimators, cochleagram generation, preprocessing helpers, and deterministic SVG visualization helpers.
Build
The crate also has an opt-in portable SIMD path for hot numeric kernels. Because
std::simd is still unstable, this feature currently requires nightly Rust:
Python Bindings
The crate exposes a PyO3 extension module through maturin. Python functions use plain Python lists for one-dimensional signals and nested lists for matrices.
Install locally in a virtual environment:
Build a wheel:
Basic Python usage:
= 16_000
=
=
=
, =
Test
RUSTDOCFLAGS="-D warnings -D missing_docs"
Examples
Generate a filter-bank SVG:
Generate a cochleagram SVG:
Python examples live in examples/python, use matplotlib, and write outputs to
target/python-examples:
Interactive notebooks live in notebooks:
They cover feature extraction, filter banks, pitch tracking, cochleagrams,
spectrogram variants, conversion helpers, parameter sensitivity, option tuning,
performance, and visualization/export/classification recipes.
The real-audio notebook uses notebooks/sample_uk.opus and requires ffmpeg.
Basic Usage
use *;