oneaudio
Audio decode, encode, resample, mix and analyze for .NET, written from the specifications with no dependency beyond .NET itself. Built first for game audio.
A quick look
One call per job: load, play, stream, transcode, measure and normalize. Every default is tunable through an options record.
Read the APIusing OneAudio; var clip = Audio.Load("hit.wav"); var mixer = Audio.CreateMixer(); mixer.Play("hit.wav", new PlayOptions { Gain = 0.8f, Pan = -0.3f }); using var music = mixer.PlayStream("music.ogg", loop: true); Audio.Transcode("take.wav", "take.flac"); var loudness = Audio.Measure("take.flac"); Audio.Normalize("take.wav", "take-14.wav");
What it does
Six formats, streaming
Decodes WAV and RF64, Ogg, Vorbis, Opus, FLAC and MP3 into caller-provided spans, with sample-accurate seeking everywhere. Encodes WAV, FLAC and Opus.
A mixer for games
Voices, buses, ducking, pitch, pan, loops, fades and streaming sources, plus filters, a reverb and a limiter. The render callback allocates nothing and takes no locks.
Playback and recording
The RecursiveAI.OneAudio.Devices package plays a mixer and records from a microphone through WASAPI, Core Audio and ALSA. It follows the default device, reopens a lost one, and counts what the hardware really played.
Loudness
BS.1770-5 and EBU R 128: momentary, short-term, integrated, loudness range and true peak, at any sample rate. Normalize defaults to −14 LUFS with a −1 dBTP ceiling.
Checked against the references
All 12 Opus test vectors pass, the Opus encoder matches the RFC 6716 reference byte for byte on 269 of 269 configurations, and FLAC decodes bit-exact.
Faster than the managed decoders, with far less garbage
On every like-for-like file it decodes faster than NVorbis, Concentus, NLayer, PureFlac and NAudio.Flac, while allocating a fixed few hundred KB whatever the length. Measured with BenchmarkDotNet.
Every result and the methodThe package
- Decode
WAV and RF64, Ogg (chained streams), Vorbis, Opus, FLAC (native and in Ogg) and MP3 (MPEG-1, 2 and 2.5 Layer III, with gapless playback).
- Encode
WAV and RF64, FLAC at levels 0 to 8, and Opus, including Ogg Opus files. Identical input gives identical bytes on a platform.
- Resampling
Kaiser-windowed polyphase sinc, a faster polyphase mode and linear, independent of how the input is split into blocks.
- Trimming
Codecs are registered explicitly, so the ones an app doesn’t use trim away. Nothing is found by reflection.
- Clean room
Every codec is written from the published specifications; other implementations are used only as test oracles.
- Devices
Playback and capture in a second package,
RecursiveAI.OneAudio.Devices, over the operating system’s own audio libraries: WASAPI on Windows, Core Audio on macOS and iOS, ALSA on Linux. - Version
1.2.1, packages
RecursiveAI.OneAudioandRecursiveAI.OneAudio.Devices, namespacesOneAudioandOneAudio.Devices. - .NET
.NET 10. NativeAOT and trimming are supported. MIT or Apache-2.0.