![]() |
VOOZH | about |
dotnet add package ElBruno.Whisper --version 0.2.0
NuGet\Install-Package ElBruno.Whisper -Version 0.2.0
<PackageReference Include="ElBruno.Whisper" Version="0.2.0" />
<PackageVersion Include="ElBruno.Whisper" Version="0.2.0" />Directory.Packages.props
<PackageReference Include="ElBruno.Whisper" />Project file
paket add ElBruno.Whisper --version 0.2.0
#r "nuget: ElBruno.Whisper, 0.2.0"
#:package ElBruno.Whisper@0.2.0
#addin nuget:?package=ElBruno.Whisper&version=0.2.0Install as a Cake Addin
#tool nuget:?package=ElBruno.Whisper&version=0.2.0Install as a Cake Tool
๐ NuGet
๐ NuGet Downloads
๐ Build Status
๐ HuggingFace
๐ .NET
๐ GitHub stars
๐ Twitter Follow
Transcribe audio to text in .NET using OpenAI's Whisper model. Powered by ONNX Runtime with automatic model download from HuggingFace.
AddWhisper() in ASP.NET Core.en variants for best accuracy on English audiodotnet add package ElBruno.Whisper
using ElBruno.Whisper;
// Create client (downloads tiny.en model on first run)
using var client = await WhisperClient.CreateAsync();
var result = await client.TranscribeAsync("audio.wav");
Console.WriteLine(result.Text);
The first time you create a WhisperClient, the model is downloaded from HuggingFace to your local cache directory (~75 MB - 3 GB depending on model size). This typically takes 10-60 seconds depending on your internet connection and chosen model.
Track download progress:
using var client = await WhisperClient.CreateAsync(
progress: new Progress<ElBruno.HuggingFace.DownloadProgress>(p =>
{
if (p.Stage == ElBruno.HuggingFace.DownloadStage.Downloading)
Console.WriteLine($"{p.CurrentFile}: {p.PercentComplete:F0}%");
else
Console.WriteLine($"{p.Stage}: {p.Message}");
})
);
Subsequent runs load instantly from cache (%LOCALAPPDATA%/ElBruno/Whisper/models).
Whisper offers various model sizes. English-optimized models (.en suffix) are smaller and faster for English audio:
using var client = await WhisperClient.CreateAsync(new WhisperOptions
{
Model = KnownWhisperModels.WhisperSmallEn
});
var result = await client.TranscribeAsync("english-audio.wav");
Console.WriteLine(result.Text);
| Size | English | Multilingual | Parameters | Approx Size | Speed |
|---|---|---|---|---|---|
| tiny | tiny.en | tiny | 39M | 75 MB | โกโกโกโกโก |
| base | base.en | base | 74M | 140 MB | โกโกโกโก |
| small | small.en | small | 244M | 460 MB | โกโกโก |
| medium | medium.en | medium | 769M | 1.5 GB | โกโก |
| large | โ | large | 1550M | 3.0 GB | โก |
Use English-optimized (.en) models for:
Use Multilingual models for:
Monitor both file downloads and transcription progress:
var downloadProgress = new Progress<ElBruno.HuggingFace.DownloadProgress>(p =>
{
if (p.Stage == ElBruno.HuggingFace.DownloadStage.Downloading)
Console.Write($"\rโฌ๏ธ {p.PercentComplete:F0}%");
else
Console.WriteLine($"\nโ {p.Message}");
});
using var client = await WhisperClient.CreateAsync(progress: downloadProgress);
var result = await client.TranscribeAsync("audio.wav");
Console.WriteLine($"โ Transcribed: {result.Text}");
Register Whisper in ASP.NET Core or other DI-enabled applications:
builder.Services.AddWhisper(options =>
{
options.Model = KnownWhisperModels.WhisperBaseEn;
});
// Inject WhisperClient anywhere
public class TranscriptionService(WhisperClient whisper) { ... }
The TranscriptionResult includes:
var result = await client.TranscribeAsync("audio.wav");
Console.WriteLine(result.Text); // Transcribed text
Console.WriteLine(result.DetectedLanguage); // Detected language (for multilingual models)
Console.WriteLine(result.Duration); // Audio duration
Model download fails?
HF_TOKEN environment variableOut of memory?
For detailed troubleshooting, see .
| Sample | Description |
|---|---|
| Minimal console transcription | |
| Blazor app with audio recording and real-time transcription |
git clone https://github.com/elbruno/ElBruno.Whisper
cd ElBruno.Whisper
dotnet build ElBruno.Whisper.slnx
dotnet test ElBruno.Whisper.slnx --filter "Category!=Integration"
The repository includes comprehensive unit and integration tests:
Quick test run (unit tests, no model download):
dotnet test ElBruno.Whisper.slnx --filter "Category!=Integration"
Full test run (includes integration with real models):
dotnet test ElBruno.Whisper.slnx
Test audio files are provided in for validation and transcription testing. For details, see the .
Contributions are welcome! Please:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License โ see the file for details.
Made with โค๏ธ by Bruno Capuano (ElBruno)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on ElBruno.Whisper:
| Package | Downloads |
|---|---|
|
ElBruno.MarkItDotNet.Whisper
Local audio transcription for ElBruno.MarkItDotNet using OpenAI Whisper via ONNX Runtime. Converts audio files to Markdown transcripts offline. |
This package is not used by any popular GitHub repositories.