Divooka Reference

Speech Models

5 nodes

On this page 5

Load Speech Recognizer

Function

Loads a speech recognizer, its feature extractor and its tokenizer from a Hub repository or a folder.

Signature
LoadSpeechRecognizer -> Speech Recognizer
    model: Text
    device: Compute Device
    precision: Precision
    backend: Model Backend
SpeechRecognizer LoadSpeechRecognizer(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    ModelBackend backend = ModelBackend.TorchSharp)

Parameters

nametypedefaultdescription
modelText—A repository id such as openai/whisper-tiny or facebook/wav2vec2-base-960h, or for the ONNX backend onnx-community/whisper-tiny (onnx-community/whisper-tiny_timestamped for word times) or Xenova/wav2vec2-base-960h; or a folder.
deviceCompute DeviceAutoWhere it runs on TorchSharp.
precisionPrecisionAutoThe number format of its weights on TorchSharp.
backendModel BackendTorch sharpWhat runs it: TorchSharp, or the ONNX backend on the CPU, which reads the repository's ONNX files or builds a graph from its checkpoint.

Returns

RecognizerSpeech Recognizer
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Speech Models
Package
Machine Learning

Transcribe

Function

What is said in a clip, as text.

Signature
Transcribe -> Text
    recognizer: Speech Recognizer
    audio: WAVAudioPayload
    language: Text
    settings: Transcription Settings
string Transcribe(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    TranscriptionSettings settings)

Parameters

nametypedefaultdescription
recognizerSpeech Recognizer—A speech recognizer.
audioWAVAudioPayload—The clip, at the recognizer's sample rate (16000 Hz for Whisper); Resample converts one that is not. Stereo is mixed to mono.
languageText—For Whisper, the language spoken, such as en or english; empty to let it tell.
settingsTranscription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

Returns

TextText
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Speech Models
Package
Machine Learning

Transcribe File

Function

What is said in a WAV file, as text.

Signature
TranscribeFile -> Text
    recognizer: Speech Recognizer
    path: Text
    language: Text
    settings: Transcription Settings
string TranscribeFile(
    SpeechRecognizer recognizer,
    string path,
    string language,
    TranscriptionSettings settings)

Parameters

nametypedefaultdescription
recognizerSpeech Recognizer—A speech recognizer.
pathText—A WAV file at the recognizer's sample rate.
languageText—For Whisper, the language spoken; empty to let it tell.
settingsTranscription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

Returns

TextText
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Speech Models
Package
Machine Learning

Transcribe With Times

Function

What is said in a clip, in the segments the recognizer heard, with when each starts and ends.

Signature
TranscribeWithTimes -> (Segments: Text Array, starts: Number Array, ends: Number Array)
    recognizer: Speech Recognizer
    audio: WAVAudioPayload
    language: Text
    settings: Transcription Settings
string[] TranscribeWithTimes(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    out double[] starts,
    out double[] ends,
    TranscriptionSettings settings)

Parameters

nametypedefaultdescription
recognizerSpeech Recognizer—A speech recognizer.
audioWAVAudioPayload—The clip, at the recognizer's sample rate.
languageText—For Whisper, the language spoken; empty to let it tell.
settingsTranscription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

Returns

SegmentsText Array
startsNumber Array
endsNumber Array
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Speech Models
Package
Machine Learning

Transcribe Words

Function

What is said in a clip, word by word, with when each word starts and ends: for subtitles that follow the voice, or to find where a word was said.

Signature
TranscribeWords -> (Words: Text Array, starts: Number Array, ends: Number Array)
    recognizer: Speech Recognizer
    audio: WAVAudioPayload
    language: Text
    settings: Transcription Settings
string[] TranscribeWords(
    SpeechRecognizer recognizer,
    WAVAudioPayload audio,
    string language,
    TranscriptionSettings settings,
    out double[] starts,
    out double[] ends)

Parameters

nametypedefaultdescription
recognizerSpeech Recognizer—A speech recognizer. Whisper on the ONNX backend needs files with cross-attention outputs, such as onnx-community/whisper-tiny_timestamped.
audioWAVAudioPayload—The clip, at the recognizer's sample rate.
languageText—For Whisper, the language spoken; empty to let it tell.
settingsTranscription Settings—For Whisper, a prompt and temperature fallback, from Make Transcription Settings.

Returns

WordsText Array
startsNumber Array
endsNumber Array
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Speech Models
Package
Machine Learning