Implement text analysis solutions 4.2 Implement speech solutions
A conference app recognizes English speech with the Speech SDK and must play the…
Study guide skill: Translate speech into other languages by using language models and Foundry Tools
Question B7-014
A conference app recognizes English speech with the Speech SDK and must play the translation as speech in German, French, and Italian at the same time. Which approach follows the speech translation guidance?
Select one answer.
Answer: A
Event-based synthesis through the Synthesizing event works only with a single target language, and its voice should match that language. For multiple languages, you use manual synthesis: go through the translations dictionary and synthesize each translation with a SpeechSynthesizer whose voice name you set. One recognizer can return many translations, since each add_target_language call adds another target.
Deep dive
How it works
Speech translation with the Speech SDK can return many target languages from one recognizer. Each add_target_language call adds another target, and the result holds all translations in a dictionary: the key is the target language, and the value is the translated text.
Turning those translations into audio has two paths, and the number of languages decides which one:
- Event-based synthesis: set voice_name and handle the TranslationRecognizer's Synthesizing event. It works only with a single translation. Don't add multiple target languages, and the voice should be in the target language (for example "de" with de-DE-Hedda).
- Manual synthesis: loop through the translations dictionary and synthesize each entry with a SpeechSynthesizer whose speech_synthesis_voice_name is set to a voice in that language.
German, French and Italian at once means manual synthesis:
- Add de, fr and it as targets on one TranslationRecognizer.
- On each recognized result, iterate result.translations.
- Synthesize each text with a synthesizer configured for, say, a German, French or Italian neural voice, and play the streams.
The other options, and when you'd use them
- One English voice for all three: For event-based synthesis, the voice should be the same language as the target. In manual synthesis you set a matching voice for each language.
- A recognizer per language: Not needed. With every add_target_language call, a new target is added, and every target comes back in the same result.
- Three targets, one voice_name, Synthesizing event: Event-based synthesis works only with a single translation. Don't add multiple targets.
Exam tip
Speech-to-speech for several languages = one recognizer with several add_target_language calls + manual synthesis per dictionary entry. The Synthesizing event = one target only.
References
Last reviewed: