Latency Best Practices

PreviousNext

Audio chunk size, encoding, region selection.

For the full latency model, see Understanding Latency. This page focuses on what you can change in production.

Audio

  • Send small, evenly sized chunks. Chunk size trades latency against request overhead; start around 20–100 ms of audio and measure.
  • Use a low-overhead format. Raw PCM (16 kHz, mono) avoids an encode/decode step; use a compressed format only when bandwidth is the binding constraint.
  • Keep the pipeline stable. Sample rate and channel count should not change mid-session.

Connection

  • Reuse one WebSocket per session rather than reconnecting per utterance.
  • Avoid long client-side buffering before sending — buffering adds directly to perceived latency.
  • Render completed segments as they arrive, ordered by utterance_index. The current Lanson Live API Realtime endpoint does not emit partial-text revisions; show listening/processing indicators before completion instead of inventing a partial transcript.

Placement

  • Choose the endpoint / region closest to your audio source to reduce transport time.

Measure what the user sees

  • Time to first readable text
  • Time to stable text
  • Correction frequency / visible reflow