API Guides
Live audio over the API
Choose Socket.IO or HTTP streaming to send live audio to HUMAIN Voice for realtime transcription or live diarization.
Both transports take the same 18-byte frame header and PCM16 little-endian, 16 kHz, mono audio, and return the same result fields. For a complete clip, use batch or fast transcription instead.
Socket.IO or HTTP streaming
| Socket.IO | HTTP streaming | |
|---|---|---|
| Connection | One WebSocket carries every stream. | One POST per frame to stt-stream or diarization-stream, one in flight per stream UUID. |
| Framing | 3,200 bytes (100 ms) per frame at real-time pace. | About 32,000 bytes (1 s) per POST; queue audio while a POST waits. |
| Results | transcription_result and diarization_result events on the sending connection, routed by id. | NDJSON in each POST response, so updates arrive only on open responses (about once per 1 s frame). The last response stays open until is_final: true. |
| Text and speakers together | Diarization tee: set bit 2 on every audio_stream frame. | No tee. Run stt-stream and diarization-stream on the same audio and align by time. |
| Limits | A stream that stops sending audio ends with ASR_STREAM_EXPIRED. | HTTP sessions and ASR have separate timeouts; see Timeouts. |
| SDK | JavaScript and Python; SDK 0.18.1 doesn't expose the tee. | None. |
| Pick it when | You use an SDK or need the tee. | Your runtime can't keep a WebSocket open. |
Frame layouts and flag values: Socket.IO frames and HTTP frames.
Session lifecycle
- Start. Create a fresh UUID and set the start bit on the first frame. With HTTP, the first
POSTopens the session (HTTP streaming). - Send. Send frames in order as audio arrives, and apply each result as the current state for
its
id(Streaming results). - End. Set the final bit on the last audio frame, then keep reading until
is_final: trueor your deadline (Realtime transcription). With the tee, wait for both finals. - Recover. A
SESSION_BYTE_RATE_EXCEEDEDthrottle keeps the session alive on either transport: wait, then resend the same frame. Any other failure, disconnect, or abortedPOSTends the stream: keep committed results, drop provisional ones, and start a new stream with a new UUID (Retrying safely, Socket.IO disconnects).
Session limits and server timeouts: transcription limits, diarization limits, and Timeouts.