RecursiveAI.OneAudio 0.1.0-alpha.5

This is a prerelease version of RecursiveAI.OneAudio.
There is a newer version of this package available.
See the version list below for details.
dotnet add package RecursiveAI.OneAudio --version 0.1.0-alpha.5
                    
NuGet\Install-Package RecursiveAI.OneAudio -Version 0.1.0-alpha.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RecursiveAI.OneAudio" Version="0.1.0-alpha.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RecursiveAI.OneAudio" Version="0.1.0-alpha.5" />
                    
Directory.Packages.props
<PackageReference Include="RecursiveAI.OneAudio" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RecursiveAI.OneAudio --version 0.1.0-alpha.5
                    
#r "nuget: RecursiveAI.OneAudio, 0.1.0-alpha.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RecursiveAI.OneAudio@0.1.0-alpha.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RecursiveAI.OneAudio&version=0.1.0-alpha.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RecursiveAI.OneAudio&version=0.1.0-alpha.5&prerelease
                    
Install as a Cake Tool

RecursiveAI.OneAudio

Audio decode, encode, resample, mix and analyse for .NET 10, written from the published specifications with no dependencies beyond the base class library. It is built first for game audio: the mixer's render callback allocates nothing and takes no locks. NativeAOT- and trim-clean (nothing uses reflection; formats are registered explicitly, so unused codecs trim away).

Formats

Decode Encode
WAV / RF64 PCM 8/16/24/32, float 32/64, WAVE_FORMAT_EXTENSIBLE yes
FLAC (native and Ogg) all depths 4-32 bit, 1-8 channels, bit-exact levels 0-8
Ogg Vorbis yes no
Ogg Opus yes yes
MP3 (MPEG-1/2/2.5 Layer III) yes, gapless with LAME headers no

Every decoder streams (Read into a span you provide, nothing allocated per call) and seeks to the exact frame. Malformed input raises a typed OneAudioException; sizes read from a file are checked against AudioLimits before anything is allocated.

Decode

using OneAudio;

var registry = new AudioCodecRegistry().AddOgg().AddVorbis().AddOpus().AddFlac().AddMp3().AddWav();
using var decoder = AudioDecoder.OpenFile("music.ogg", registry);   // the container is detected from the bytes

var buffer = new float[4096 * decoder.Format.Channels];             // interleaved float in [-1, 1]
int frames;
while ((frames = decoder.Read(buffer)) > 0)
{
    // use buffer[..(frames * decoder.Format.Channels)]
}
decoder.Seek(decoder.Format.SampleRate * 30);                       // frame 30 s in

Mix

var clip = AudioClip.FromDecoder(AudioDecoder.OpenFile("hit.wav", registry));   // short effect: decode once, play many times

var mixer = new AudioMixer(new MixerOptions { SampleRate = 48000, Channels = 2 });
var voice = mixer.Play(new PlayParams(clip) { Gain = 0.8f, Pan = -0.3f });

// On the audio device thread (no allocation, no locks):
mixer.Render(deviceBuffer);                                          // interleaved float; frames = length / channels
// On any other thread:
mixer.Stop(voice, fadeOutFrames: 480);

Voices, buses with sub-mixes, ducking, gain, pan, pitch, loops, crossfades, sample-accurate start, a voice cap with priorities, low-pass/high-pass filters, a reverb and a limiter, and streaming sources for music are included. Control calls reach the render thread through a preallocated lock-free queue.

Encode

using var input = AudioDecoder.OpenFile("take.wav", registry);
using var output = File.Create("take.flac");
FlacEncoder.Encode(input, output, new FlacEncoderSettings { CompressionLevel = 5 });   // decodes back bit-exact

WavEncoder works the same way. OpusFileWriter writes an Ogg Opus file from float PCM and resamples input that is not 48 kHz.

Loudness

using var decoder = AudioDecoder.OpenFile("mix.flac", registry);
LoudnessResult r = LoudnessAnalyzer.Measure(decoder);                // ITU-R BS.1770-5 / EBU R 128
Console.WriteLine($"{r.IntegratedLufs:F1} LUFS, true peak {r.TruePeakDbtp:F1} dBTP");
float gain = (float)r.GainFor(targetLufs: -23).Linear;               // cut back if the true peak would pass -1 dBTP

LoudnessMeter gives momentary, short-term and integrated loudness, loudness range and true peak on a live stream without allocating.

Resample

AudioResampler.Create(inRate, outRate, channels, quality) returns a polyphase (144 or 44 taps) or linear resampler for interleaved float; output does not depend on how the input is split into blocks.

Changes

What changed in each release is in CHANGELOG.md.

More

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RecursiveAI.OneAudio:

Package Downloads
RecursiveAI.OneGame.Audio

Audio device output and the audio service that drives a mixer.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1 0 10/27/2026
1.2.0 0 10/27/2026
1.1.0 0 10/27/2026
1.0.0 122 10/25/2026
0.1.0-alpha.5 40 10/25/2026