fix(matrix-tts-bot): use WAV format for better Matrix compatibility

MP3 format was causing "no supported sources" error in Element.
Switch to WAV which has broader browser/client support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-02-14 11:09:56 +01:00
parent aff2db9f9c
commit 0f234a0ce6
2 changed files with 5 additions and 5 deletions

View file

@ -338,8 +338,8 @@ export class MatrixService extends BaseMatrixService {
// Stop typing indicator
await this.client.setTyping(roomId, false);
// Upload audio to Matrix (MP3 for better browser compatibility)
const mxcUrl = await this.client.uploadContent(audioBuffer, 'audio/mpeg', 'speech.mp3');
// Upload audio to Matrix (WAV for better compatibility)
const mxcUrl = await this.client.uploadContent(audioBuffer, 'audio/wav', 'speech.wav');
// Calculate approximate duration (rough estimate based on text length and speed)
const estimatedDuration = Math.round(((text.length / 15) * 1000) / settings.speed);
@ -347,10 +347,10 @@ export class MatrixService extends BaseMatrixService {
// Send audio message
await this.client.sendMessage(roomId, {
msgtype: 'm.audio',
body: 'speech.mp3',
body: 'speech.wav',
url: mxcUrl,
info: {
mimetype: 'audio/mpeg',
mimetype: 'audio/wav',
size: audioBuffer.length,
duration: estimatedDuration,
},

View file

@ -46,7 +46,7 @@ export class TtsService {
text,
voice,
speed,
output_format: 'mp3',
output_format: 'wav',
}),
});