Streaming Audio
Streaming Events Reference
Full reference for all 5 streaming events and the StreamingConfig parameter.
Event reference
| Event | Model | Key Attributes |
|---|---|---|
PARTIAL | StreamingPartial | text, language, segment_id, latency_ms |
FINAL_SEGMENT | StreamingFinalSegment | text, language, segment_id, silence_duration_ms |
FINAL | StreamingFinal | text, language, audio_duration_sec, inference_time_ms |
DONE | StreamingDone | total_segments, total_audio_duration_sec |
ERROR | StreamingError | message, 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
| Parameter | Type | Default | Description |
|---|---|---|---|
language | string | "auto" | Language code or "auto" for auto-detection. |
sample_rate | int | 16000 | Audio sample rate in Hz. |
dtype | string | "int16" | Audio data type: "int16" or "float32". |
chunk_size_sec | float | 1.0 | Processing window size in seconds. |
silence_threshold_sec | float | 0.5 | Silence duration to trigger segment boundary. |