2
votes

I'd like to convert audio file to text data by using Azure Speech to Text. Anyone knows good tutorial for that? I could find a tutorial below: https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstart-python

But the sample's audio source is from microphone not audio file.

Thanks.

1
You could have a look this official docs and currently audio to text not available. - Md Farid Uddin Kiron
I didn't know that. Thank you :) - Hiro
You are welcome, feel free to ask any more help. - Md Farid Uddin Kiron

1 Answers

-1
votes

There is an offical audio sample named whatstheweatherlike.wav which you can get from samples/csharp/sharedcontent/console/whatstheweatherlike.wav of the GitHub Repo Azure-Samples/cognitive-services-speech-sdk.

And here is my sample code I wrote and partial refered to the offical tutorial Quickstart: Recognize speech with the Speech SDK for Python. I installed the current version 1.6.0 of Azure Cognitive Services SDK for Speech via pip install azure-cognitiveservices-speech.

import azure.cognitiveservices.speech as speechsdk

speech_key, service_region = "<your api key>", "<your region>"
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)

audio_config = speechsdk.audio.AudioConfig(filename='whatstheweatherlike.wav')
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)
result = speech_recognizer.recognize_once()
print(result.text)

The text recognized from the audio sample file is as below.

What's the weather like?

Hope it helps.