AI Features

AI-powered audio processing. Available in OwnAudioSharp only — not in the Basic package.

⚠️

These features require the full OwnAudioSharp NuGet package. They are not available in OwnAudioSharp.Basic.
ONNX model files are not bundled in the NuGet package. They are downloaded automatically on first use via VocalRemoverModelManager.DownloadModelAsync() and stored in the user's local application data folder. No manual setup is required.

Vocal Remover

Separates vocals from instrumental using ONNX neural network models. Namespace: OwnaudioNET.Features.Vocalremover

C# — Download model & separate
using OwnaudioNET.Features.Vocalremover;

// Download the model on first run (skipped automatically if already present)
if (!VocalRemoverModelManager.IsModelAvailable(InternalModel.Best))
{
    await VocalRemoverModelManager.DownloadModelAsync(
        InternalModel.Best,
        new Progress<ModelDownloadProgress>(p =>
            Console.Write($"\rDownloading: {p.Percentage:F1}%")));
}

var options = new SimpleSeparationOptions
{
    Model                = InternalModel.Best,  // see model table below
    OutputDirectory      = "output/",
    DisableNoiseReduction = false               // true = skip noise reduction
};

using var separator = new SimpleAudioSeparationService(options);
separator.Initialize();

var result = separator.Separate("song.mp3");

Console.WriteLine(result.VocalsPath);       // path to vocals-only file
Console.WriteLine(result.InstrumentalPath); // path to instrumental-only file

VocalRemoverModelManager

MemberDescription
DefaultModelsDirectoryGet/set the local folder where model files are stored. Defaults to LocalApplicationData/OwnAudio/models/. Override at startup to redirect storage.
IsModelAvailable(model)Returns true if the model file is already present on disk.
DownloadModelAsync(model, progress, cancel)Downloads a single model from HuggingFace. Skips silently if the file already exists. Reports ModelDownloadProgress with byte count and percentage.
EnsureModelsAvailableAsync(models, progress, cancel)Downloads all models in the collection that are not yet present. Models are fetched sequentially.

Available Models

ModelSizeSpeedQualityBest for
InternalModel.Default~28 MBMediumVery GoodGeneral purpose
InternalModel.Best~50 MBSlowExcellentFinal quality separation
InternalModel.Karaoke~28 MBMediumExcellentKaraoke tracks, preserves vocals
InternalModel.HTDemucs~166 MBSlowestHighestMulti-stem (vocals, bass, drums, other)

SimpleSeparationOptions

PropertyTypeDescription
ModelInternalModelWhich ONNX model to use for separation.
ModelPathstring?Optional path to a custom ONNX file. Takes precedence over Model when set and the file exists.
OutputDirectorystringDirectory where output files are written.
DisableNoiseReductionboolSet to true to skip post-processing noise reduction (default: false).
EnableGPUboolUse GPU acceleration via CoreML (macOS) or CUDA (Windows/Linux). Default: true.
ChunkSizeSecondsintAudio chunk size in seconds. 0 processes the entire file at once. Default: 15.

Chord Detection

Detects musical chords, key, and tempo from audio files. Namespace: OwnaudioNET.Features

C# — From a file
var (chords, key, bpm) = ChordDetect.DetectFromFile("song.mp3", intervalSecond: 1.0f);

foreach (var chord in chords)
    Console.WriteLine($"{chord.TimeSeconds:F1}s  {chord.ChordName}");

Console.WriteLine($"Key: {key}  BPM: {bpm}");
C# — From multiple files (mixed)
// Mixes all files before analysis
var (chords, key, bpm) = ChordDetect.DetectFromFiles(
    new[] { "guitar.wav", "piano.wav" },
    intervalSecond: 0.5f);
C# — Real-time detection
// Continuous detection from an active note stream
var (chord, stability) = ChordDetect.DetectRealtime(
    notes,                   // List<Note>
    DetectionMode.Standard,
    bufferSize: 4096);

Console.WriteLine($"Chord: {chord}  Stability: {stability:P0}");

Return Types

MemberTypeDescription
chordsList<TimedChord>List of chords with timestamps.
TimedChord.TimeSecondsdoubleTimestamp in seconds.
TimedChord.ChordNamestringChord name (e.g. "Cmaj", "Am7").
keyMusicalKeyDetected musical key.
bpmintDetected tempo in BPM.
stabilityfloatReal-time detection confidence (0.0–1.0).

Auto-Mastering (Matchering)

AI-driven EQ matching and automated audio mastering. Namespace: OwnaudioNET.Features

C# — Analyze spectrum
AudioSpectrum spectrum = AudioAnalyzer.AnalyzeAudioFile("track.wav");
C# — EQ match to reference
AudioAnalyzer.ProcessEQMatching(
    sourceFile: "my-mix.wav",
    targetFile: "reference.wav",   // the "sound" to match
    outputFile: "mastered.wav");
C# — Apply playback system preset
AudioAnalyzer.ProcessWithEnhancedPreset(
    sourceFile: "my-mix.wav",
    outputFile: "for-club.wav",
    system:     PlaybackSystem.Club,  // Club, Car, Studio, HomeTheater
    eqOnlyMode: true);
C# — Batch process
AudioAnalyzer.BatchProcessWithEnhancedPreset(
    sourceFiles:    new[] { "track1.wav", "track2.wav", "track3.wav" },
    baseSampleFile: "reference.wav",
    outputDirectory: "output/",
    system:         PlaybackSystem.Studio,
    fileNameSuffix: "_mastered");

PlaybackSystem Values

ValueDescription
PlaybackSystem.ClubOptimized for nightclub / dance floor sound systems
PlaybackSystem.CarOptimized for in-car audio systems
PlaybackSystem.StudioNeutral studio monitor reference
PlaybackSystem.HomeTheaterHome theater speaker systems