0

I've been trying to start a project involving azure speech to text and for testing purpose wanted to corroborate the workings with the demo code found in this site:

https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-speech-to-text?tabs=windowsinstall%2Cterminal&pivots=programming-language-python.

Installed all the prerequisites from Microsoft redistributables to pip install azure-cognitiveservices-speech.

I've set my default microphone.

Got my subscription key and region from azure cognitive service via azure portal> all resources> speech resource> keys and endpoint

But im unable to start the demo since it throws error 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND)

The traceback is

Traceback (most recent call last):
  File "c:\Users\user\Desktop\Azure test\test.py", line 26, in <module>
    recognize_from_microphone()
  File "c:\Users\user\Desktop\Azure test\test.py", line 10, in recognize_from_microphone
    speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config)
  File "C:\Users\user\Desktop\Azure test\.env\lib\site-packages\azure\cognitiveservices\speech\speech.py", line 808, in __init__
    self._impl = self._get_impl(impl.SpeechRecognizer, speech_config, audio_config, language, source_language_config, auto_detect_source_language_config)
  File "C:\Users\user\Desktop\Azure test\.env\lib\site-packages\azure\cognitiveservices\speech\speech.py", line 870, in _get_impl
    return reco_type._from_config(speech_config._impl)
RuntimeError: Exception with an error code: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND)

The call stack goes as follow

[CALL STACK BEGIN]
    > pal_string_to_wstring
    - pal_string_to_wstring
    - audio_config_get_audio_processing_options
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
    - pal_string_to_wstring
[CALL STACK END]

Just in case it matter I'm using Windows 11 and Python 3.9.12 acquired from microsoft store.

I would post the code but it's a literal copy of the one found in the html only with the subscription key which found in said place.

Edit:

I was able to run the same example using javascript but node.js only supports from audio file to text which is not what I'm looking for.

Also azure speech to text does work with microphone using js but using the browser with means client side but optimally this isn't what I'm looking for. Just pointing this out as proof all resource from azure are configured correctly and maybe this is something related to python or pip package manager but like i said all the dll files mentioned in other topics are in the virtual environment so it "shouldn't" be an issue

If someone could help me since I'm at loss here.

SaltyCode
  • 67
  • 1
  • 2
  • 11

2 Answers2

2

Please check if my findings are helpful:

As you mentioned that you are using the Python 3.9.12 acquired from Microsoft store.

The same issue had been registered in the GitHub where people had fixed this issue by switching/using the Python interpreter from the Python.org website and copied over the azure site packages to that install location.

So, try switching to python interpreter from official website and the troubleshooting steps given in this GitHub issue.

  • Thanks for the comment. I adapted the sample code and it runs correctly on my local server. However when I deploy the app through Visual Studio Code to Azure App Services, I got the same error: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND). Since the deployment build everything remote according to my understanding on Azure, I don't know how to switch from Microsoft Store version Python to the Python.org version python. Can someone help please? – Rui May 04 '22 at 17:21
0

Per the defined pre-requisites, make sure to have dependencies installed.

In my case, I needed libssl-dev libasound2.

Nirvana Tikku
  • 4,105
  • 1
  • 20
  • 28