Getting Exception with an error code: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) when calling speechsdk.SpeechSynthesizer

JS 0 Reputation points
2023-04-17T10:44:00.19+00:00

Hi, I'm trying to make text to speech implementation. The application works locally fine with windows 10, Python 3.7.9 But when deployed to Azure Webapp I get Internal Server Error (500) And from logs I see trace:

2023-04-17T10:34:47.616406949Z RuntimeError: Exception with error code: 2023-04-17T10:34:47.616410949Z [CALL STACK BEGIN] 2023-04-17T10:34:47.616414949Z 2023-04-17T10:34:47.616418649Z /tmp/8db3f2c6c18ea77/antenv/lib/python3.7/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1aed40) [0x7701c07fad40] 2023-04-17T10:34:47.616422949Z /tmp/8db3f2c6c18ea77/antenv/lib/python3.7/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1f7d3c) [0x7701c0843d3c] 2023-04-17T10:34:47.616428049Z /tmp/8db3f2c6c18ea77/antenv/lib/python3.7/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(synthesizer_create_speech_synthesizer_from_config+0xf3) [0x7701c071bcae] 2023-04-17T10:34:47.616432449Z /usr/lib/x86_64-linux-gnu/libffi.so.7(+0x6d1d) [0x7701c92ffd1d] 2023-04-17T10:34:47.616436349Z /usr/lib/x86_64-linux-gnu/libffi.so.7(+0x6289) [0x7701c92ff289] 2023-04-17T10:34:47.616440349Z /opt/python/3.7.16/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so(_ctypes_callproc+0x2be) [0x7701c931409e] 2023-04-17T10:34:47.616444349Z /opt/python/3.7.16/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so(+0xeaa8) [0x7701c9313aa8] 2023-04-17T10:34:47.616448449Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(PyObject_Call+0x79) [0x7701ca8d5999] 2023-04-17T10:34:47.616452349Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x1df9) [0x7701ca8bb9f9] 2023-04-17T10:34:47.616456449Z /opt/python/3.7.16/lib/python3.7/site-packages/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.cpython-37m-x86_64-linux-gnu.so(+0x18876) [0x7701c8dd0876] 2023-04-17T10:34:47.616460549Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2ef) [0x7701ca8b8a8f] 2023-04-17T10:34:47.616464749Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(_PyFunction_FastCallDict+0x2ce) [0x7701ca8cf64e] 2023-04-17T10:34:47.616469049Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x1df9) [0x7701ca8bb9f9] 2023-04-17T10:34:47.616473249Z /opt/python/3.7.16/lib/python3.7/site-packages/debugpy/_vendored/pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.cpython-37m-x86_64-linux-gnu.so(+0x18876) [0x7701c8dd0876] 2023-04-17T10:34:47.616477349Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2ef) [0x7701ca8b8a8f] 2023-04-17T10:34:47.616481449Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(_PyFunction_FastCallDict+0x2ce) [0x7701ca8cf64e] 2023-04-17T10:34:47.616485349Z /opt/python/3.7.16/lib/libpython3.7m.so.1.0(_PyObject_Call_Prepend+0x5f) [0x7701ca8d519f] 2023-04-17T10:34:47.616489349Z [CALL STACK END] 2023-04-17T10:34:47.616493249Z 2023-04-17T10:34:47.616496949Z Exception with an error code: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) 2023-04-17T10:34:47.618473457Z 169.254.130.4 - - [17/Apr/2023 10:34:47] "POST /generate_audio HTTP/1.1" 500 - 2023-04-17T10:34:47.618495457Z INFO:werkzeug:169.254.130.4 - - [17/Apr/2023 10:34:47] "POST /generate_audio HTTP/1.1" 500 -

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

1 answer

Sort by: Most helpful
  1. romungi-MSFT 42,786 Reputation points Microsoft Employee
    2023-04-17T13:22:43.1133333+00:00

    @JS The most likely reason for this error is that on a webapp or app service you will have to set the audio config for TTS or STT scenarios since the remote app service does not have access to a microphone or speaker the audio config should be set to a audio file.

    Please this [thread](https://learn.microsoft.com/en-us/answers/questions/1184428/azure-text-to-speech-error-code-0x38-(spxerr-audio) for details which fixed the issue for the user.

    Try to add the following to your speechSyntheszier() config.

    file_name = "outputaudio.wav"
        file_config = speechsdk.audio.AudioOutputConfig(filename=file_name)
        speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=file_config)
    
    

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.