Real-time Audio Streaming
Stream audio over WebSocket and receive live transcripts in English and African languages. Ideal for live events, calls, virtual meetings, and interactive voice applications.
How streaming works
The OrbitalsAI SDKs expose dedicated streaming modules for WebSocket-based real-time transcription:
- Python:
orbitalsai.streaming— async/sync clients, event handlers, audio conversion helpers. - JavaScript/TypeScript:
orbitalsai—StreamingClient, event callbacks, browser and Node.js support.
For batch transcription, see Python SDK or JavaScript SDK.
Installation
Python
Install the core SDK, then add optional extras depending on how you plan to stream:
Basic streaming (raw PCM):
With audio conversion & microphone helpers:
Dependencies
orbitalsai[audio] and orbitalsai[all] pull in optional packages such assounddevice, soundfile, and librosa.JavaScript / TypeScript
Runtime support
Async streaming from raw PCM (recommended)
Use AsyncStreamingClient for non-blocking streaming of raw PCM16 mono audio. This is the lowest-latency way to integrate real-time transcription.
PCM requirements
AudioConverter as shown below.Stream from audio files (MP3, WAV, M4A, FLAC, OGG)
Use AudioConverter to convert common audio formats into PCM16 and split them into appropriately sized chunks before streaming.
Stream from microphone
Combine AsyncStreamingClient with sounddevice to stream live audio from a microphone. This mirrors the streaming_microphone.py example from the SDK.
Local environment only
sounddevice is available.Streaming configuration
StreamingConfig controls audio, language, and connection behavior for each streaming session.
| Field | Type | Description |
|---|---|---|
sample_rate | int | Audio sample rate in Hz (between 8000 and 48000). |
chunk_size | int | Number of samples per chunk (at 16kHz, 8000 ≈ 500ms). |
language | str | Target transcription language (english, hausa, igbo, yoruba). |
max_retries | int | Maximum number of reconnection attempts after an unexpected disconnect. |
retry_delay | float | Initial delay (in seconds) between reconnection attempts (exponential backoff). |
connection_timeout | float | Timeout (in seconds) for establishing the WebSocket connection. |
interim_results | bool | Whether to receive partial (non-final) transcripts as the user speaks. |
auto_flush | bool | Whether the server should automatically flush on silence. |
Error handling for streaming
The streaming module raises rich exception types and exposes them to your handlers so you can respond to authentication issues, connection drops, or exhausted credits.
More details
JavaScript / TypeScript Streaming
The OrbitalsAI npm package provides StreamingClient for real-time transcription in Node.js and browsers. It connects over WebSocket and sends raw PCM16 mono audio.
Async streaming from raw PCM
Use StreamingClient to stream PCM16 mono little-endian audio and receive partial and final transcripts via event callbacks.
PCM requirements
librosa (Node.js) to convert your audio if needed.Stream from microphone (browser)
Capture microphone audio with the Web Audio API, convert to PCM16, and stream in real time. This example works in modern browsers.
Browser permissions
StreamingClient options
Pass configuration when creating a StreamingClient:
| Option | Type | Description |
|---|---|---|
apiKey | string | Your OrbitalsAI API key (required). |
sampleRate | number | Audio sample rate in Hz (default: 16000). |
language | string | Target language (english, hausa, igbo, yoruba). |
baseUrl | string | API base URL for custom endpoints. |
Error handling (JavaScript)
Listen for the error event and handle connection failures, authentication issues, or exhausted credits.
npm package
Streaming use cases
Call Center Transcription
Real-time transcription of customer service calls in African languages for quality assurance, training, and compliance.
Live Event Captioning
Provide live captions for conferences, webinars, and broadcasts in real-time, making content accessible to broader audiences.
Virtual Meeting Assistants
Create AI assistants that transcribe and summarize virtual meetings in real-time, capturing action items and key decisions.
Voice Assistants
Build voice-controlled applications with low-latency speech recognition for African language speakers.