---
title: "oneaudio"
url: https://recursiveai.org/oneaudio/
description: "Audio decode, encode, resample, mix and analyze for .NET, written from the specifications with no dependency beyond the base class library. WAV, Ogg, Vorbis, Opus, FLAC and MP3, a real-time mixer that allocates nothing, EBU R 128 loudness, and device playback and recording. MIT or Apache-2.0."
---

# 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.

```sh
dotnet add package RecursiveAI.OneAudio
```

- [Getting started](https://recursiveai.org/oneaudio/docs/getting-started/)
- [Docs](https://recursiveai.org/oneaudio/docs/)
- [Cookbook](https://recursiveai.org/oneaudio/cookbook/)
- [Articles](https://recursiveai.org/oneaudio/articles/)
- [GitHub](https://github.com/recursive-ai-oss/oneaudio-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneAudio)

## A quick look

One call per job: load, play, stream, transcode, measure and normalize. Every default is tunable through an options record.

[Read the API](https://recursiveai.org/oneaudio/docs/api/)

*Program.cs · C#*

```
using 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");
```

### 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 method](https://github.com/recursive-ai-oss/oneaudio-csharp/blob/v1.2.1/README.md#benchmarks)

## The 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.OneAudio` and `RecursiveAI.OneAudio.Devices`, namespaces `OneAudio` and `OneAudio.Devices`.
- **.NET**: .NET 10. NativeAOT and trimming are supported. MIT or Apache-2.0.

## Go further

- [GitHub](https://github.com/recursive-ai-oss/oneaudio-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneAudio)
- [Getting started](https://recursiveai.org/oneaudio/docs/getting-started/)
- [Cookbook](https://recursiveai.org/oneaudio/cookbook/)
- [API](https://recursiveai.org/oneaudio/docs/api/)
- [Conformance](https://github.com/recursive-ai-oss/oneaudio-csharp/blob/v1.2.1/README.md#conformance)
- [Benchmarks](https://github.com/recursive-ai-oss/oneaudio-csharp/blob/v1.2.1/README.md#benchmarks)
- [Changelog](https://recursiveai.org/oneaudio/docs/changelog/)
