Synthesize Translations
Introduction
The TranslationRecognizer
provides transcriptions of spoken input that have been translated, effectively
converting spoken language into text. Additionally, you can produce the
translation as speech, enabling speech-to-speech translation options. There are
two methods available to achieve this.
Event-based Synthesis
When you aim to conduct a
1:1 translation (translating from one source language directly into a single
target language), you can utilize event-driven synthesis to capture the
translation as an audio stream. To accomplish this, you must indicate the
preferred voice for the translated speech in the TranslationConfig. Develop an
event handler for the Synthesizing event of the TranslationRecognizer object.
Within the event handler, employ the GetAudio() method from the Result
parameter to obtain the byte stream of the translated audio.
The exact code for
creating an event handler differs depending on the programming language you are
using.
Manual Synthesis
Manual synthesis offers a
different method to event-based synthesis, eliminating the need for creating an
event handler. This technique allows you to produce audio translations for one
or multiple target languages.
Manual synthesis of
translations is essentially just the combination of two separate operations in
which you:
- Use a TranslationRecognizer to translate spoken input into text transcriptions in one or more target languages.
- Iterate through the Translations dictionary in the result of the translation operation, using a SpeechSynthesizer to synthesize an audio stream for each language.
Conclusion
We have successfully
learnt about synthesizing translations.
Comments
Post a Comment