Audio in Rust has lived too long on a foundation of C: libFLAC, libvorbis, libopus, the dr_libs headers, and a tangle of -sys crates. Today that foundation gets a Pure-Rust replacement.
Today we’re releasing OxiAudio 0.2.0 — the COOLJAPAN Pure-Rust audio codec and DSP layer: decode, encode, DSP effects, and spectral analysis, all in one workspace.
No libFLAC. No libvorbis. No libopus. No dr_libs. No FFI. No -sys crates. Default features carry zero C/C++/Fortran dependencies — just clean, memory-safe Rust that compiles to a single binary and goes wherever Rust goes.
Why OxiAudio
For decades, reading and writing audio from Rust meant binding to C. Decoding a FLAC file pulled in libFLAC. Vorbis and Opus meant libvorbis and libopus. The convenient single-header dr_libs decoders are great C, but they are still C — with the build-time toolchain, the unsafe boundary, and the platform-specific linking headaches that come with every native dependency. You inherited someone else’s memory model, and you shipped it in your binary.
OxiAudio ends that. The whole stack — the codecs, the DSP, the tagging, the streaming pipeline — is Rust. Default features are 100% Pure Rust, so there is no system library to install, no C compiler to invoke at build time, and nothing to break when you cross-compile or target WASM. The one exception is intentional and quarantined: MP3 encoding via LAME (LGPL) is the sole sanctioned FFI boundary, and it is opt-in through a separate crate that never touches the default or --all-features closure.
What we built
OxiAudio is a six-crate workspace behind a single oxiaudio facade (default features = ["pure"]):
oxiaudio/ (facade — default = ["pure"])
oxiaudio-core (AudioBuffer, traits, error, IPC, ring buffer, surround layouts)
oxiaudio-decode (SymphoniaDecoder + AIFF/AU/Opus/WavPack/Musepack/MIDI)
oxiaudio-encode (WAV/RF64, FLAC, AIFF, AU, ID3v2.4, APEv2; streaming + two-pass)
oxiaudio-encode-mp3-lame (LAME FFI adapter — opt-in, never default)
oxiaudio-dsp (resample, filters, dynamics, reverb, pitch, spectral, loudness)
1. Format support — read almost anything, write the formats that matter
On the decode side OxiAudio reads WAV/RF64, FLAC, AIFF / AIFF-C, AU / SND, MP3, OGG Vorbis, AAC / M4A, ALAC, Opus, WavPack, Musepack (SV7/SV8), and MIDI (SMF 0/1/2) — all Pure Rust. On the encode side it writes WAV / RF64, FLAC, AIFF, AU, and Opus (with a Pure-Rust CELT/SILK/Hybrid encoder), again with no FFI. MP3 encoding is available too, but only through the opt-in LAME quarantine crate.
2. A full DSP toolkit, not just codecs
oxiaudio-dsp is a complete signal-processing layer:
- Filters & EQ — Biquad EQ, parametric EQ, and Butterworth / Chebyshev / Elliptic / FIR filters.
- Dynamics — Compressor, Limiter, Gate, Expander, De-esser, and a Multiband compressor.
- Modulation & space — Chorus, Flanger, Phaser, Tremolo, Vibrato, Delay, Freeverb, and convolution reverb.
- Pitch & time — a Phase vocoder for pitch shifting and time stretching, a Channel vocoder, YIN / pYIN pitch detection, and an autocorrelation pitch tracker.
- Analysis & detection — onset detection (spectral flux, HFC, complex domain), beat tracking, and a deep feature set: MFCC, Chromagram, spectral centroid / flux / rolloff / flatness / contrast / tonnetz.
- Spectral core — STFT / iSTFT and Mel-spectrogram, built on OxiFFT (the COOLJAPAN Pure-Rust FFT), with Kaiser and FlatTop window functions.
- Noise reduction — spectral subtraction and a Wiener filter.
- Loudness — EBU R128 / ITU-R BS.1770 loudness (LUFS + true peak) and ReplayGain.
3. Multi-channel and surround
OxiAudio understands surround properly: Quad, 5.1, 7.1, 5.1-Side, and Atmos 7.1.4 layouts; a ChannelMap / ChannelId model with SMPTE / ITU-R BS.775 ordering; downmix (5.1 → stereo, N-ch → mono) and upmix utilities per ITU-R BS.775; and WAVE_FORMAT_EXTENSIBLE for writing WAV files with more than two channels.
4. Real tagging and advanced encoding
The encoder is more than a sample writer. It supports RF64 / BW64 WAV for files exceeding 4 GB, FLAC album art via METADATA_BLOCK_PICTURE (encode_flac_with_album_art), a full ID3v2.4 writer (UTF-8, APIC album art, USLT lyrics, extended-header CRC, ReplayGain), and an APEv2 tag writer for WavPack/Musepack output. For mastering it offers two-pass EBU R128 loudness normalization (−14 / −16 / −23 LUFS targets) and noise-shaped, ATH-weighted dithering for perceptually optimal bit-depth reduction.
5. A pipeline you can build on
For real-world apps OxiAudio ships streaming and pipeline primitives: a TranscodeStream streaming transcode pipeline (decode → optional DSP → encode), transcode_batch for parallel batch conversion via rayon, a composable DspChain effect builder, an AudioRingBuffer<T> lock-free SPSC ring buffer with a wait-free overflow policy, an AudioPipeline with parallel branches, bypass/mute, and latency reporting, and an AudioClock reporting drift_ppm, elapsed_frames, and elapsed_secs.
Getting Started
cargo add oxiaudio
A few lines take you from any supported file, through DSP, back out to FLAC:
use std::path::Path;
// Decode any supported format
let buf = oxiaudio::decode_file(Path::new("input.flac")).expect("decode failed");
println!("{} frames @ {} Hz", buf.frame_count(), buf.sample_rate);
// DSP: normalize, then add reverb
let mut out = buf.clone();
oxiaudio::dsp::normalize(&mut out, -1.0);
let with_reverb = oxiaudio::dsp::reverb(&out, 0.6, 0.4, 0.3);
// Re-encode as FLAC
oxiaudio::encode_flac(&with_reverb, Path::new("output.flac")).expect("encode failed");
Highlights
- Pure-Rust codecs both ways — decode FLAC/WAV/MP3/Vorbis/AAC/ALAC/Opus/WavPack/Musepack/MIDI; encode WAV/RF64/FLAC/AIFF/AU and Opus, with no FFI on the default path.
- A conformant Pure-Rust Opus encoder — CELT-only, SILK NB/WB, and Hybrid FB modes, RFC 6716 conformant.
- A complete DSP suite — filters, dynamics, reverb, phase vocoder, pitch detection, onset/beat tracking, spectral features, and noise reduction in one place.
- Broadcast-grade loudness — EBU R128 / ITU-R BS.1770 metering with true peak, ReplayGain, and two-pass normalization to standard LUFS targets.
- Real tagging — ID3v2.4 (with APIC art and USLT lyrics), APEv2, and FLAC picture blocks.
- Surround done right — up to Atmos 7.1.4, with ITU-R BS.775 down/upmix and EXTENSIBLE WAV output.
- Pipeline-ready — streaming transcode, parallel batch conversion, a lock-free ring buffer, and a branching audio pipeline.
Tips
- Stay Pure Rust by default. The
oxiaudiofacade defaults to["pure"]and pulls in zero C/C++/Fortran code. You only get a native dependency if you explicitly opt into MP3 encoding via the separateoxiaudio-encode-mp3-lamecrate — it is deliberately kept out of the default and--all-featuresbuilds. - Build effects with
DspChain. Rather than calling DSP functions one at a time, compose them with theDspChainbuilder, and reach forAudioPipelinewhen you need parallel branches, bypass/mute, or latency reporting. - Master to a loudness target in two passes. Use the two-pass EBU R128 normalization with −14, −16, or −23 LUFS targets (streaming, podcast, and broadcast respectively) and pair it with the noise-shaped (ATH-weighted) dithering when reducing bit depth.
- Going over 4 GB? Use RF64 / BW64 WAV output for long-form or high-channel-count captures that exceed the classic 4 GB WAV limit, and
WAVE_FORMAT_EXTENSIBLEfor more than two channels. - For real-time / low-latency paths, the
AudioRingBuffer<T>is a lock-free SPSC buffer with a wait-free overflow policy, andAudioClockgives youdrift_ppmand frame/second elapsed counters for clock tracking. - Spectral work rides on OxiFFT. STFT/iSTFT, Mel-spectrograms, and the MFCC/Chromagram feature extractors are built on the COOLJAPAN Pure-Rust FFT — Kaiser and FlatTop windows are included.
Part of the COOLJAPAN ecosystem
OxiAudio is part of NoFFI — the COOLJAPAN initiative to replace every C/C++/Fortran/-sys FFI dependency in the Rust world with a clean, memory-safe, 100% Pure Rust implementation. Where the old way meant linking libFLAC, libvorbis, libopus, and dr_libs, OxiAudio gives you the same capabilities in a single static binary with no system libraries and no build-time C toolchain. Its spectral layer is built on OxiFFT, the ecosystem’s Pure-Rust FFT, and it sits alongside the other oxi* projects building a sovereign Rust stack from the ground up.
Repository: https://github.com/cool-japan/oxiaudio
Star the repo if you want audio in Rust that you can read, audit, and ship without ever linking a line of C.
Pure Rust audio — sovereign, safe, and FFI-free.
— KitaSan at COOLJAPAN OÜ June 22, 2026