Struggling with Azure Speech SDK streaming implementations for AI-102 exam? Discover the correct use of SpeechRecognizer and AudioStreamFormat with MP3 data inputs. Learn key patterns for handling real-time audio conversion and avoid common pitfalls in certification scenarios.
Table of Contents
Question
Xerigon Corporation is developing a speech to text solution that will use the Speech SDK to create a method that converts speech from streaming data in a streaming format.
The following code is part of the solution:
compressed_format = speechsdk.audio.A (compressed_stream_format=speechsdk.AudioStreamContainerFormat.MP3) callback = BinaryFileReaderCallback(filename=weatherfilenamemp3) stream = speechsdk.audio.PullAudioInputStream(stream_format=compressed_format, pull_stream_callback=callback) speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region) audio_config = speechsdk.audio.AudioConfig(stream=stream) speech_recognizer = speechsdk.B (speech_config, audio_config) result = speech_recognizer.recognize_once()
Drag the correct code to the appropriate letter.
Code:
- GetWaveFormatPCM
- AudioConfig
- AudioStreamFormat
- KeywordRecognizer
- SpeakerRecognizer
- SpeechRecognizer
Answer
A. AudioStreamFormat
B. SpeechRecognizer
Explanation
The following code uses the AudioStreamFormat method to define the audio format and the SpeechRecognizer method to convert spoken language into text.
compressed_format = speechsdk.audio.AudioStreamFormat(compressed_stream_format=speechsdk.AudioStreamContainerFormat.MP3)
callback = BinaryFileReaderCallback(filename=weatherfilenamemp3)
stream = speechsdk.audio.PullAudioInputStream(stream_format=compressed_format, pull_stream_callback=callback)
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
audio_config = speechsdk.audio.AudioConfig(stream=stream)
speech_recognizer = speechsdk.SpeechRecognizer(speech_config, audio_config)
result = speech_recognizer.recognize_once()
You would choose the AudioStreamFormat method. This method of the Speech SDK defines the audio format for input streams from audio configurations from streaming .mp3 or .mp4 files. You can configure the sample rate, bits per sample, and the number of channels.
The SpeechRecognizer method converts spoken language into text. This method provides speech recognition from a microphone, audio files, or audio streams.
The AudioConfig method defines the source of the audio which can be an audio file or a microphone. The audio file can be a .wav, .mp3, or any other media file. This method is not used for streaming data.
You would not choose the GetWaveFormatPCM method. This method in the Speech SDK creates an AudioStreamFormat object with specific Pulse Code Modulation (PCM) wave format characteristics as the sample rate, bits per sample, and the number of channels.
You would not choose the KeywordRecognizer method. This method recognizes certain keywords or phrases within an audio stream and provides voice activation.
You would not choose the SpeakerRecognizer method. This method identifies and verifies the speaker based on voice characteristics.
Microsoft Azure AI Engineer Associate AI-102 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Microsoft Azure AI Engineer Associate AI-102 exam and earn Microsoft Azure AI Engineer Associate AI-102 certification.