Method Transcribe
Transcribe(WaveFile, string, CancellationToken)
Synchronously transcribes the provided audio content into text segments.
public SpeechToText.TranscriptionResult Transcribe(WaveFile audioFile, string language = "auto", CancellationToken cancellationToken = default)
Parameters
audioFileWaveFileThe WAV-format audio content to transcribe.
languagestringThe language identifier to transcribe in, or
"auto"to auto-detect.cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- SpeechToText.TranscriptionResult
A SpeechToText.TranscriptionResult containing transcription segments.
Examples
var model = LM.LoadFromModelID("whisper-large-turbo3");
var engine = new SpeechToText(model);
var audioFile = new WaveFile("audio.wav");
var result = engine.Transcribe(audioFile, language: "auto");
foreach (var segment in result.Segments)
Console.WriteLine(segment.Text);
Remarks
Supported values:
"auto"to enable language auto-detection.-
Any language identifier returned by GetSupportedLanguages() for the loaded model
(typically ISO-639-1 codes such as
"en","fr","de","es").
Values are model-dependent; use GetSupportedLanguages() to query the exact list at runtime.
Exceptions
- ArgumentNullException
Thrown if
audioFileis null.- NotSupportedException
Thrown if the model does not support speech-to-text.