Microsoft Azure speech to text doesn't recognize .wav audio when generated by PC microphone

Martin Chapman 0 Reputation points
2023-07-16T11:32:52.76+00:00

I am trying to use Azure speech to text as part of a larger app. When I input a .wav audio file generated by Azure text to speech, or I input a .wav file downloaded from the internet, my Azure speech to text script works. However, when I use a .wav file recorded from my PC microphone the script never returns. The files are all in the same folder and I never get an invalid path error, except when I deliberately use a nonexistent file.

When I call transcribe_speech("./uploads/downloaded_from_azure_synthesis.wav") I get the correct output printed to the terminal. However when I call transcribe_speech("./uploads/recorded_from_pc.wav") I get no output. Furthermore the last statement printed is "in promise". "In speech recognizer" is never printed, indicating the script never gets past speechRecognizer.recognized... and stalls forever.

My PC is a Lenovo Yoga running Windows 11

Script posted to paste bin because interface here isn't working.

https://pastebin.com/PQMRU69a

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,904 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.