Discussions

Ask a Question
Back to All

Define speaking accent (i.e. locale) when creating a streaming avatar discussion

Hello, by default the streaming avatars have a Canadian accent when speaking in French and I would like to ensure they have an accent from France for my french users.

I understood I need to use the 'locale' parameter of Voice Setting. However, I haven't been successful in changing it. Could you please let me know what's wrong with my code ? Thanks again !

NB: I store important parameters in window.AVATAR_CONFIG

// Build voice settings dynamically  
const voiceSettings = {  
  rate: 1.5,  
  emotion: VoiceEmotion.EXCITED,  
  elevenlabsSettings: {}  
 };
// Conditionally add locale
if (window.AVATAR_CONFIG.language === 'fr') {
  voiceSettings.locale = 'fr-FR';
}
console.log('Voice settings:', voiceSettings);
// create the avatar
  const sessionInfo = await streamingAvatar.createStartAvatar({
      quality: AvatarQuality.Low,
      avatarName: window.AVATAR_CONFIG.avatar_id,
      knowledgeId: window.AVATAR_CONFIG.knoweledgeBaseId, 
      sttSettings: {
        provider: STTProvider.DEEPGRAM, // STT provider to use. The default is DEEPGRAM.
        confidence: 0.55, // The default is 0.55.
      },
      language: window.AVATAR_CONFIG.language,
      voice: voiceSettings
    });