mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 00:41:09 +02:00
fix(matrix-tts-bot): use /synthesize/auto endpoint for German voices
The /synthesize/piper endpoint doesn't exist - use /synthesize/auto which automatically routes to the correct TTS backend based on voice. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2521a1ea73
commit
67f3d3020a
1 changed files with 5 additions and 8 deletions
|
|
@ -182,23 +182,20 @@ export class TtsService {
|
|||
}
|
||||
|
||||
/**
|
||||
* Synthesize using Piper (German voices)
|
||||
* Synthesize using auto endpoint (German voices via Piper/Edge)
|
||||
*/
|
||||
private async synthesizeGerman(
|
||||
text: string,
|
||||
voice: string = DEFAULT_GERMAN_VOICE,
|
||||
speed: number = 1.0
|
||||
): Promise<Buffer> {
|
||||
const url = `${this.ttsUrl}/synthesize/piper`;
|
||||
const url = `${this.ttsUrl}/synthesize/auto`;
|
||||
|
||||
// Map voice to valid German voice
|
||||
const germanVoice = GERMAN_VOICES[voice] || DEFAULT_GERMAN_VOICE;
|
||||
|
||||
// Piper uses length_scale (inverse of speed)
|
||||
const lengthScale = 1.0 / speed;
|
||||
|
||||
this.logger.debug(
|
||||
`Piper synthesizing: "${text.substring(0, 50)}..." with voice=${germanVoice}, lengthScale=${lengthScale}`
|
||||
`German synthesizing: "${text.substring(0, 50)}..." with voice=${germanVoice}, speed=${speed}`
|
||||
);
|
||||
|
||||
const headers: Record<string, string> = { 'Content-Type': 'application/json' };
|
||||
|
|
@ -212,14 +209,14 @@ export class TtsService {
|
|||
body: JSON.stringify({
|
||||
text,
|
||||
voice: germanVoice,
|
||||
length_scale: lengthScale,
|
||||
speed,
|
||||
output_format: 'wav',
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
this.logger.error(`Piper TTS failed: ${response.status} - ${errorText}`);
|
||||
this.logger.error(`German TTS failed: ${response.status} - ${errorText}`);
|
||||
throw new Error(`TTS synthesis failed: ${response.status}`);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue