feat: ship pre-generated TTS audio files for instant playback

71 static voice files (9.6MB) for round calls, intros, hype lines,
and challenge announces. These play instantly from file instead of
running Kokoro TTS generation in the browser. Dynamic content
(questions, answers, narrations) still uses Kokoro.

Includes Node.js generation script (scripts/generate-voice-files.mjs)
and modified tts.ts to check static file cache before worker generation.
Static audio works even before Kokoro model finishes loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 10:38:44 +00:00
co-authored by Claude Opus 4.6
parent 4c17379ad4
commit 52769ab43a
74 changed files with 371 additions and 33 deletions
+3 -4
View File
@@ -236,13 +236,12 @@ export function resetVoiceState() {
export function speak(text: string, profileName: string, cancelPrevious: boolean = false, _echo: boolean = false) {
if (getMasterMuted()) return
const sfxGain = getSfxGain()
// Try Kokoro TTS first — high quality, no browser bugs
if (isKokoroReady() && sfxGain) {
// Try Kokoro TTS first (also serves pre-generated static files from cache)
if (sfxGain) {
_cancelWebSpeech()
const profile = voiceProfiles[profileName] || voiceProfiles.announcer
if (cancelPrevious) kokoroStop()
kokoroSpeak(text, profileName, sfxGain, profile.volume * VOICE_VOLUME_SCALE)
return
if (kokoroSpeak(text, profileName, sfxGain, profile.volume * VOICE_VOLUME_SCALE)) return
}
// Fallback: Web Speech API (only used while Kokoro model is loading)
if (typeof speechSynthesis === 'undefined') return