TensorStack.Audio.Windows
0.1.18
Prefix Reserved
dotnet add package TensorStack.Audio.Windows --version 0.1.18
NuGet\Install-Package TensorStack.Audio.Windows -Version 0.1.18
<PackageReference Include="TensorStack.Audio.Windows" Version="0.1.18" />
<PackageVersion Include="TensorStack.Audio.Windows" Version="0.1.18" />
<PackageReference Include="TensorStack.Audio.Windows" />
paket add TensorStack.Audio.Windows --version 0.1.18
#r "nuget: TensorStack.Audio.Windows, 0.1.18"
#:package TensorStack.Audio.Windows@0.1.18
#addin nuget:?package=TensorStack.Audio.Windows&version=0.1.18
#tool nuget:?package=TensorStack.Audio.Windows&version=0.1.18
TensorStack.Audio.Windows
TensorStack.Audio.Windows provides Windows-specific support for reading and writing audio using FFmpeg. It allows loading audio information, reading and writing audio tensors, and muxing audio into video files.
AudioInput
AudioInput wraps an audio file into a convenient object backed by an AudioTensor. It allows loading, manipulating, and saving audio.
// Load Audio
AudioInput audioInput = new AudioInput("speech.wav");
AudioInput audioInputAsync = await AudioInput.CreateAsync("speech.wav");
// With custom codec, sample rate, and channels
AudioInput audioInput = new AudioInput("music.mp3", "pcm_f32le", 44100, 2);
AudioInput audioInputAsync = await AudioInput.CreateAsync("music.mp3", "pcm_f32le", 44100, 2);
// Save Audio
audioInput.Save("output.wav");
await audioInput.SaveAsync("output.wav");
Notes
AudioInputusesAudioManagerinternally to handle the audio tensor.AudioManager.Initializeonly needed for custom FFmpeg/FFprobe binaries or a different temp directory; the NuGet package provides defaults.
AudioManager
AudioManager is a static helper class for loading, saving, and processing audio files. It can read audio into tensors, write tensors back to audio files, extract audio from videos, and add audio to videos. It uses FFmpeg/FFprobe under the hood and provides both synchronous and asynchronous methods.
Load Audio Information
AudioInfo info = AudioManager.LoadInfo("file.wav");
AudioInfo info = await AudioManager.LoadInfoAsync("file.wav");
Returns metadata including codec, sample rate, channels, duration, and sample count.
Load Audio Tensor
AudioTensor tensor = AudioManager.LoadTensor("file.wav", "pcm_s16le", 16000, 1);
AudioTensor tensor = await AudioManager.LoadTensorAsync("file.wav", "pcm_s16le", 16000, 1);
AudioTensor contains the raw audio samples in float32 format.
Save Audio Tensor
AudioManager.SaveAudio("output.wav", tensor);
await AudioManager.SaveAudioAync("output.wav", tensor);
Add Audio to Video
AudioManager.AddAudio("video.mp4", "sourceAudio.mp3");
await AudioManager.AddAudioAsync("video.mp4", "sourceAudio.mp3");
This muxes the audio from the source file into the target video.
Initialization
The NuGet package supplies FFmpeg binaries. Initialization is only needed if you want to use custom binaries or a different location:
AudioManager.Initialize("ffmpeg.exe", "ffprobe.exe", "Temp");
This sets up the executable paths and temporary directory used for conversions.
Notes
- All audio I/O uses FFmpeg under the hood.
- Asynchronous methods use
Taskand support cancellation. - Audio data is handled in
float32format internally.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0-windows10.0.17763 is compatible. net10.0-windows was computed. |
-
net9.0-windows10.0.17763
- TensorStack.Audio (>= 0.1.18)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.