TranscribeCppSharp.Interop
0.4.0
dotnet add package TranscribeCppSharp.Interop --version 0.4.0
NuGet\Install-Package TranscribeCppSharp.Interop -Version 0.4.0
<PackageReference Include="TranscribeCppSharp.Interop" Version="0.4.0" />
<PackageVersion Include="TranscribeCppSharp.Interop" Version="0.4.0" />
<PackageReference Include="TranscribeCppSharp.Interop" />
paket add TranscribeCppSharp.Interop --version 0.4.0
#r "nuget: TranscribeCppSharp.Interop, 0.4.0"
#:package TranscribeCppSharp.Interop@0.4.0
#addin nuget:?package=TranscribeCppSharp.Interop&version=0.4.0
#tool nuget:?package=TranscribeCppSharp.Interop&version=0.4.0
<p align="center"> <img src="https://raw.githubusercontent.com/manuc66/TranscribeCppSharp/main/docs/assets/images/icon-512.png" alt="TranscribeCppSharp" width="112"> </p>
TranscribeCppSharp
.NET bindings for transcribe.cpp: load GGUF speech-to-text models and transcribe audio (16 kHz mono float PCM) from C#.
Three ways to use it:
- A command-line tool —
dotnet tool install -g TranscribeCppSharp.Cligives youtranscribe, which downloads a curated model on first use and prints or exports the transcript. See Command-line tool. - A .NET library — the
TranscribeCppSharpwrapper (plus the native runtime package for your platform) for C# code. See Getting started. - A desktop app —
TranscribeCppSharp.UI, an Avalonia GUI over the same wrapper. Each release attaches a self-contained archive per platform (not a NuGet package); you can also run it from a clone. See Desktop app.
📖 Full documentation → — the guide, the reference, and the measured limits with the method behind each one. Published from docs/; this README is the short version and the details are delegated to those pages.
Installation
The wrapper is platform-agnostic and ships no native binaries. A minimal install is the wrapper plus the native runtime package for your platform:
dotnet add package TranscribeCppSharp
dotnet add package TranscribeCppSharp.Native.linux-x64 # pick your platform
If you would rather not pick a platform (or want one package that works everywhere), install the bundle meta-package instead — it pulls the wrapper and every native runtime:
dotnet add package TranscribeCppSharp.Bundle
Native runtime packages: TranscribeCppSharp.Native.linux-x64,
.linux-arm64, .win-x64, .osx-arm64, .osx-x64.
Note: For Linux Alpine (musl) or other platforms, see Building from source. Like Using CUDA, a custom native build is picked up automatically when placed in the app output directory.
The wrapper resolves libtranscribe automatically in plain dotnet run scenarios (no
<RuntimeIdentifier> needed). If the native library is still missing at runtime (e.g. you
forgot the runtime package), the wrapper throws a DllNotFoundException that lists the
exact package to add for your platform and the paths it searched. It does not silently
produce a misleading error. See
Installation and
Native library loading.
Quick Start
The four snippets below are checked by a test: each is compared byte-for-byte against a
marked region in HighLevelApiTests.cs and samples/SmokeTest/Program.cs, so they
cannot drift from the API without failing the build
(ReadmeExamplesTest).
Basic Transcription
Model.Load initializes the compute backends automatically on first use, but you can (and for custom setups, should) do it explicitly with Backends.InitDefault():
Backends.InitDefault(); // optional: automatic in Model.Load, but explicit is clearer
var modelPath = TestConfig.ModelPath; // your GGUF model file, e.g. "test-models/ggml-tiny.bin"
var audioPath = TestConfig.AudioPath; // your WAV audio file, e.g. "test-audio/jfk.wav"
using var model = Model.Load(modelPath, p => p.WithBackend(BackendRequest.BackendCpu));
using var session = model.CreateSession();
var pcm = PcmExtensions.ReadWavToPcm(audioPath);
var transcript = session.Run(pcm);
Omit the WithBackend call to get the default AUTO policy, which runs on the GPU
whenever one initializes — see Compute.
Batch Processing
Backends.InitDefault(); // optional: automatic in Model.Load, but explicit is clearer
var modelPath = TestConfig.ModelPath; // your GGUF model file, e.g. "test-models/ggml-tiny.bin"
var audioPath = TestConfig.AudioPath; // your WAV audio file, e.g. "test-audio/jfk.wav"
using var model = Model.Load(modelPath, p => p.WithBackend(BackendRequest.BackendCpu));
using var session = model.CreateSession();
var pcm1 = PcmExtensions.ReadWavToPcm(audioPath);
var pcm2 = PcmExtensions.ReadWavToPcm(audioPath);
var results = Batch.Run(session, new[] { pcm1, pcm2 });
Real-Time Streaming
stream.Begin();
int chunkSize = 16000; // 1 second
for (int i = 0; i < pcm.Length; i += chunkSize)
{
int length = Math.Min(chunkSize, pcm.Length - i);
var chunk = pcm.AsSpan(i, length);
stream.Feed(chunk);
}
stream.Complete();
var text = stream.GetCurrentText();
Model Capabilities
A model is asked what it can do, not assumed. model.Supports(Feature.FeatureDiarization)
is the one worth calling before a run:
Backends.InitDefault(); // optional: automatic in Model.Load, but explicit is clearer
var modelPath = TestConfig.ModelPath; // your GGUF model file, e.g. "test-models/ggml-tiny.bin"
using var model = Model.Load(modelPath, p => p.WithBackend(BackendRequest.BackendCpu));
var supportsPnc = model.Supports(Feature.FeaturePnc);
var caps = model.GetCapabilities();
Speaker attribution, long audio and windowing: Long audio and diarization.
Desktop app
TranscribeCppSharp.UI is an Avalonia app on .NET 10 that drives
the same wrapper and the same native library — it adds no transcription logic of its own, and
its limits are the library's. It is built in CI on Linux, macOS and Windows.
Each release attaches a
self-contained archive per platform — TranscribeCppSharp.UI-<version>-<rid>.zip for
win-x64, linux-x64, linux-arm64, osx-arm64 and osx-x64. Unzip it and run the
executable: it carries the .NET runtime and the matching native transcribe.cpp build, so no
SDK is needed. Each archive also carries the project LICENSE and the upstream component
licences under licenses/. The caveats, stated plainly:
- The archives are not code-signed, so Windows SmartScreen and macOS Gatekeeper will warn or refuse on first launch. There is no installer and no notarization.
- macOS ships a bare executable, not a
.appbundle (noInfo.plist), so it has no Dock name or Finder integration, and Gatekeeper treats it like any unsigned download — clear the quarantine if it refuses to run:xattr -dr com.apple.quarantine TranscribeCppSharp.UI. - They carry no
ffmpeg, which the app still needs onPATHfor any non-WAV input and for the microphone (Audio input).
To build from source instead, fetch the native libraries once and then start it:
dotnet run --project tools/FetchNative # once: the native library the app loads
dotnet run --project src/TranscribeCppSharp.UI
Five tabs, one per job:
| Tab | What it does |
|---|---|
| Transcription | Pick a file, a model and the decoder settings (language, threads, KV type, context size, window length, and the knobs that only some model families have). The result comes back as text, as segments, as words, or as speaker-attributed segments, and exports to .txt, .vtt or .json. |
| Streaming | Transcribe the microphone live, with committed text on the left and the tentative part the model may still revise on the right. The commit policy and the family-specific knobs are there. |
| Batch | Queue several files and run them one after another against one loaded model, then export the results as .txt or .json. |
| Models | The 76 curated aliases, filterable by alias, family, size, licence, language, or what is already on disk, with per-row download, measure and delete. It can also time a model on audio you choose, on your machine, for this session only. |
| Settings | Backend and device selection, the cache directory, the native library's version, and the compute devices this build can see. |
Three things worth knowing before you rely on it:
- It shares the model cache with the
transcribeCLI. A model downloaded in one is there for the other, and the Models tab can delete what the CLI fetched. The three tabs that run a model list only what is on disk, so a model fetched by the CLI appears in them without you having to fetch it again; under each picker a count and aGet more…button say how to get the rest. - It asks the model what it can do, instead of guessing from the name. Loading is the only way the native library answers — the manifest declares no capabilities — so a model that is not on disk keeps every option visible and the app says so underneath the picker. Options are hidden only once a loaded model has said it lacks the feature.
- It does not rank models by accuracy. This project publishes no accuracy comparison
between them, so the app does not pretend to have one;
Measuretimes a model, and speed is all it tells you. See Streaming benchmarks for the one benchmark the project does have, and what it does not cover.
The tab that carries the library's limits is Streaming: the app calls the same
StreamSession the CLI and the library do, so the native abort documented in
Streaming benchmarks applies here too and is not a GUI bug.
Per-tab detail, and what the app does not do: Desktop app.
What it does not do
Stated plainly, so nothing is implied. Each item has its own page with the detail.
- The library is not thread-safe. At most one run per model at a time, across all of
that model's sessions; parallel workers each need their own
Model. This is an upstream 0.x limitation, not one this wrapper imposes (Concurrency). - A stream is not yet reliable for long sessions. Measured RTF degrades as a stream grows, and on the CPU backend a stream of ~88 s of audio aborts the process inside ggml — natively, uncatchably. Real numbers, the one knob that helps, and the reproduction are in Streaming benchmarks.
- Streaming cannot attribute speakers.
transcribe_stream_paramshas nodiarizefield in transcribe.cpp v0.4.0, so the streaming API cannot request it; we do not invent one (Diarization). - No CUDA runtime ships in the packages. The bundled binaries are CPU + Vulkan on Windows/Linux and Metal on macOS; an NVIDIA GPU means supplying your own CUDA build (Using CUDA).
- The MIT license does not cover the models. They come from different ecosystems, some non-commercial, and this project neither bundles nor curates them (Model licenses).
- Speaker attribution is not verified in CI. It is covered only when the ~668 MB MOSS
asset is fetched with
WITH_DIARIZATION_MODEL=1. Until then, a regression that emptiedSpeakerSegmentswould go unnoticed (diarization). - There is no GPU in CI. The tool is tested end to end on the CPU, but GPU selection itself is covered by policy tests, not by a real run (what the CLI does not do).
- The desktop app is unsigned and has no installer. Each release attaches a self-contained archive per platform, but nothing is code-signed — Windows SmartScreen and macOS Gatekeeper will warn on first launch — and there is no installer and no NuGet package for it. Its headless tests run in CI on all three platforms, but a real launch on each OS is not covered (Desktop app).
The formats the decoder is verified to read are listed, with the tests that cover them, on Audio input.
Attribution
This project is a packaging and binding effort only — the underlying library is not my work:
- The native library (
transcribe.cpp) is developed and owned by the transcribe.cpp authors (MIT License). - The bundled native components (ggml, etc.) are owned by their respective authors; their MIT license texts are distributed alongside the binaries in the
TranscribeCppSharp.Native.*packages. - I did not author the native library and claim no credit for it. This repository only adds:
- A C# interop layer (auto-generated P/Invoke bindings via
LibraryImport). - A high-level C# wrapper (
IDisposableresources, typed exceptions). - A command-line tool (
transcribe) and the model manifest it resolves against. - Pre-built native binaries packaged for .NET consumption.
- A C# interop layer (auto-generated P/Invoke bindings via
The transcribe.cpp project is an independent upstream project; bug reports about the native library itself should go to its repository.
Development
# Download native libraries for your current platform
dotnet run --project tools/FetchNative
# Run unit and integration tests
./scripts/run-integration-tests.sh
# Run the desktop app (also needs FetchNative; see Desktop app)
dotnet run --project src/TranscribeCppSharp.UI
Prerequisites, the opt-in diarization run, the checks that keep this documentation honest, and building from source: Development.
Governance
Security: report a vulnerability through the GitHub Security Advisory feature.
License: this project is licensed under the MIT License (matching transcribe.cpp).
The models you load are not covered by it — see
Model licenses.
Versioning: the wrapper and the native runtime are versioned separately on purpose;
TranscribeCppSharp 0.4.0 binds transcribe.cpp v0.4.0. See
Versioning & compatibility and
CHANGELOG.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TranscribeCppSharp.Interop:
| Package | Downloads |
|---|---|
|
TranscribeCppSharp
.NET bindings and packaging for transcribe.cpp (speech-to-text). The native library is developed by the transcribe.cpp authors — this package only adds C# bindings and pre-built binaries. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.4.0 | 38 | 10/17/2026 |
| 0.3.0-preview.221 | 63 | 10/3/2026 |
| 0.2.4 | 141 | 9/26/2026 |
| 0.2.4-preview.220 | 70 | 10/3/2026 |
| 0.2.4-preview.218 | 67 | 9/28/2026 |
| 0.2.4-preview.217 | 60 | 9/28/2026 |
| 0.2.4-preview.216 | 60 | 9/28/2026 |
| 0.2.4-preview.215 | 62 | 9/28/2026 |
| 0.2.4-preview.214 | 63 | 9/28/2026 |
| 0.2.4-preview.213 | 60 | 9/28/2026 |
| 0.2.4-preview.212 | 71 | 9/28/2026 |
| 0.2.4-preview.211 | 67 | 9/27/2026 |
| 0.2.4-preview.208 | 60 | 9/27/2026 |
| 0.2.4-preview.207 | 63 | 9/27/2026 |
| 0.2.4-preview.186 | 74 | 9/27/2026 |
| 0.2.4-preview.185 | 71 | 9/26/2026 |
| 0.2.4-preview.183 | 61 | 9/26/2026 |
| 0.2.4-preview.182 | 69 | 9/26/2026 |
| 0.2.3-preview.181 | 67 | 9/26/2026 |
| 0.2.3-preview.180 | 64 | 9/26/2026 |