Skip to content

Commit 804f197

Browse files
Fix audio_transcribe example and link to Azure Speech docs
1 parent fed05fe commit 804f197

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Speech recognition engine/API support:
2929
* Google Speech Recognition
3030
* `Google Cloud Speech API <https://cloud.google.com/speech/>`__
3131
* `Wit.ai <https://wit.ai/>`__
32+
* `Microsoft Azure Speech <https://azure.microsoft.com/en-us/services/cognitive-services/speech/>`__
3233
* `Microsoft Bing Voice Recognition (Deprecated) <https://www.microsoft.com/cognitive-services/en-us/speech-api>`__
33-
* `Microsoft Azure Speech <https://www.microsoft.com/cognitive-services/en-us/speech-api>`__
3434
* `Houndify API <https://houndify.com/>`__
3535
* `IBM Speech to Text <http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/speech-to-text.html>`__
3636
* `Snowboy Hotword Detection <https://snowboy.kitt.ai/>`__ (works offline)

examples/audio_transcribe.py

+9
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
except sr.RequestError as e:
5151
print("Could not request results from Wit.ai service; {0}".format(e))
5252

53+
# recognize speech using Microsoft Azure Speech
54+
AZURE_SPEECH_KEY = "INSERT AZURE SPEECH API KEY HERE" # Microsoft Speech API keys 32-character lowercase hexadecimal strings
55+
try:
56+
print("Microsoft Azure Speech thinks you said " + r.recognize_azure(audio, key=AZURE_SPEECH_KEY))
57+
except sr.UnknownValueError:
58+
print("Microsoft Azure Speech could not understand audio")
59+
except sr.RequestError as e:
60+
print("Could not request results from Microsoft Azure Speech service; {0}".format(e))
61+
5362
# recognize speech using Microsoft Bing Voice Recognition
5463
BING_KEY = "INSERT BING API KEY HERE" # Microsoft Bing Voice Recognition API keys 32-character lowercase hexadecimal strings
5564
try:

0 commit comments

Comments
 (0)