Azure AI Speech To Text API
Use the Azure AI Speech
to Text API
The Azure AI Speech
service supports speech recognition through two REST APIs:
- The Speech to text API, which is the primary way to perform speech recognition.
- The Speech to text Short Audio API, which is optimized for short streams of audio (up to 60 seconds).
Depending on how long the
spoken input is expected to be, you can use either API for interactive voice
recognition. Additionally, you can batch transcribe several audio recordings to
text using the Speech to Text API.
Using the Azure AI Speech
SDK
There is a standard
procedure for utilizing the Speech to Text API, even though the specifics
differ based on the SDK being used (Python, C#, etc.) :
- Use a SpeechConfig object to encapsulate the information required to connect to your Azure AI Speech resource. Specifically, its location and key.
- Optionally, use an AudioConfig to define the input source for the audio to be transcribed. By default, this is the default system microphone, but you can also specify an audio file.
- Use the SpeechConfig and AudioConfig to create a SpeechRecognizer object. This object is a proxy client for the Speech to text API.
- Use the methods of the SpeechRecognizer object to call the underlying API functions. For example, the RecognizeOnceAsync() method uses the Azure AI Speech service to asynchronously transcribe a single spoken utterance.
- Process the response from the Azure AI Speech service. In the case of the RecognizeOnceAsync() method, the result is a SpeechRecognitionResult object that includes the properties like Duration,OffsetInTicks, Properties, Reason, ResultId, Text.
The transcription is
contained in the Text property, and the Reason property has the enumerated
value RecognizedSpeech if the procedure was successful.
Other possible values for
Result include NoMatch (indicating that the audio was
successfully parsed but no speech was recognized) or Canceled,
indicating that an error occurred (in which case, you can check the Properties
collection for the CancellationReason property to determine what went
wrong).
Conclusion
We have successfully
learnt about Azure AI speech to text API.
Comments
Post a Comment