SpeakableStream (tts/speakable.ts)

oh-my-pi · packages/coding-agent/src/tts/speakable.ts · typescript · MIT
voice

* Streaming markdown → speakable-segment transform for assistant speech. Sits between the assistant's raw streaming text deltas and the TTS engine, deciding both *what* is worth speaking and *when* a piece of text is ready to synthesize. Three passes: 1. Block pass (per character

// Source: https://github.com/can1357/oh-my-pi | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Streaming markdown → speakable-segment transform for assistant speech.
 *
 * Sits between the assistant's raw streaming text deltas and the TTS engine,
 * deciding both *what* is worth speaking and *when* a piece of text is ready
 * to synthesize. Three passes:
 *
 * 1. Block pass (per character, stateful): drops fenced code blocks and table
 *    rows, strips heading/bullet/blockquote markers (numbered-list markers are
 *    spoken as "1, …"), and turns newlines into hard segment breaks.
 * 2. Segmentation (stateful): emits a segment the moment a sentence boundary
 *    appears — no next-sentence confirmation, which is what ma

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

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

Get a free API key