steep-balloon-41261
09/09/2025, 9:38 AMtall-airline-16756
09/09/2025, 9:38 AMtall-airline-16756
09/09/2025, 9:38 AMNewPCMLocalTrack API in the Go SDK, setting the sample rate to 48000 Hz and using a mono channel.
2. Write PCM16 Samples: If needed, convert your WebSocket PCM data to PCM16 format, then write it to the track using WriteSample.
3. Handle WebSocket Data: Make sure your PCM data is in pcm_s16le format (that’s 16-bit signed little-endian) and sampled at 48kHz. If your data is base64 encoded, don’t forget to decode it first.
4. Close the Track: When your audio stream ends, simply call Close() on the track to wrap things up properly.
If you’d like, I’m here to provide detailed code examples or help you with a specific SDK—just let me know! I’m happy to support you every step of the way.
Sources: livekit-plugins/livekit-plugins-gladia/livekit/plugins/gladia/stt.py | examples/openai_realtime_voice/realtime_api_handler.go