Quick Start
From an empty folder to a playing audio file. Three steps, about three minutes.
1 · Create a project and add the package
You need .NET 10.0 or later. Everything else — including the audio decoder — comes in the package.
dotnet new console -o MyPlayer
cd MyPlayer
dotnet add package OwnAudioSharpNo codecs to install. MP3, FLAC, WAV, AAC, ALAC, MP4/M4A, OGG/Vorbis and AIFF all decode natively on every platform. No FFmpeg, no system dependencies.
2 · Paste this into Program.cs
Drop an audio file next to the project and point the path at it.
using OwnaudioNET;
using OwnaudioNET.Mixing;
using OwnaudioNET.Sources;
// Open the sound card — 48 kHz, stereo, 512-frame buffer
await OwnaudioNet.InitializeAsync();
OwnaudioNet.Start();
// The bus every source gets summed into
var mixer = new AudioMixer(OwnaudioNet.Engine!.UnderlyingEngine);
mixer.Start();
// Adding a source also starts it, so this is already playing
var track = new FileSource("song.mp3");
mixer.AddSource(track);
Console.WriteLine("Playing. Press Enter to stop.");
Console.ReadLine();
// Give the device back
track.Dispose();
mixer.Dispose();
await OwnaudioNet.ShutdownAsync();3 · Run it
dotnet runSilence? Nine times out of ten it's the file path or the wrong output device. Walk down the chain →
What just happened
Four lines did all the work, and they map exactly onto the four things you will keep using.
| Line | What it is |
|---|---|
InitializeAsync() | Opens the audio device and starts the native engine. One per app. Engine & Config → |
new AudioMixer(…) | The bus. Sums sources, holds master volume, effects, meters and the clock. Mixer → |
new FileSource(…) | One thing that makes sound. Files, microphones, buffers and your own generators are all sources. Sources → |
AddSource(track) | Puts it on the bus and starts it. Safe to call while other audio is playing. |
Add an effect
Effects go in two places: on the whole mix, or on one track. Here's the whole mix.
using OwnaudioNET.Effects;
mixer.AddMasterEffect(new ReverbEffect { RoomSize = 0.7f, Mix = 0.3f });
mixer.AddMasterEffect(new LimiterEffect(sampleRate: 48000f)); // runs after the reverbAnd here's one track, wrapped in its own chain:
var chain = new SourceWithEffects(new FileSource("guitar.wav"));
chain.AddEffect(new CompressorEffect { Ratio = 4f, AttackTime = 10f });
chain.AddEffect(new ReverbEffect { RoomSize = 0.6f, Mix = 0.25f });
mixer.AddSource(chain); // add the wrapper, not the source inside itIf you're building a UI app
One rule, and it covers WPF, WinForms, Avalonia and MAUI alike: use the async methods. Opening and closing a device blocks, and on Linux it can block for seconds.
// Startup — off the UI thread
var config = OwnaudioNet.CreateDefaultConfig();
config.EnableInput = false;
await OwnaudioNet.InitializeAsync(config);
OwnaudioNet.Start();
_mixer = new AudioMixer(OwnaudioNet.Engine!.UnderlyingEngine, bufferSizeInFrames: 1024);
_mixer.Start();
// Shutdown
_mixer?.Stop();
_mixer?.Dispose();
await OwnaudioNet.ShutdownAsync();Everything else — Play, Seek, Volume, AddSource — is non-blocking and safe straight from a button click or a slider. A ready-made engine service →
Which package
| Package | Platforms | What's in it |
|---|---|---|
OwnAudioSharp | Windows · macOS · Linux | Everything: mixing, effects, VST3, network sync, recording, MIDI, mastering, analysis, waveform display |
OwnAudioSharp.Mobile | Android · iOS | The same, minus the ONNX-based analysis |
OwnAudioSharp.Basic | Windows · macOS · Linux | Audio in and out only — no analysis, no ONNX, no UI dependency |
OwnAudioSharp.Midi | Windows · macOS · Linux | Standalone AOT-compatible MIDI library |
dotnet add package OwnAudioSharp # Desktop — everything
dotnet add package OwnAudioSharp.Mobile # Android / iOS
dotnet add package OwnAudioSharp.Basic # Desktop — minimal engine
dotnet add package OwnAudioSharp.Midi # MIDI only