Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.82k stars 1.83k forks source link

Issue with Speech SDK on Raspberry Pi: Runtime Error and Initialization Failure #2393

Closed cnkang closed 3 months ago

cnkang commented 3 months ago

IN ORDER TO ASSIST YOU, PLEASE PROVIDE THE FOLLOWING:

def main(): speech_config = speechsdk.SpeechConfig(subscription=os.getenv("AZURE_SPEECH_KEY"), region=os.getenv("AZURE_SPEECH_REGION")) speech_config.speech_synthesis_voice_name = os.getenv("VOICE_NAME", "zh-CN-XiaoxiaoMultilingualNeural") audio_config = speechsdk.audio.AudioOutputConfig(use_default_speaker=True) try: synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config) print("Synthesizer initialized successfully.") except Exception as e: print(f"Failed to initialize synthesizer: {e}")

if name == 'main': main()



**Describe the bug**

When attempting to initialize the SpeechSynthesizer on a Raspberry Pi (ARM architecture), the SDK throws a runtime error indicating a failure to initialize the platform. The error message received is "Runtime error: Failed to initialize platform (azure-c-shared). Error: 2176".

**To Reproduce**
Steps to reproduce the behavior:

Set up a Raspberry Pi with the latest Raspbian OS.
Install the latest version of the Azure Cognitive Services Speech SDK via pip.
Run the above Python script.
Observe the error during the initialization of SpeechSynthesizer.

**Expected behavior**

I expected the SpeechSynthesizer to initialize successfully without any errors, allowing further actions like synthesizing text to speech.

**Version of the Cognitive Services Speech SDK**
azure-cognitiveservices-speech 1.37.0

**Platform, Operating System, and Programming Language**

 - OS: $ uname -a
Linux mir 6.6.28+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux
 - Hardware - arm64
 - Programming language: Python

**Additional context**
Failed to synthesize speech: Exception with error code: 
[CALL STACK BEGIN]

<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1ec00c) [0x7fad18c00c]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x20c5e4) [0x7fad1ac5e4]
/lib/aarch64-linux-gnu/libc.so.6(+0x83e08) [0x7fadc93e08]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x20d564) [0x7fad1ad564]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1bc394) [0x7fad15c394]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1b9ec0) [0x7fad159ec0]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1f2d0c) [0x7fad192d0c]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x2066d0) [0x7fad1a66d0]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1dbc88) [0x7fad17bc88]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1094dc) [0x7fad0a94dc]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1f2d0c) [0x7fad192d0c]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1b9a0c) [0x7fad159a0c]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x225290) [0x7fad1c5290]
<omitted>/lib/python3.12/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(synthesizer_create_speech_synthesizer_from_config+0x10c) [0x7fad0621a4]
<omitted>/lib/python3.12/lib-dynload/../../libffi.so.8(+0x6ec0) [0x7fad676ec0]
<omitted>/lib/python3.12/lib-dynload/../../libffi.so.8(+0x6438) [0x7fad676438]
<omitted>/lib/python3.12/lib-dynload/_ctypes.cpython-312-aarch64-linux-gnu.so(+0x13a78) [0x7fad6a3a78]
[CALL STACK END]

Runtime error: Failed to initialize platform (azure-c-shared). Error: 2176
pankopon commented 3 months ago

Hi, Raspbian OS / Raspberry Pi OS is not supported by the Speech SDK (and there's no plan for it). You should install Ubuntu or some other supported Linux distribution as documented in https://learn.microsoft.com/en-us/azure/ai-services/speech-service/quickstarts/setup-platform?tabs=linux&pivots=programming-language-python#platform-requirements

Also note that currently a Linux environment still needs to have OpenSSL 1.x (as the distributions listed in the platform requirements do) in order to use the Speech SDK. Support for 3.x will be added in the next SDK release.