feat(audio): add offline local neural voice via Piper (sv + en)

Announcements can use Piper, a free local neural TTS, instead of the browser's system
voice. No account, no paid service, and it keeps working with no internet at the track.

- npm run tts:install (or Settings -> Audio -> Install) downloads the standalone Piper
  release for Linux/Windows/macOS plus Swedish and English voices into piper/ once
- server/tts.js generates each line once, one at a time, and caches it as WAV under
  data/tts/; a new line takes ~0.3 s with the standalone build
- src/piper_speech.js plays it and falls back to the browser voice if Piper is missing,
  errors, or takes over 2.5 s, so no announcement is lost and timing is never held up
- "Pre-generate phrases and driver names" renders every fixed phrase and name in both
  languages before race day

Browser voice stays the default. Generation routes fall under the admin PIN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
larssand
2026-09-27 19:28:15 +02:00
parent 9016ce02e4
commit e8a2799a92
25 changed files with 776 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "rc-racecore",
"version": "1.22.0",
"version": "1.23.0",
"private": true,
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
"engines": {
@@ -21,6 +21,7 @@
"update": "node scripts/serverctl.js update",
"verify": "node scripts/verify-install.js",
"backup:restore": "node scripts/restore-backup.js",
"tts:install": "node scripts/install-piper.js",
"audit:prod": "npm audit --omit=dev",
"test": "node --experimental-default-type=module tests/run.js",
"test:browser": "node --experimental-default-type=module tests/browser_smoke.js",