mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:01:08 +02:00
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:
parent
aff2db9f9c
commit
0f234a0ce6
2 changed files with 5 additions and 5 deletions
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export class TtsService {
|
|||
text,
|
||||
voice,
|
||||
speed,
|
||||
output_format: 'mp3',
|
||||
output_format: 'wav',
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue