Prompt
How do I add real-time speech-to-text to my app?
Latest observation
Oct 11, 2026
OpenAI APIWeb search: off
To add real-time speech-to-text, you generally need these pieces:
-
Audio capture in your app
- Web:
getUserMedia+MediaRecorder/ Web Audio API - Mobile: platform mic APIs
- Desktop: native audio input libraries
- Web:
-
A streaming STT engine
- Cloud APIs: Google Speech-to-Text, Azure Speech, AWS Transcribe, Deepgram, AssemblyAI, OpenAI-compatible audio transcription services
- On-device options: Whisper variants, Vosk, etc. for offline/low-latency local processing
-
A transport layer for live audio
- Usually WebSocket or gRPC streaming
- Send small audio chunks continuously instead of waiting for a full recording
-
Partial and final transcript handling
- Real-time STT usually returns:
- interim/partial results while the user is still speaking
- final results once the phrase ends
- Update the UI incrementally for a “live typing” feel
- Real-time STT usually returns:
-
Noise/latency tuning
- Use the right sample rate/format expected by the STT provider
- Prefer mono PCM or Opus depending on provider support
- Add silence detection / VAD (voice activity detection) if needed
Common architecture
Browser/App
→ capture mic audio
→ chunk audio every 100–500 ms
→ stream to backend over WebSocket
→ backend forwards to STT provider
→ provider returns partial/final text
→ backend streams transcripts back to client
→ UI updates live
If you’re building a web app
Frontend
- Request mic permission
- Capture audio
- Convert to provider-supported format if necessary
- Send audio chunks over WebSocket
Backend
- Authenticate the user
- Maintain a streaming STT session
- Relay audio chunks to the provider
- Relay transcript events back to client
Example implementation paths
Fastest path
Use a managed provider with streaming support:
- Deepgram: simple streaming WebSocket API
- Azure Speech: robust enterprise option
- Google STT: strong accuracy
- AWS Transcribe: good AWS integration
Lowest-cost / offline path
- Run Whisper locally on your server or device
- For true streaming, add chunking + partial decoding
- May have more latency than dedicated streaming APIs
Things to watch out for
- Latency: smaller chunks reduce delay but increase overhead
- Format compatibility: many APIs require specific encoding/sample rates
- Interruptions: network hiccups need reconnect logic
- Privacy/compliance: audio is sensitive data
- Speaker diarization: if you need multiple speakers, choose a provider that supports it
A practical recommendation
If you want the simplest real-time setup:
- Web app: capture mic audio → send via WebSocket → Deepgram/Azure/Google streaming STT
- Show partial transcripts as they arrive
- Store final transcript segments only
If you want, I can give you:
- a sample architecture for your stack (React, iOS, Android, Node, Python, etc.), or
- a minimal working code example for real-time speech-to-text.