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:
13
scripts/install-piper.js
Normal file
13
scripts/install-piper.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// Installs local neural voices for race announcements: the standalone Piper release for
|
||||
// this OS plus Swedish and English voices, into piper/. Run once with internet access:
|
||||
// npm run tts:install
|
||||
const path = require("path");
|
||||
const { resolvePiperBinary } = require("../server/tts");
|
||||
const { installAll } = require("../server/tts_install");
|
||||
|
||||
const projectDir = path.join(__dirname, "..");
|
||||
installAll({ projectDir, hasBinary: Boolean(resolvePiperBinary(process.env.RC_PIPER_BIN || "", projectDir)), log: (line) => console.log(line) })
|
||||
.catch((error) => {
|
||||
console.error(`Piper install failed: ${error.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user