Audio Format & Sending Audio - Sanas Developer Hub
Input requirements
| Property | Required value |
|---|---|
| Channels | Mono (1 channel) |
| Sample format | 32-bit float, normalised to −1.0 … +1.0 |
| Sample rate | 8 000, 16 000, or 48 000 Hz — must match AudioParams.sampleRate |
| Frame size | 20 ms recommended: 160 samples @ 8 kHz, 320 @ 16 kHz, 960 @ 48 kHz |
Real-time pacing
This is a live stream. Feed approximately one frame every 20 ms, as you would from a live microphone. Sending much faster than real time can overrun server-side buffers. In a live call scenario the microphone callback provides natural pacing; when replaying a file (as in the Quick Start), add a 20 ms sleep between frames.
PCM conversion
// int16 → float
float sample = pcm16 / 32768.0f;
// float → int16 (for writing WAV output)
int16_t pcm = (int16_t)(std::max(-1.0f, std::min(1.0f, sample)) * 32767.0f);