feat: add streaming-tts-karaoke demo - #31
Open
luke-speechify wants to merge 1 commit into
Open
Conversation
Realtime streaming TTS on POST /v1/audio/stream/with-timestamps (SSE): each word highlights the instant its audio + timestamp arrive over the wire, then a second highlight follows playback via the MediaSource API. A one-route Node proxy pipes the SSE through so the API key stays server-side. Hosted under /streaming-tts-karaoke, Turnstile-gated, with a real-API Playwright e2e.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pairs with the upcoming speechify.ai post "Realtime streaming TTS with word highlighting" (the pivot of the agent-events ticket — see below).
What this demo is
Realtime streaming TTS with dual word highlighting, built on
POST /v1/audio/stream/with-timestamps(Server-Sent Events,simba-3.2):speech_marksarrive over the stream (marks race ahead of audio). Shows the wire speed.app/api/stream/route.ts, Node) proxies the SSE straight through, key held server-side.app/page.tsx) parsesspeech.chunkevents, maps each word mark to the rendered text by character offset, streams the base64 audio into<audio>via the MediaSource API, and follows playback withrequestAnimationFrame.live-captions(that's the batch/v1/audio/speechendpoint + playback-only highlight); this is the streaming endpoint + arrival-vs-playback dual highlight.Why this replaces the agent-events demo
The original DRG-381 was a changelog about a "realtime agent events" stream. I couldn't find any evidence that feature/endpoint exists (no SSE/WS for live agent calls; the conversations API only exposes status/timing). Rather than write about something unverifiable, this pivots to a real, verified capability — streaming TTS with word timestamps — which is a stronger demo anyway. Closing #25 (agent-events-inspector) in favour of this.
Hosting + abuse protection
/streaming-tts-karaoke(vercel.json+pnpm-workspace.yaml),basePathset, README/manifest regenerated viapnpm generate./api/streamwith the shared Cloudflare Turnstile helper (app/lib/turnstile.ts, verbatim), fail-open whenTURNSTILE_SECRET_KEYis unset.Verification
pnpm --filter streaming-tts-karaoke build✅pnpm e2e✅ — real-API Playwright test: drives the live SSE endpoint, asserts word marks arrive and highlight (.w.received), and the audio element gets a streamed source.Blog post is written separately.