diff --git a/apps/german-app/src/components/GermanSpeechInterface.vue b/apps/german-app/src/components/GermanSpeechInterface.vue index c3812b3..fc5e1fb 100644 --- a/apps/german-app/src/components/GermanSpeechInterface.vue +++ b/apps/german-app/src/components/GermanSpeechInterface.vue @@ -499,7 +499,7 @@ export default { id: this.messageId++, type, text, - audio: audio ? `data:audio/mp3;base64,${audio}` : null, + audio: audio ? `data:audio/wav;base64,${audio}` : null, timestamp: new Date(), showTranslation: false, loadingTranslation: false, diff --git a/apps/indonesian-app/src/components/SpeechInterface.vue b/apps/indonesian-app/src/components/SpeechInterface.vue index c894cfb..5594efe 100644 --- a/apps/indonesian-app/src/components/SpeechInterface.vue +++ b/apps/indonesian-app/src/components/SpeechInterface.vue @@ -500,7 +500,7 @@ export default { id: this.messageId++, type, text, - audio: audio ? `data:audio/mp3;base64,${audio}` : null, + audio: audio ? `data:audio/wav;base64,${audio}` : null, timestamp: new Date(), // Translation properties for AI messages showTranslation: false, diff --git a/backend/core/speech_service.py b/backend/core/speech_service.py index 1f65818..e9b6821 100644 --- a/backend/core/speech_service.py +++ b/backend/core/speech_service.py @@ -108,8 +108,9 @@ class TextToSpeechService: ) audio_config_params = { - "audio_encoding": texttospeech.AudioEncoding.MP3, # MP3 for faster processing + "audio_encoding": texttospeech.AudioEncoding.LINEAR16, # WAV for better browser compatibility "speaking_rate": config_set["speaking_rate"], + "sample_rate_hertz": 24000, # Required for LINEAR16 # Remove effects profile for faster generation } @@ -353,7 +354,7 @@ class BaseConversationFlowService: "type": "ai_response", "text": greeting, "audio": audio_base64, - "audio_format": "mp3", + "audio_format": "wav", "character": personality_name, "is_initial_greeting": True } @@ -395,7 +396,7 @@ class BaseConversationFlowService: "type": "ai_response", "text": ai_response, "audio": audio_base64, - "audio_format": "mp3", + "audio_format": "wav", "character": personality_name, "goal_status": goal_status, "conversation_complete": goal_status.get("all_completed", False) @@ -427,7 +428,7 @@ class BaseConversationFlowService: "type": "ai_response", "text": ai_response, "audio": audio_base64, - "audio_format": "mp3", + "audio_format": "wav", "character": personality_name, "goal_status": goal_status, "conversation_complete": goal_status.get("all_completed", False)