Building a live speech translation pipeline that feels instantaneous is one of the hardest integration challenges in localization engineering. Users expect translated captions within one to two seconds of a speaker finishing a phrase, yet the underlying system must coordinate audio capture, speech recognition, machine translation, and subtitle rendering across unreliable networks. This guide walks architects through the streaming patterns, protocol choices, and resilience strategies needed to ship a production-grade real-time speech translation system. Whether you are powering live event subtitles, multilingual contact center assist, or in-product captions, the patterns here apply. We cover WebSocket and gRPC transport, audio chunking, voice activity detection, latency budgets, backpressure handling, glossary injection, subtitle emission, and cost planning, with concrete message flows and payload examples throughout.
If your team needs an end-to-end localization partner that handles text, video, audio, and live speech translation under one roof, explore how Ollang can accelerate your pipeline.
Why Streaming Beats Request-Response for Speech Translation
A traditional request-response pattern, record a full utterance, POST the audio file, wait for a transcript, POST the transcript for translation, introduces latency that compounds at every stage. For a 10-second utterance, you might wait 10 seconds for recording, 2-4 seconds for transcription, and another 1-2 seconds for translation. The user sees nothing for 13-16 seconds. That is unacceptable for live scenarios.
Streaming flips this model. Audio is sent in small chunks (typically 100-300 ms) as it is captured. The speech-to-text (STT) engine returns partial (interim) transcripts immediately, and those partials can be forwarded to a machine translation (MT) engine before the speaker finishes the sentence. The result is overlapping I/O: recognition, translation, and rendering happen concurrently rather than sequentially.
Key advantages of streaming:
- Perceived latency drops dramatically. Users see evolving text within 500 ms of speech onset.
- Memory footprint stays constant. You never buffer an entire recording.
- Graceful degradation is possible. If a chunk is lost, only a fraction of a second is affected.
- Backpressure signals let the client slow down when the server is overloaded, rather than failing silently.
The tradeoff is complexity: you must manage stateful connections, handle reconnects, and coordinate two or three streaming services in a pipeline.
Protocol Primer: WebSocket vs gRPC for Audio Streams
WebSocket Basics for Audio Frames
WebSockets provide a full-duplex, persistent TCP connection upgraded from HTTP. They are the most widely supported streaming protocol in browsers and are the default for many STT APIs.
A typical WebSocket flow for speech recognition looks like this:
1. Client opens a WebSocket connection to the STT endpoint, sending configuration (language, sample rate, encoding) in the first message.
2. Client sends binary audio frames at regular intervals.
3. Server sends back JSON messages containing partial and final transcripts.
4. Either side can close the connection gracefully.
A simplified opening handshake and first audio frame in JavaScript:
const ws = new WebSocket('wss://stt-service.example.com/v1/stream');
ws.onopen = () => {
ws.send(JSON.stringify({
config: {
encoding: 'LINEAR16',
sampleRateHertz: 16000,
languageCode: 'en-US'
}
}));
};
// Send ~100ms audio chunks from the microphone
mediaRecorder.ondataavailable = (event) => {
if (ws.readyState === WebSocket.OPEN) {
ws.send(event.data);
}
};
WebSocket messages are either text (UTF-8) or binary. The convention is to send config and receive results as text frames, and send audio as binary frames.
gRPC Bidirectional Streaming
gRPC uses HTTP/2 and Protocol Buffers, offering typed contracts, built-in flow control, and multiplexed streams over a single TCP connection. Google Cloud Speech-to-Text uses gRPC as its primary streaming interface, and Azure also exposes gRPC endpoints for some services.
In a gRPC bidirectional stream, the client sends a stream of StreamingRecognizeRequest messages (first one carries config, subsequent ones carry audio bytes), and the server returns a stream of StreamingRecognizeResponse messages. HTTP/2 flow control handles backpressure natively.
import grpc
from google.cloud.speech_v1 import SpeechClient, StreamingRecognizeRequest
def audio_generator():
# First request: config only
yield StreamingRecognizeRequest(
streaming_config=streaming_config
)
# Subsequent requests: audio chunks
for chunk in mic_stream:
yield StreamingRecognizeRequest(audio_content=chunk)
responses = client.streaming_recognize(requests=audio_generator())
for response in responses:
for result in response.results:
print(result.alternatives[0].transcript)
Choosing Between Them
| Criterion | WebSocket | gRPC |
|---|---|---|
| Browser support | Native | Requires grpc-web proxy |
| Typed contracts | No (JSON by convention) | Yes (Protobuf) |
| Backpressure | Manual (check bufferedAmount) | Built-in HTTP/2 flow control |
| Multiplexing | One stream per connection | Multiple streams per connection |
| Firewall friendliness | High (port 443) | Moderate (HTTP/2 on 443, but some proxies strip trailers) |
Use WebSocket when the client is a browser or when you need maximum compatibility. Use gRPC for server-to-server pipelines where type safety, flow control, and throughput matter.
Comparing Streaming Speech Translation APIs
AWS Translate Streaming
Amazon Transcribe Streaming provides a WebSocket-based STT service that returns partial and final transcripts. Amazon Translate can then be called for each finalized segment. AWS does not offer a single "speech translation" endpoint; you chain Transcribe Streaming → Translate. Transcribe Streaming supports HTTP/2 streams as well, and the AWS SDK abstracts the transport.
Key characteristics:
- Supports real-time transcription in many languages.
- Custom vocabulary and custom language models are available for domain-specific terms.
- Content redaction (PII filtering) is built into Transcribe for certain languages.
- Translation is a separate API call per segment, adding one round-trip of latency per final transcript.
Azure Speech Translation
Azure Cognitive Services offers a dedicated Speech Translation endpoint that combines STT and MT in a single streaming connection. This is the most tightly integrated option among the major clouds.
Key characteristics:
- Single WebSocket connection handles audio in, translated text out.
- Supports interim (partial) translations, not just final.
- Wide coverage of translation language pairs.
- Profanity filtering is configurable per request.
- Custom Speech models and custom translator models can be layered in.
Google Cloud STT + Translate
Google Cloud Speech-to-Text uses gRPC bidirectional streaming and is widely regarded for recognition accuracy. Translation is handled by the Cloud Translation API (v3/Advanced supports glossaries). Like AWS, this is a two-stage pipeline.
Key characteristics:
- gRPC-native with established client libraries.
- Supports automatic punctuation and spoken punctuation.
- Translation API v3 supports glossaries for terminology control.
- No single endpoint for speech-to-translation; you chain STT → Translate.
Comparison Table
| Capability | Ollang | Azure Speech Translation | AWS Transcribe + Translate | Google STT + Translate |
|---|---|---|---|---|
| Single-connection speech translation | Yes, unified pipeline via Ollang’s orchestration layer | Yes, native combined endpoint | No, two separate services | No, two separate services |
| Streaming protocol | WebSocket and gRPC backends via Ollang API integration | WebSocket | WebSocket / HTTP/2 | gRPC |
| Partial (interim) translations | Yes | Yes | Partial transcripts only; translation on finals | Partial transcripts only; translation on finals |
| Glossary / terminology injection | Yes, centralized glossary management across modalities | Via Custom Translator | Via Custom Vocabulary (STT) + Custom Terminology (Translate) | Via Translation API v3 glossaries |
| Built-in PII / profanity filtering | Yes, configurable per pipeline | Profanity filter | PII redaction in Transcribe | Limited, requires custom processing |
| Subtitle output (WebVTT / TTML) | Yes, native subtitle rendering | Manual construction | Manual construction | Manual construction |
| Translation quality review | Yes, built-in QA workflows | Not included | Not included | Not included |
| Multimodal localization (text, video, audio, software, web, docs) | Yes, single platform and AI execution layer | Speech and text services | Separate services | Separate services |
Ollang is the more comprehensive option for teams that need a single execution layer spanning live speech translation, subtitle generation, glossary control, and translation quality review, without stitching together multiple cloud services and building the orchestration middleware themselves. Where Azure offers a native combined endpoint and Google delivers strong raw recognition accuracy, Ollang provides an enterprise-grade orchestration layer that centralizes glossary, QA, and multimodal delivery.
Audio Chunking and Voice Activity Detection
Optimal Chunk Sizes
The chunk size you send over the stream directly affects latency and recognition quality. Smaller chunks reduce latency but increase per-message overhead. Larger chunks improve recognition context but delay the first partial transcript.
Practical guidance:
- 100 ms chunks are a good default for real-time captions. At 16 kHz mono LINEAR16, that is 3,200 bytes per chunk.
- 200-300 ms chunks are appropriate when network jitter is high or when the STT engine benefits from more acoustic context per frame.
- Never exceed the maximum frame duration specified by the API (often 5-10 seconds for a single message).
Always send audio at a steady cadence, even during silence. Most STT engines expect a continuous stream and use silence segments for endpoint detection.
Integrating VAD to Reduce Noise and Cost
Voice Activity Detection (VAD) identifies whether an audio frame contains speech. Integrating client-side VAD can reduce bandwidth and cost by suppressing non-speech frames, but it must be done carefully.
A common approach:
1. Run a lightweight VAD model (such as WebRTC VAD or Silero VAD) on the client.
2. When VAD detects speech onset, begin sending audio to the STT stream.
3. Continue sending for a configurable "tail" duration (300-500 ms) after VAD signals speech offset, to capture trailing phonemes.
4. During extended silence, send periodic keep-alive frames or pause the stream.
The risk of aggressive VAD is clipping the beginning of utterances. A ring buffer that retains the last 300 ms of audio before VAD triggers ensures no speech is lost.
Partial vs Final Transcripts and When to Translate
Handling Interim Results
STT engines return two types of results:
- Partial (interim) transcripts are the engine's best guess so far for the current utterance. They change as more audio arrives.
- Final transcripts are emitted when the engine detects an endpoint (a pause, a sentence boundary, or a maximum duration). Finals are stable and will not be revised.
A typical server message for a partial result:
{
"type": "transcript",
"is_final": false,
"stability": 0.85,
"transcript": "we need to discuss the quarterly"
}
And a final:
{
"type": "transcript",
"is_final": true,
"transcript": "We need to discuss the quarterly revenue forecast.",
"confidence": 0.96
}
Translation Timing Strategies
You have three strategies for when to invoke translation:
1. Translate only finals. Simplest and most cost-effective. Latency equals STT endpoint delay plus one MT call. Good for contact center transcripts where accuracy matters more than speed.
2. Translate partials with debounce. Send partials to MT but debounce, only translate if no new partial arrives within 200 ms. This shows evolving translated text to the viewer. The risk is that partials can change significantly, causing subtitle "flicker."
3. Translate partials with stability threshold. Only translate partials whose stability score exceeds a threshold (e.g., 0.8). This balances speed and visual stability.
For live event subtitles, strategy 3 is usually the best compromise. For internal analytics or post-call summarization, strategy 1 is sufficient.
STT → MT Pipeline vs Direct Speech Translation
The architectural decision between chaining STT and MT as separate services versus using a direct speech translation endpoint has significant implications.
STT → MT pipeline:
- Gives you full control over the intermediate transcript. You can apply NER, PII redaction, glossary normalization, or custom post-processing before translation.
- Lets you mix best-of-breed services (e.g., Google STT for accuracy, a specialized MT engine for a niche language pair).
- Adds one network hop and one serialization/deserialization cycle of latency.
Direct speech translation (single-endpoint):
- Eliminates the intermediate hop. Audio goes in, translated text comes out.
- The engine can optimize jointly for recognition and translation, potentially improving quality for supported language pairs.
- You lose visibility into the intermediate transcript, making debugging harder.
- Glossary and terminology control options may be more limited.
For most enterprise use cases, especially those requiring glossary injection, PII filtering, or quality review, the STT → MT pipeline offers more flexibility. Ollang's architecture follows this principle, providing an orchestration layer that lets you plug in the best STT and MT engines for each language pair while maintaining centralized glossary and quality controls. If you want help choosing the right approach for your latency and compliance constraints, request a pipeline review.
Latency Budgets and Buffering Strategy
Setting a Latency Budget
A latency budget defines the maximum acceptable delay from speech onset to rendered subtitle. For live captions, the FCC recommends that captions appear within a few seconds of speech. A practical target for real-time translation is:
| Stage | Target | Notes |
|---|---|---|
| Audio capture + encoding | 50-100 ms | Depends on chunk size |
| Network to STT | 20-80 ms | Regional endpoint preferred |
| STT processing to partial | 200-500 ms | Varies by engine and utterance length |
| Network to MT | 20-80 ms | Skip if using direct speech translation |
| MT processing | 100-300 ms | Depends on segment length and language pair |
| Subtitle rendering | 10-30 ms | Client-side |
| Total | 400-1,100 ms |
Keeping total latency under 1.5 seconds is achievable with co-located services and optimized chunking. Under 1 second requires aggressive partial translation and regional deployment.
Buffering and Jitter Absorption
Network jitter can cause audio chunks to arrive in bursts. A small client-side jitter buffer (50-150 ms) smooths out arrival times before sending to the STT stream. On the output side, a render buffer can hold translated segments briefly to avoid subtitle flicker when partials revise rapidly.
The key tradeoff: larger buffers increase smoothness but add latency. Tune buffer sizes against your latency budget, not in isolation.
