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

@@ -16,9 +16,14 @@ const PIPER_ARCHIVES = {
"darwin-arm64": "piper_macos_aarch64.tar.gz",
};
const VOICE_BASE = "https://huggingface.co/rhasspy/piper-voices/resolve/main";
// One male and one female voice per language. Genders were checked by measuring each
// voice's median pitch (nst 81 Hz, ryan 152 Hz; lisa 184 Hz, lessac 208 Hz), not assumed
// from the name. `default` is the voice used until someone picks another in Settings.
const VOICES = [
{ name: "sv_SE-nst-medium", path: "sv/sv_SE/nst/medium" },
{ name: "en_US-lessac-medium", path: "en/en_US/lessac/medium" },
{ name: "sv_SE-nst-medium", path: "sv/sv_SE/nst/medium", language: "sv", gender: "male", label: "NST", default: true },
{ name: "sv_SE-lisa-medium", path: "sv/sv_SE/lisa/medium", language: "sv", gender: "female", label: "Lisa" },
{ name: "en_US-ryan-medium", path: "en/en_US/ryan/medium", language: "en", gender: "male", label: "Ryan", default: true },
{ name: "en_US-lessac-medium", path: "en/en_US/lessac/medium", language: "en", gender: "female", label: "Lessac" },
];
async function download(url, target) {