Recursive AI

System.Speech alternative for C# on Linux

Run local C# transcription on Linux, macOS and Windows with OneSpeech and Whisper.

System.Speech 10.0.0 is Windows-only. OneSpeech transcribes audio but does not run command lists you load into the Windows speech engine.

OneSpeech is a free, open-source local speech-to-text library for .NET from Recursive AI, licensed MIT OR Apache-2.0. NuGet · GitHub.

InstallNuGet
dotnet add package RecursiveAI.OneSpeech --version 1.1.0

OneSpeech 1.1.0 ships a managed .NET 10 assembly, and its release-pinned test matrix covers Linux x64 and Arm64, macOS Arm64, and Windows x64.

Transcribe an audio file on Linux

Program.cs.NET 10
using OneSpeech;
 
const string model = "openai/whisper-base";
await Speech.PrefetchAsync(language: "en", model: model);
var transcript = Speech.Transcribe("jfk.wav",
    language: "en", model: model);
Console.WriteLine(transcript.Text);

In a .NET 10 console project, save the JFK WAV sample from whisper.cpp next to the project and run from that folder. The first call prepares the model and supporting files; allow network access on first use.

Whisper base itself downloads about 295 MB of model files; prefetch also retrieves the supporting speech and timing models.

OutputOneSpeech 1.1.0 · Linux
And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.

Reference (National Archives transcript): “And so, my fellow Americans: ask not what your country can do for you—ask what you can do for your country.” The model got the words right; it punctuated them differently. See the published model results before choosing a model for your audio.

Grammar recognition and transcription solve different problems

With SpeechRecognitionEngine, you select a recognizer installed on Windows, load a grammar that describes what it should listen for (such as a list of commands), and feed it a microphone or WAV input. OneSpeech’s file API uses model weights to decode speech and returns a transcript with text and segments. Selecting a model or passing a language hint does not limit the output to your command list.

If your old grammar triggered an action, separate transcription from command matching. Match the recognized text against an explicit list, reject anything unknown or ambiguous, and keep the action behind the same checks as a typed command. If your app needs grammar constraints during decoding, not a check afterward, OneSpeech is not a drop-in fit. This comparison does not cover replacing SpeechSynthesizer.

What changes for a Linux deployment

  • Prepare the selected model and its supporting files. Run Speech.PrefetchAsync in a deployment step with the same model and language you plan to use. It prepares supporting files as well as the named model, without running inference. The per-operation download list explains why even a small transcription model can need a much larger cache.
  • Share the cache between deployment steps deliberately. Set ONESPEECH_MODEL_CACHE to a trusted directory available to the service user, or prefetch as that user. The cache documentation describes the Linux default and offline behavior. Verify one transcription with network access disabled before relying on that setup.
  • Supply your own live audio. Speech.Listen consumes a caller-supplied IAsyncEnumerable<AudioBuffer> of mono 16 kHz PCM. It does not open a microphone; your app captures audio and feeds the stream. Partial text can change. Use final events, not partials, for command matching.
  • Check the selected model’s terms separately. MIT OR Apache-2.0 covers the library; see the third-party notices for the terms of the weights you deploy.