fix sound
This commit is contained in:
parent
8c0f88bb5a
commit
c8651f3af0
|
@ -499,7 +499,7 @@ export default {
|
||||||
id: this.messageId++,
|
id: this.messageId++,
|
||||||
type,
|
type,
|
||||||
text,
|
text,
|
||||||
audio: audio ? `data:audio/mp3;base64,${audio}` : null,
|
audio: audio ? `data:audio/wav;base64,${audio}` : null,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
showTranslation: false,
|
showTranslation: false,
|
||||||
loadingTranslation: false,
|
loadingTranslation: false,
|
||||||
|
|
|
@ -500,7 +500,7 @@ export default {
|
||||||
id: this.messageId++,
|
id: this.messageId++,
|
||||||
type,
|
type,
|
||||||
text,
|
text,
|
||||||
audio: audio ? `data:audio/mp3;base64,${audio}` : null,
|
audio: audio ? `data:audio/wav;base64,${audio}` : null,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
// Translation properties for AI messages
|
// Translation properties for AI messages
|
||||||
showTranslation: false,
|
showTranslation: false,
|
||||||
|
|
|
@ -108,8 +108,9 @@ class TextToSpeechService:
|
||||||
)
|
)
|
||||||
|
|
||||||
audio_config_params = {
|
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"],
|
"speaking_rate": config_set["speaking_rate"],
|
||||||
|
"sample_rate_hertz": 24000, # Required for LINEAR16
|
||||||
# Remove effects profile for faster generation
|
# Remove effects profile for faster generation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +354,7 @@ class BaseConversationFlowService:
|
||||||
"type": "ai_response",
|
"type": "ai_response",
|
||||||
"text": greeting,
|
"text": greeting,
|
||||||
"audio": audio_base64,
|
"audio": audio_base64,
|
||||||
"audio_format": "mp3",
|
"audio_format": "wav",
|
||||||
"character": personality_name,
|
"character": personality_name,
|
||||||
"is_initial_greeting": True
|
"is_initial_greeting": True
|
||||||
}
|
}
|
||||||
|
@ -395,7 +396,7 @@ class BaseConversationFlowService:
|
||||||
"type": "ai_response",
|
"type": "ai_response",
|
||||||
"text": ai_response,
|
"text": ai_response,
|
||||||
"audio": audio_base64,
|
"audio": audio_base64,
|
||||||
"audio_format": "mp3",
|
"audio_format": "wav",
|
||||||
"character": personality_name,
|
"character": personality_name,
|
||||||
"goal_status": goal_status,
|
"goal_status": goal_status,
|
||||||
"conversation_complete": goal_status.get("all_completed", False)
|
"conversation_complete": goal_status.get("all_completed", False)
|
||||||
|
@ -427,7 +428,7 @@ class BaseConversationFlowService:
|
||||||
"type": "ai_response",
|
"type": "ai_response",
|
||||||
"text": ai_response,
|
"text": ai_response,
|
||||||
"audio": audio_base64,
|
"audio": audio_base64,
|
||||||
"audio_format": "mp3",
|
"audio_format": "wav",
|
||||||
"character": personality_name,
|
"character": personality_name,
|
||||||
"goal_status": goal_status,
|
"goal_status": goal_status,
|
||||||
"conversation_complete": goal_status.get("all_completed", False)
|
"conversation_complete": goal_status.get("all_completed", False)
|
||||||
|
|
Loading…
Reference in New Issue