Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Build a lightweight application by using Azure Speech in Foundry Tools

A worked example

Yes or no

A developer is building a lightweight Python desktop application that reads incoming text messages aloud to the user. The application uses Azure Speech in Foundry Tools. The environment variables FOUNDRY_KEY and ENDPOINT hold the key and endpoint of the developer's Foundry resource. The exhibit shows an excerpt of the application code.

# Python
import os
import azure.cognitiveservices.speech as speechsdk

speech_config = speechsdk.SpeechConfig(subscription=os.environ.get('FOUNDRY_KEY'), endpoint=os.environ.get('ENDPOINT'))
audio_config = speechsdk.audio.AudioOutputConfig(use_default_speaker=True)
speech_config.speech_synthesis_voice_name='en-US-Ava:DragonHDLatestNeural'

speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
result = speech_synthesizer.speak_text_async(message_text).get()

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
StatementYesNo
The code plays the synthesized speech through the computer's default speaker.

The AudioOutputConfig is created with use_default_speaker=True. The text-to-speech API can send its audio output either to the speaker or to an audio file, and this setting chooses the speaker.

Correct
The speech_synthesis_voice_name setting specifies which voice speaks the messages.

A text-to-speech solution needs both the text and the voice that will say it. The code chooses the voice by setting speech_synthesis_voice_name on the speech configuration.

Correct
The application must include its own neural model to generate the audio on the local computer.

The SDK sends the text to Azure Speech, and the speech synthesis runs in the cloud, where neural voices produce the audio. The SDK takes care of authentication and the network calls, so the app needs no local model.

Correct
Why

The exhibit connects to Azure Speech with the Foundry key and endpoint, picks a voice through speech_synthesis_voice_name, and routes output to the default speaker. The SpeechSynthesizer sends the message text to Azure Speech, where neural voices create the audio in the cloud. The audio comes back to the app for playback, so the application does not need its own speech model.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free