Streaming audio to OpenAI in your browser is cool… until you deal with PCM16.

The browser gives you Float32 audio. The API expects PCM16 at 24kHz.

That means:

Float32 → clamp → Int16 → base64 → send to realtime api

If you don’t handle the conversion properly, you’ll hear it right away — crackling, silence, or wrong pitch.

Wrote a quick guide on how to do it correctly: https://l.zfir.dev/6rbGCiN

#PCM16 #WebAudioAPI #OpenAI #OpenAIRealtime #JavaScript

PCM16 encoding for the OpenAI Realtime API — a practical guide

You’re streaming audio from the browser. The API expects PCM16. Here’s what the implementation actually looks like and the things worth knowing before you start. Press enter or click to view image in full size