Speech to Text - Streaming
Stream real-time audio transcription with our SDKs. This guide covers how to implement live audio streaming for immediate speech-to-text conversion in your applications.
Prerequisites
Before you begin, make sure you have:
- An aiOla API key (get one here)
- Python 3.10+ (for Python SDK) or Node.js 18+ (for TypeScript SDK)
- Microphone access (for live audio streaming)
Installation
Step 1: Set up authentication
First, generate an access token and create your client:
For comprehensive authentication details, security considerations, and token management strategies, see our Authentication Guide.
Step 2: Initialize streaming connection
Create a streaming connection with event handlers:
Step 3: Start streaming with microphone
Start the streaming connection and pipe microphone audio:
Custom audio sources
For custom audio sources instead of microphone:
Advanced streaming options
Keyword detection
Enable keyword detection during streaming:
Multiple language support
Stream with different languages:
Error handling
Implement robust error handling for streaming:
Complete working example
Here’s a complete Python example that combines all steps:
Best practices
- Audio Quality: Use 16kHz sample rate, mono channel for optimal results
- Chunk Size: 4096 bytes is recommended for real-time performance
- Error Handling: Always implement reconnection logic for production use
- Resource Cleanup: Properly disconnect streaming connections when done
- Audio Input: Handle audio input sources and permissions appropriately
- Latency: Consider buffering strategies for smoother transcription
Supported audio formats
For streaming, the following formats work best:
- PCM 16-bit (recommended)
- WAV uncompressed
- Raw audio at 16kHz sample rate
Next steps
Now that you’ve implemented streaming transcription, you can:
- Explore Speech to Text SDK for file-based transcription
- Learn about Text to Speech for speech synthesis
- Check out the SDK repositories for more examples:
Browser Examples
For web applications, check out our complete browser microphone streaming example:
- Browser Microphone Streaming - Full web app example showing real-time microphone transcription in the browser