# Audio formats

> The audio formats and the binary frame layouts of the realtime connection.

Source: https://docs.voice.kheelona.com/reference/generated/audio/

Audio is PCM, 16-bit little-endian, mono. Pick the formats when you create the session; the `session.ready` event confirms them.

## Formats

| Value | Description |
| --- | --- |
| `pcm16_16k` | 16,000 Hz (the input default). |
| `pcm16_24k` | 24,000 Hz (the output default). |
| `pcm16_48k` | 48,000 Hz. |

Defaults: input `pcm16_16k`, output `pcm16_24k`. Set them with `audio.input_format` and `audio.output_format` in the request that creates the session.

## Binary frames

JSON events travel as WebSocket text frames. Audio travels as binary frames.

### Input audio (client to server)

PCM16 little-endian mono in the session's input format (default 16 kHz), 10–500 ms per frame, no header.

### Reply audio (server to client)

8-byte header (kind u8 = 0x01, flags u8: bit0 first frame of a sentence, bit1 last frame of the reply; sentence u16 LE; reply_seq u32 LE) followed by PCM16 LE samples in the output format (default 24 kHz). The last frame of a reply may carry no samples.
