Skip to main content

Whisper Language Detector Node

Identifies the spoken language of a segment of audio with a multilingual Whisper model. It runs only Whisper's encoder and a single decoder step, so a detection is faster than a transcription and needs no transcript. Pair it with a VAD node: connect the VAD's speechEnded event to the detect action and every utterance is identified.

Number of inputs1
Number of outputs0

Configuration​

modelPath​

Type: String

Default: ""

Path of a multilingual ggml model such as ggml-small.bin; @system/ and @user/ asset aliases are resolved. Empty loads the Whisper extension's multilingualModelPath. The bundled English-only models (.en) are refused: whisper.cpp would run detection on them and report a random language.

useGPU​

Type: Bool

Default: true

Run the model on the GPU where one is available.

minimumDurationMs​

Type: Int

Default: 500

Segments shorter than this are ignored. A fragment of a word yields a random, low-confidence language, which a VAD can produce when it splits an utterance.


Properties​

Inherits properties from its parent, SingleBusAudioSinkNode.


Actions​

Inherits actions from its parent, SingleBusAudioSinkNode.

detect​

Detects the language of a segment of the received audio and emits languageDetected. The node keeps the last 30 seconds of audio at 16 kHz.

Parameters​

NameTypeDescription
startIntStart sample of the segment (16 kHz, absolute). Optional: omit together with end.
endIntEnd sample of the segment (16 kHz, absolute). Optional: omit together with start.

Without parameters the segment is everything received since the previous detect call. The parameters match the speechEnded event of the Silero VAD node, so the two can be connected directly.

Return Value​

None. Returns an error when no model is loaded.

loadModel​

Loads a multilingual ggml Whisper model, replacing the current one. Emits modelLoaded or modelLoadFailed.

Parameters​

NameTypeDescription
modelPathStringPath of the model; @system/ and @user/ aliases are resolved.
useGPUBoolWhether to use GPU acceleration. Optional, default true.

Return Value​

None. Returns an error when the model cannot be loaded or is English-only.


Events​

Inherits events from its parent, SingleBusAudioSinkNode.

languageDetected​

Emitted when the language of a segment has been identified.

Data​

NameTypeDescription
languageStringISO 639-1 code of the most likely language, e.g. "es".
languageNameStringEnglish name of that language, e.g. "spanish".
confidenceFloatProbability of the reported language, 0 to 1.
processingTimeIntTime taken for detection in milliseconds.

modelLoaded​

Emitted when a model is loaded successfully.

NameTypeDescription
modelPathStringPath of the loaded model.

modelLoadFailed​

Emitted when loading a model fails.

NameTypeDescription
modelPathStringPath of the model that failed.
errorStringFailure reason.