Skip to content

Commit

Permalink
[Avatar] Update real time avatar sample code to support multi-lingual (
Browse files Browse the repository at this point in the history
…#2174)

* [TalkingAvatar] Add sample code for TTS talking avatar real-time API

* sample codes for batch avatar synthesis

* Address repository check failure

* update

* [Avatar] Update real time avatar sample code to support multi-lingual

---------

Co-authored-by: Yulin Li <[email protected]>
  • Loading branch information
yinhew and Yulin Li authored Dec 11, 2023
1 parent 2e39515 commit 45285a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion samples/js/browser/avatar/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2 style="background-color: white; width: 300px;">ICE Server</h2>

<h2 style="background-color: white; width: 300px;">TTS Configuration</h2>
<label style="font-size: medium;" for="ttsVoice">TTS Voice:</label>
<input id="ttsVoice" type="text" size="32" style="font-size: medium;" value="en-US-JennyNeural"></input><br />
<input id="ttsVoice" type="text" size="32" style="font-size: medium;" value="en-US-JennyMultilingualV2Neural"></input><br />
<label style="font-size: medium;" for="customVoiceEndpointId">Custom Voice Deployment ID (Endpoint ID):</label>
<input id="customVoiceEndpointId" type="text" size="32" style="font-size: medium;" value=""></input><br />
<br />
Expand Down
6 changes: 3 additions & 3 deletions samples/js/browser/avatar/chat.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ <h2 style="background-color: white; width: 150px;">ICE Server</h2>
<br />

<h2 style="background-color: white; width: 300px;">STT / TTS Configuration</h2>
<label style="font-size: medium;" for="sttLocale">STT Locale:</label>
<input id="sttLocale" type="text" size="32" style="font-size: medium;" value="en-US"></input><br />
<label style="font-size: medium;" for="sttLocale">STT Locale(s):</label>
<input id="sttLocales" type="text" size="64" style="font-size: medium;" value="en-US,de-DE,es-ES,fr-FR,it-IT,ja-JP,ko-KR,zh-CN"></input><br />
<label style="font-size: medium;" for="ttsVoice">TTS Voice:</label>
<input id="ttsVoice" type="text" size="32" style="font-size: medium;" value="en-US-JennyNeural"></input><br />
<input id="ttsVoice" type="text" size="32" style="font-size: medium;" value="en-US-JennyMultilingualV2Neural"></input><br />
<label style="font-size: medium;" for="customVoiceEndpointId">Custom Voice Deployment ID (Endpoint ID):</label>
<input id="customVoiceEndpointId" type="text" size="32" style="font-size: medium;" value=""></input><br />
<br />
Expand Down
8 changes: 5 additions & 3 deletions samples/js/browser/avatar/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,11 @@ window.startSession = () => {
console.log("Event received: " + e.description + offsetMessage)
}

const speechRecognitionConfig = SpeechSDK.SpeechConfig.fromSubscription(cogSvcSubKey, cogSvcRegion)
speechRecognitionConfig.speechRecognitionLanguage = document.getElementById('sttLocale').value
speechRecognizer = new SpeechSDK.SpeechRecognizer(speechRecognitionConfig, SpeechSDK.AudioConfig.fromDefaultMicrophoneInput())
const speechRecognitionConfig = SpeechSDK.SpeechConfig.fromEndpoint(new URL(`wss://${cogSvcRegion}.stt.speech.microsoft.com/speech/universal/v2`), cogSvcSubKey)
speechRecognitionConfig.setProperty(SpeechSDK.PropertyId.SpeechServiceConnection_LanguageIdMode, "Continuous")
var sttLocales = document.getElementById('sttLocales').value.split(',')
var autoDetectSourceLanguageConfig = SpeechSDK.AutoDetectSourceLanguageConfig.fromLanguages(sttLocales)
speechRecognizer = SpeechSDK.SpeechRecognizer.FromConfig(speechRecognitionConfig, autoDetectSourceLanguageConfig, SpeechSDK.AudioConfig.fromDefaultMicrophoneInput())

const azureOpenAIEndpoint = document.getElementById('azureOpenAIEndpoint').value
const azureOpenAIApiKey = document.getElementById('azureOpenAIApiKey').value
Expand Down

0 comments on commit 45285a9

Please sign in to comment.