A new kind of audio API for .NET
OwnAudioSharp is a professional-grade, cross-platform audio API for C# — with something no other .NET audio library has: from the first sample to the last byte, your audio is processed by a purpose-built Rust engine. You write 100% C#; Rust does the heavy lifting.
The entire audio path — decoding, mixing, effects, resampling, playback and capture — runs in a native Rust core that was written specifically for this package. On top of it sits a clean, idiomatic C# surface. The result: low CPU usage and a small memory footprint — engineered to industry standards for professional, production-ready use.
- 🦀 Rust engine, C# surface — native performance with a managed developer experience.
- 🎯 Rock-solid real-time path — no dropouts, no glitches.
- 📦 Zero external dependencies — one NuGet package, native code bundled and built for it.
- ⚡ Low CPU & memory — real-time headroom on desktop and mobile alike.
- 🌍 Truly cross-platform — Windows, macOS, Linux, Android and iOS from a single API.
Nothing like it exists for C# today.
Decoding is pure Rust too — no external codecs, no FFmpeg, no system dependencies. The built-in decoder handles MP3, FLAC, WAV (PCM/ADPCM), AAC, ALAC, MP4/M4A, OGG/Vorbis and AIFF out of the box, on every platform.
[!IMPORTANT]
The example projects have been rewritten for the current OwnAudioSharp version.
Every sample in OwnAudio/Examples now follows the 4.x API rules: tracks
start together through AddSourcePrepared / StartPreparedSources, seeking goes through
AudioMixer.Seek, and the end of a song, device loss and DSP load come from PlaybackEnded,
StreamFaulted and SessionLoad instead of the obsolete dropout events. The Multitrack Player
has been rebuilt from scratch as a compact, readable reference app. If you copied code from an
older example, it is worth a second look.
🎵 Try OwnMusicAi — a Suno-style song generator that runs on your own machine
OwnMusicAi generates whole songs locally, on your own computer — no cloud, no subscription.
The music itself comes from YuE2-3B, a recently released open model; the AI is not my work.
What I built is the application around it: the program that drives the model, with OwnAudioSharp
doing the audio. Give it a try and use it freely, just for fun:
github.com/ModernMube/OwnMusicAi
🆕 The documentation site has been rebuilt
It is no longer a flat list of classes. The site now walks you through the API in the order you
actually meet it, and answers "how do I build this?" as well as "what does this method do?".
|
|
| ⚡ Quick Start |
Empty folder to playing audio in three steps. |
| 🧭 Core Concepts |
The five pieces — engine, mixer, sources, effects, clock — plus the audio vocabulary. |
| 🍳 Recipes |
Complete, copyable answers: multi-track sync, transport, meters, live effects, recording, generated audio, offline rendering. |
| 📘 The API, in order |
Eight numbered steps from initialization to MIDI, each with a "why and when". |
| 🩺 Troubleshooting & FAQ |
No sound, crackling, drift, plugin problems — what happened, why, and the fix. |
What you get
| Category |
Capability |
| Playback & Mixing |
Multi-track sync, real-time tempo/pitch, per-track volume |
| Recording |
Low-latency capture with device selection, WAV writing |
| Channel routing |
Per-source routing onto a multi-channel interface, with fan-out |
| Effects |
19 real-time DSP effects (reverb, OwnReverb, OwnCompressor, OwnDelay, OwnDynamicAmp, EQ, limiter, …) |
| Plugins |
VST3 effect plugins with their own editor GUI on the desktop, AudioUnits on macOS and iOS |
| MIDI |
Hardware I/O, SMF file read/write, hardware-accurate clock |
| Network |
Sample-accurate multi-device sync over LAN |
| Mastering |
Reference-based mastering (Audio Matchering) |
| Analysis |
Real-time chord detection, MT3 multi-instrument transcription, before/after effect spectrum |
| Calibration |
SmartMaster speaker calibration with automatic EQ correction |
Recommended for: music players and DAWs, DJ software, music-education tools, broadcast and podcast pipelines, live-performance apps, and low-latency game audio.
Installation
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.Mt3 # Optional — MT3 transcription
| Package |
Platforms |
What it is |
OwnAudioSharp |
Windows, Linux, macOS |
The complete edition. Playback, recording, mixing, effects, VST3 and MIDI, plus the analysis features (chord detection, note transcription, matchering) and the waveform display. |
OwnAudioSharp.Mobile |
Android, iOS |
The same feature set built for mobile, including matchering and MIDI — minus the ONNX-based analysis (no chord detection, no note transcription) and the waveform display. No UI framework dependency, so it fits any mobile UI stack. |
OwnAudioSharp.Basic |
Windows, Linux, macOS |
Audio in and out, and nothing that could be left out. Playback, recording, mixing, effects and VST3 — no analysis features, no ONNX models, no UI dependency. |
OwnAudioSharp.Mt3 |
Windows, Linux, macOS (ARM) |
Optional add-on. Swaps the note transcriber behind chord detection for MT3, which labels every note with its instrument. Separate package because ONNX Runtime costs ~26 MB per platform. |
Requirement: .NET 10.0 or later. The native Rust engine — including the audio decoder — is bundled in the package. There is nothing else to install and no external codecs to configure.
Building a mobile app
If you consume OwnAudioSharp.Mobile from NuGet, there is nothing to configure. The package
carries the native engine for every Android ABI and both iOS architectures, and the SDK puts
them into your APK or app bundle on its own — the JNI handshake Android needs for device
enumeration is done by the library at startup.
|
Minimum |
Notes |
| Android |
7.0 (API 24) |
arm64-v8a, armeabi-v7a, x86_64. Audio runs on AAudio. |
| iOS |
12.2 |
Device and simulator, arm64 + x64. The engine is linked statically. |
Add RECORD_AUDIO to your manifest if you capture audio; playback needs no permission.
Building this repository from source is different — -p:BuildMobile=true is mandatory:
dotnet build YourApp.csproj -c Debug -p:BuildMobile=true
dotnet publish YourApp.csproj -c Release -p:BuildMobile=true
The engine projects only expose their net10.0-android and net10.0-ios target frameworks when
that property is set. Leave it off and everything still builds — your app quietly links the
desktop net10.0 assemblies instead, installs onto the phone, and then throws on the first
Initialize call:
AudioEngineException: Failed to initialize Rust audio engine:
internal panic in native audio engine: android context was not initialized
The flag has to be on the command line, where it reaches restore as well as build; setting it
inside the project file or through AdditionalProperties on a ProjectReference does not work.
This applies to the samples in OwnAudio/Examples/ too — see the
Android and
iOS sample READMEs.
On iOS add a RuntimeIdentifier as well (ios-arm64, iossimulator-arm64 or
iossimulator-x64): the engine is a static library picked per RID, and no single one covers
device and simulator.
Deploying with -t:Run or -t:Install needs an emulator or a connected device with USB
debugging enabled, otherwise the Android SDK stops with XA0010: No available device. Check
with adb devices first.
Features
Multi-Track Synchronized Playback
Play multiple audio files in perfect sync using a shared central clock. Each track has independent volume, pitch and tempo control — ideal for DAW-style apps or multitrack players.
Real-Time Tempo & Pitch
Adjust playback speed and pitch independently, in real time, across multiple tracks simultaneously.
Clips on One Track
GroupSource is a DAW lane: several audio files laid out on one timeline and summed natively into a single track, so they share one tempo and pitch stage, one effect chain and one fader — and a reverb tail rings on across a cut instead of stopping with it. Clips can be added, moved and removed while it plays; short files load into memory, long ones stream from disk.
var lane = new GroupSource(sampleRate: 48000, channels: 2);
lane.AddClip("take1.wav", 0.0);
SourceClip solo = lane.AddClip("solo.wav", 32.0);
mixer.AddSource(lane);
solo.StartSeconds = 36.0; // moved while it plays
Guide: GroupSource
19 Real-Time DSP Effects
Reverb, OwnReverb (16-line FDN reverb with ducking), OwnCompressor (look-ahead, auto release, mid/side), OwnDelay (tape style delay with in-loop saturation and diffusion), OwnDynamicAmp (BS.1770 loudness rider with true-peak limiter), equalizer, compressor, limiter, chorus, delay, distortion and more — freely combinable, inserted per-track or on the master bus.
VST3 & AudioUnit Plugin Support
Load VST3 effect plugins and use their own editor GUI, integrated into the effect chain like any built-in effect. On macOS AudioUnits load the same way, and on iOS the Mobile package hosts AudioUnits, third-party AUv3 extensions included. The plugin host has no JUCE in it since OwnAudioVst 2.0.
Full guide: OwnAudio/Source/Effects/VST/README.md
Effect Analysis — See What an Effect Does
Tap any effect chain and get the signal on both sides of it, block for block, while it plays. EffectSpectrumAnalyzer turns that into a live before/after spectrum; effect latency is compensated, so the two sides line up.
Guide: Effect analysis
Simple Recording & Playback
Straightforward capture from any input device with configurable sample rate, buffer size and channel count.
Writing WAV Files
mixer.StartRecording("session.wav") captures the finished mix — post master-effects — straight to disk while it plays, with optional input-latency compensation so a live take lands on the beat. Set mixer.RenderingMode = ClockMode.Offline first and the same call becomes a deterministic bounce that never drops a block.
For anything that is not the master bus — one source on its own, a generated signal, the result of your own processing — WaveFileWriter is the same writer exposed directly. It streams Float32 PCM to disk instead of holding the take in memory:
using OwnaudioNET.Mixing;
var source = new FileSource("song.flac");
source.Play();
using (var wav = new WaveFileWriter("bounce.wav", source.Config))
{
float[] buffer = new float[4096 * source.Config.Channels];
while (!source.IsEndOfStream)
{
int frames = source.ReadSamples(buffer, 4096);
if (frames <= 0) break;
wav.WriteSamples(buffer.AsSpan(0, frames * source.Config.Channels));
}
} // the RIFF header is patched here — close the file before reading it back
Guide: Recording
Channel Routing on a Multi-Channel Interface
Place each source on the outputs you choose: playback on 1/2, a click on 3/4, a cue mix somewhere else. OutputChannelMapping covers the simple case; OutputRoute is destination-indexed, so one mono signal can reach several outputs at once, each with its own gain. MasterChannelScope keeps the master chain on the main pair, leaving the other channels a clean direct out, and InputSource.CaptureChannels picks the physical inputs a live source takes — several live inputs share one capture stream. Routing changes take effect while audio runs, without reopening a stream.