TensorStack.AudioCpp 0.16.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package TensorStack.AudioCpp --version 0.16.0
                    
NuGet\Install-Package TensorStack.AudioCpp -Version 0.16.0
                    
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="TensorStack.AudioCpp" Version="0.16.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TensorStack.AudioCpp" Version="0.16.0" />
                    
Directory.Packages.props
<PackageReference Include="TensorStack.AudioCpp" />
                    
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 TensorStack.AudioCpp --version 0.16.0
                    
#r "nuget: TensorStack.AudioCpp, 0.16.0"
                    
#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 TensorStack.AudioCpp@0.16.0
                    
#: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=TensorStack.AudioCpp&version=0.16.0
                    
Install as a Cake Addin
#tool nuget:?package=TensorStack.AudioCpp&version=0.16.0
                    
Install as a Cake Tool

TensorStack.AudioCpp

Basic .NET Wrapper API for audio.cpp

Nuget Package

AudioCpp Badge

Music Example

Generate music using ACE-Step

using (var backend = new AudioCppBackend(VendorType.Nvidia))
{
    await backend.InitializeAsync();

    using (var pipeline = new AudioCppPipeline(backend))
    {
        await pipeline.LoadAsync(new AudioCppOptions
        {
            Pipeline = "ace_step",
            ModelPath = "models/Ace-Step1.5",
            Backend = "cuda"
        });

        AudioTensor audio = await pipeline.GenerateAudioAsync(new GenerateAudioOptions
        {
            Prompt = "cinematic synth pop with clear vocals",
            Prompt2 = "We rise with the morning light",
            Duration = 60,
            Seed = 420
        });
    }
}

Speech Example

Generate speech using Kokoro

using (var backend = new AudioCppBackend(VendorType.Nvidia))
{
    await backend.InitializeAsync();

    using (var pipeline = new AudioCppPipeline(backend))
    {
        await pipeline.LoadAsync(new AudioCppOptions
        {
            Pipeline = "kokoro_tts",
            ModelPath = "models/Kokoro-82M-GGUF/kokoro-82m-q8_0.gguf",
            Backend = "cuda"
        });

        AudioTensor audio = await pipeline.GenerateAudioAsync(new GenerateAudioOptions
        {
            Prompt = "Hello from audio.cpp.",
            Language = "en-us",
            Task = "af_heart"
        });
    }
}

Speech Recognition Example

Transcribe speech using Parakeet-TDT

using (var backend = new AudioCppBackend(VendorType.Nvidia))
{
    await backend.InitializeAsync();

    using (var pipeline = new AudioCppPipeline(backend))
    {
        await pipeline.LoadAsync(new AudioCppOptions
        {
            Pipeline = "parakeet_tdt",
            ModelPath = "models/Parakeet-TDT-0.6B-v3-GGUF/parakeet-tdt-0.6b-v3-q8_0.gguf",
            Backend = "cuda"
        });

        // AudioInput is part of TensorStack.Media
        AudioTensor inputAudio = await AudioInput.CreateAsync("speech.wav", sampleRate: 16000, channels: 1);

        string text = await pipeline.GenerateTextAsync(new GenerateTextOptions
        {
            InputAudios = [inputAudio]
        });
    }
}

Live Speech Recognition Example

Transcribe the microphone as you speak using Voxtral Realtime, the text is returned as it is recognised

using (var backend = new AudioCppBackend(VendorType.Nvidia))
{
    await backend.InitializeAsync();

    using (var pipeline = new AudioCppPipeline(backend))
    {
        await pipeline.LoadAsync(new AudioCppOptions
        {
            Pipeline = "voxtral_realtime",
            ModelPath = "models/Voxtral-Mini-4B-Realtime-2602-GGUF/voxtral-mini-4b-realtime-2602-q8_0.gguf",
            Backend = "cuda"
        });

        // AudioCapture is part of TensorStack.Media, cancel stopToken to end the stream
        var microphone = AudioCapture.CaptureAsync(sampleRate: 16000, channels: 1, stopToken: stopToken);
        await foreach (var text in pipeline.GenerateTextStreamAsync(new GenerateTextOptions(), microphone))
        {
            Console.Write(text);
        }
    }
}

Any IAsyncEnumerable<AudioTensor> can be streamed, every chunk must have the same sample rate and channels. IsStreamSupported("asr") checks the loaded model supports it.

Voice Clone Example

Speak in the voice of a reference recording using OmniVoice, the speaker reference is passed in InputAudios

using (var backend = new AudioCppBackend(VendorType.Nvidia))
{
    await backend.InitializeAsync();

    using (var pipeline = new AudioCppPipeline(backend))
    {
        await pipeline.LoadAsync(new AudioCppOptions
        {
            Pipeline = "omnivoice",
            ModelPath = "models/OmniVoice-GGUF/omnivoice-q8_0.gguf",
            Backend = "cuda"
        });

        AudioTensor speaker = await AudioInput.CreateAsync("speaker.wav", sampleRate: 24000, channels: 1);
        AudioTensor audio = await pipeline.GenerateAudioAsync(new GenerateAudioOptions
        {
            Prompt = "This is my cloned voice.",
            ReferenceText = "The words spoken in speaker.wav.", // Required by some models (OmniVoice, Fish Audio)
            InputAudios = [speaker]
        });
        await audio.SaveAsync("Output.wav");
    }
}

Pipelines

AudioCppOptions.Pipeline is the audio.cpp model family, or null to identify the model from its path. Some of the pipelines:

Use Pipelines
Music ace_step, minimax_music3, stable_audio, yue2, heartmula
Sound effects stable_audio, moss_soundeffect
Speech kokoro_tts, supertonic, qwen3_tts, voxtral_tts, chatterbox_turbo, omnivoice, fish_audio, voxcpm2, higgs_audio_tts, magpie_tts, neutts
Speech recognition parakeet_tdt, qwen3_asr, canary_asr, cohere_asr, crisperwhisper, granite5asr, vibevoice_asr, voxtral_realtime (live)

IsTaskSupported checks the tasks of the loaded model (gen, tts, clon, asr etc).

Options

GenerateAudioOptions and GenerateTextOptions are translated to the request options of the loaded model. Values left at their default are not sent, so the audio.cpp model default applies, and only options the loaded model declares are applied.

Option Music Speech
Prompt caption or style text to speak
Prompt2 lyrics
Task route (text2music, cover, full etc) built-in voice
InputAudios source audio speaker reference

Any other audio.cpp option can be passed by name, these map 1:1 onto --request-option and --session-option:

new GenerateAudioOptions
{
    Prompt = "uplifting house music",
    Options = { ["sampler_mode"] = "euler" }
}
Product Compatible and additional computed target framework versions.
.NET net10.0-windows10.0.17763 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.16.1 74 11/30/2026
0.16.0 73 11/30/2026
0.15.3 78 11/27/2026
0.15.1 104 11/21/2026
0.15.0 98 11/18/2026
0.14.14 106 11/17/2026