Streaming Audio

Streaming Events Reference

Full reference for all 5 streaming events and the StreamingConfig parameter.


Event reference

EventModelKey Attributes
PARTIALStreamingPartialtext, language, segment_id, latency_ms
FINAL_SEGMENTStreamingFinalSegmenttext, language, segment_id, silence_duration_ms
FINALStreamingFinaltext, language, audio_duration_sec, inference_time_ms
DONEStreamingDonetotal_segments, total_audio_duration_sec
ERRORStreamingErrormessage, code

Registering handlers

python
@conn.on(StreamingMessageType.PARTIAL)
def on_partial(msg): print(f"Interim: {msg.text}")

@conn.on(StreamingMessageType.FINAL_SEGMENT)
def on_segment(msg): print(f"Segment: {msg.text}")

@conn.on(StreamingMessageType.DONE)
def on_done(msg): print(f"Done. {msg.total_segments} segments.")

StreamingConfig parameter reference

ParameterTypeDefaultDescription
languagestring"auto"Language code or "auto" for auto-detection.
sample_rateint16000Audio sample rate in Hz.
dtypestring"int16"Audio data type: "int16" or "float32".
chunk_size_secfloat1.0Processing window size in seconds.
silence_threshold_secfloat0.5Silence duration to trigger segment boundary.