createSpeechEndpoint (lib/speech-endpoint.ts)

collie · web/src/lib/speech-endpoint.ts · typescript · MIT
voice

WHEN HAS THE SPEAKER FINISHED? A pure detector, no DOM, no clock of its own (voice takeover). Fed one loudness reading per animation frame (`next(rms, nowMs)`), it answers three questions: is there speech right now, has there been any at all, and how long has it been quiet since.

// Source: https://github.com/AltanS/collie | License: MIT | Copyright 2026 Altan Sarisin
// Provided via justclaw.it.com; keep this notice with the code.
// WHEN HAS THE SPEAKER FINISHED? A pure detector, no DOM, no clock of its own (voice takeover).
//
// Fed one loudness reading per animation frame (`next(rms, nowMs)`), it answers three questions: is
// there speech right now, has there been any at all, and how long has it been quiet since. The
// takeover (components/voice-takeover.tsx) draws the answer as a ring closing round the OK button and
// calls the recorder's own stop-and-transcribe when it runs out.
//
// THE ONE RULE THAT MATTERS: THE COUNTDOWN STARTS ONLY AFTER SPEECH WAS HEARD. A phone held up in a
// quiet room and a phone held up before the first word look the same to a 

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

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

Get a free API key