StreamingOptions

data class StreamingOptions(val transcription: TranscriptionOptions = TranscriptionOptions.DEFAULT, val vad: VadConfig = VadConfig(), val partialStepMs: Int = 300, val carryPromptTokens: Boolean = true, val maxPromptTokens: Int = DEFAULT_MAX_PROMPT_TOKENS, val bufferMs: Int)(source)

Options of WhisperEngine.transcribeStream.

The stream is segmented into speech turns by an energy VadConfig gate (pure silence never reaches the model; turns end after VadConfig.trailingSilenceMs of silence or are split at VadConfig.maxTurnMs<= 30 s, Whisper's encoder window). Each finished turn is decoded once into locked com.donfuldauer.kggml.core.TranscriptionEvent.CommittedSegments; while a turn is still in progress, its audio so far is re-decoded every partialStepMs of new audio into an unstable com.donfuldauer.kggml.core.TranscriptionEvent.PartialHypothesis.

Constructors

Link copied to clipboard
constructor(transcription: TranscriptionOptions = TranscriptionOptions.DEFAULT, vad: VadConfig = VadConfig(), partialStepMs: Int = 300, carryPromptTokens: Boolean = true, maxPromptTokens: Int = DEFAULT_MAX_PROMPT_TOKENS, bufferMs: Int)

Types

Link copied to clipboard
object Companion

Constants and factory functions of StreamingOptions.

Properties

Link copied to clipboard

capacity of the ring buffer between the audio producer and the decoder, in ms of 16 kHz audio. When it is full, collection of the audio flow is suspended (back-pressure) until the decoder catches up, so audio is never dropped and timestamps stay exact.

Link copied to clipboard

condition each decode on the text tokens of the previously committed segments (whisper_full_params.prompt_tokens), across pauses and across 30 s turn splits.

Link copied to clipboard

upper bound of carried-over tokens (the newest are kept); further capped by the model's own budget (n_text_ctx / 2 - 1, 223 for released Whisper models).

Link copied to clipboard

audio (in ms of new turn audio) between two partial decodes of the turn in progress; 0 disables partial hypotheses. Partial decodes are conflated: if the engine is still busy when the next step is due, the backlog is skipped and only the newest audio is decoded. The default of 300 ms keeps partial latency below ~400 ms on hardware that decodes a turn within ~100 ms.

Link copied to clipboard

decoding options for every decode of the stream. TranscriptionOptions.noContext is ignored: a stream always decodes with no_context and supplies its history explicitly as prompt tokens (see carryPromptTokens). TranscriptionOptions.initialPrompt conditions decodes until the first committed text exists; from then on the carried-over tokens replace it (upstream whisper.cpp semantics).

Link copied to clipboard

voice-activity gate and turn segmentation.