TensorStack.AudioCpp
0.15.0
Prefix Reserved
dotnet add package TensorStack.AudioCpp --version 0.15.0
NuGet\Install-Package TensorStack.AudioCpp -Version 0.15.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.15.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TensorStack.AudioCpp" Version="0.15.0" />
<PackageReference Include="TensorStack.AudioCpp" />
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.15.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TensorStack.AudioCpp, 0.15.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.15.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.15.0
#tool nuget:?package=TensorStack.AudioCpp&version=0.15.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TensorStack.AudioCpp
Basic .NET Wrapper API for audio.cpp
Nuget Package
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]
});
}
}
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 | Versions 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.
-
net10.0-windows10.0.17763
- Microsoft.Extensions.Logging (>= 11.0.0)
- TensorStack.Common (>= 0.15.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.