Audio formats

Codecs, sample rates, channels, chunk sizes and message limits for every Krisp API endpoint, in one table.

Every Krisp API endpoint sends and receives audio as binary WebSocket messages, after the client hello and the server's ready message. JSON messages travel as text messages on the same connection. This page collects the audio rules from the endpoint pages.

Input audio

EndpointCodecSample rateChannelsRecommended chunkSet in the client hello
/sttpcm_s16le (default) or opus16,000 Hz only1 (mono)80 ms, or a multiple of 80 msaudio_format, sample_rate, channels
/vtpcm_s16le (default) or opus16,000 Hz only1 (mono)20 ms (640 bytes at 16 kHz), the Voice Translation SDK defaultconfig.audio.format, config.audio.sample_rate, config.audio.channels
/voice-isolation16-bit PCM8,000 or 16,000 Hz (default 16,000)1 (mono)Exactly 30 ms per message (480 bytes at 8 kHz, 960 bytes at 16 kHz). Other sizes end the session with invalid_frame_duration.sample_rate
/ttsNo audio input: you send text as JSON messages.

pcm_s16le is raw PCM: signed 16-bit, little-endian samples with no WAV header. With opus, send one Opus packet per message.

Output audio

EndpointWhat comes back
/sttNo audio. Transcripts and turn events as JSON text messages.
/vtTranslated speech as binary messages, in the codec you set in config.audio.format, 16 kHz mono. Optional transcripts and translations as JSON text messages.
/voice-isolationCleaned audio as binary messages: 16-bit mono PCM at the same sample rate, one frame back for each frame you send.
/ttsSynthesized speech as binary messages, always 16-bit mono PCM at 24 kHz.

Limits

  • Message size: each message you send after the hello can be at most 65,536 bytes (64 KB). Larger messages get the chunk_too_large error (HTTP 413) and the connection is closed with code 1009.
  • Client hello: send it within 15 seconds of connecting. metadata in the hello can be at most 4 KB.
  • Pace: stream audio at real-time pace. For example, send an 80 ms chunk every 80 ms.

See the API overview for the full session protocol and the common error codes.

Chunk size in bytes

For 16-bit mono PCM, one millisecond of audio is sample_rate / 1000 × 2 bytes:

Sample rate20 ms30 ms80 ms
8,000 Hz320 bytes480 bytes1,280 bytes
16,000 Hz640 bytes960 bytes2,560 bytes

Convert a file

To convert any audio file to 16 kHz, mono, 16-bit PCM WAV with ffmpeg:

ffmpeg -i input.mp3 -ar 16000 -ac 1 -sample_fmt s16 output.wav

When you stream the WAV file, skip the header and send only the samples, for example with Python's wave.readframes(), as the examples on each endpoint page do.


Did this page help you?