PlayoutClock (src/audio-pacing.ts)

openclaw-voice-call-realtime · src/audio-pacing.ts · typescript · MIT
voice, Voice / Speech

Audio pacing and voice activity detection for Twilio calls, managing buffer lead and silent frame handling.

// Source: https://github.com/TristanBrotherton/openclaw-voice-call-realtime | License: MIT | Copyright 2026 OpenClaw Foundation (original voice-call plugin)
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Audio pacing and voice activity for phone calls.
 *
 * - PlayoutClock: how much audio Twilio has buffered ahead of real time. Twilio
 *   plays media frames in order at 8 kHz; everything sent ahead of the play
 *   position waits in its buffer (and is dropped by a `clear`).
 * - LiveOutputPacer: GPT-Live streams its voice at about real time (1.02-1.11x,
 *   frame gaps up to ~380 ms) and keeps streaming digital silence between
 *   replies. Forwarded as-is, Twilio's buffer would underrun mid-word on a gap
 *   and grow without bound over a long call. The pacer hol

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key