public class SpeechRecognizer implements AutoClosable
Resident speech-to-text engine, implemented in Klyn/C++ without an external inference library or process. Supports Whisper HF Safetensors and Qwen3-ASR Safetensors/paired GGUF checkpoints; formats never substitute one architecture for another. Projections and encoder attention use CPU/NVIDIA; DSP and decoder attention use synchronized CPU storage. Auto chooses GPU when available; an explicit GPU never silently falls back. NPU is not available yet. Single owner: finish/close its stream before other recognition calls.
try speech = SpeechRecognizer.load("openai/whisper-base"): print(speech.transcribe(AudioClip.load(FilePath("recording.wav")), language="fr").text)
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | devicedevice as Device |
Concrete execution device. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | SpeechRecognizerSpeechRecognizer(notnull folder as FolderPath, notnull device as Device = Device.auto, verbose as Boolean = false) |
Opens a local HF snapshot with config/tokenizer/generation_config and Safetensors shards. |
| public | SpeechRecognizerSpeechRecognizer(notnull path as FilePath, notnull projector as FilePath, notnull device as Device = Device.auto, verbose as Boolean = false) |
Opens a GGUF speech decoder with its matching audio projector. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | closeclose() as Void |
Cancels/joins active recognition before releasing model storage. |
| public static | loadload(notnull repository as String, quantization as ModelQuantization = ModelQuantization.AUTO, notnull device as Device = Device.auto, revision as String = "main", offline as Boolean = false, verbose as Boolean = false, token as String = "", format as ModelFormat = ModelFormat.AUTO) as SpeechRecognizer |
Downloads a verified GGUF pair or original Safetensors checkpoint. |
| public | streamstream(notnull microphone as Microphone, notnull language as String = "auto", minimumSpeechLevel as Double = 0.0003, partialResults as Boolean = true) as TranscriptionStream |
Starts one bounded, cancellable live transcription worker. |
| public | transcribetranscribe(notnull audio as AudioClip, notnull language as String = "auto") as Transcription |
Transcribes finite PCM, downmixing/resampling to mono 16 kHz. |
| public | transcribetranscribe(notnull path as FilePath, notnull language as String = "auto") as Transcription |
Transcribes a WAV file without playback. |