Stream TTS audio to caller in real-time chunks

TTS audio was sent as a single huge WebSocket frame that overflowed the
browser's 3s ring buffer. Now streams in 60ms chunks at real-time rate.
Also increased browser ring buffer from 3s to 10s as safety net.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 16:56:22 -07:00
parent 97d37f3381
commit d4e25ceb88
4 changed files with 37 additions and 6 deletions

View File

@@ -150,6 +150,6 @@
</div>
</div>
<script src="/js/call-in.js?v=4"></script>
<script src="/js/call-in.js?v=5"></script>
</body>
</html>

View File

@@ -78,7 +78,7 @@ registerProcessor('caller-processor', CallerProcessor);
class PlaybackProcessor extends AudioWorkletProcessor {
constructor() {
super();
this.ringSize = 16000 * 3; // 3s ring buffer at 16kHz
this.ringSize = 16000 * 10; // 10s ring buffer at 16kHz
this.ring = new Float32Array(this.ringSize);
this.writePos = 0;
this.readPos = 0;