feat(audio): choose a male or female local voice per language

The installer now fetches one male and one female Piper voice per language (Swedish
NST/Lisa, English Ryan/Lessac), with genders confirmed by measuring each voice's pitch
rather than guessed from the name. Settings -> Audio gets a voice selector per language
with its own Test button that always plays the Piper voice. Male is preselected for both.

The integration test now runs its server with an empty home directory, so voices
installed on the developer's own machine can't leak into it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
larssand
2026-09-27 20:29:59 +02:00
parent e8a2799a92
commit 196437d25b
17 changed files with 167 additions and 38 deletions

View File

@@ -213,7 +213,7 @@ app.get("/api/tts/status", (_req, res) => {
// POST (not GET) so generating audio falls under the admin PIN like every other write.
app.post("/api/tts/speech", async (req, res) => {
try {
const file = await tts.speech({ text: req.body?.text, language: req.body?.language, rate: req.body?.rate });
const file = await tts.speech({ text: req.body?.text, language: req.body?.language, rate: req.body?.rate, voice: req.body?.voice });
res.type("audio/wav").sendFile(file);
} catch (error) {
res.status(error.code === "unavailable" ? 503 : error.code === "bad_request" ? 400 : 500).json({ error: error.message });