Back to docsRecipe

Recipe: Realtime audio translate

Stream microphone input through Meridian's realtime translation pipeline. Capture audio, chunk into frames, and receive translated text with sub-second latency.

Endpoint

POST /v1/realtime/translate

Request

WebSocket upgrade with JSON control frames and binary audio chunks.

{
  "source_lang": "en",
  "target_lang": "es",
  "model": "meridian-rt-v1",
  "sample_rate": 16000
}

Response stream

Partial translations arrive as JSON frames while audio is still streaming.

{
  "type": "partial",
  "text": "Hola, ¿cómo",
  "confidence": 0.94,
  "timestamp_ms": 1420
}

Quick start

  1. Open a WebSocket to the endpoint with your API key header.
  2. Send a control frame specifying source and target languages.
  3. Stream raw PCM16 audio chunks at 16 kHz.
  4. Read JSON frames for realtime partial translations.
  5. Send a close frame to terminate the session.