jackwuwei / gptspeaker

The ChatGPT Voice Assistant uses a Raspberry Pi (or desktop) to enable spoken conversation with OpenAI large language models. This implementation listens to speech, processes the conversation through the OpenAI service, and responds back. Like Apple Siri, Amazon Alex, Google Nest Home, Mi XiaoAi etc.
BSD 2-Clause "Simplified" License
41 stars 6 forks source link

Speech SDK fails with synthesizer_create_speech_synthesizer_from_config error #5

Closed tarunaroraonline closed 1 month ago

tarunaroraonline commented 1 month ago

Followed the steps you've outlined... Have you run into this issue at all? Seems to fail saying failed to initialize platform... I've tested the mic and speaker separately and they seem to work on the pi.

me/taa/gptspeaker/gptspeaker/lib/python3.11/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(synthesizer_create_speech_synthesizer_from_config+0x10c) [0x7f977f21a4] /lib/aarch64-linux-gnu/libffi.so.8(+0x63e0) [0x7f97ec63e0] /lib/aarch64-linux-gnu/libffi.so.8(+0x5b24) [0x7f97ec5b24] /usr/lib/python3.11/lib-dynload/_ctypes.cpython-311-aarch64-linux-gnu.so(+0x12094) [0x7f97f12094] [CALL STACK END]

Runtime error: Failed to initialize platform (azure-c-shared). Error: 2176

jackwuwei commented 1 month ago

What about your raspberry pi and OS version?

jackwuwei commented 1 month ago

This problem may be caused by the openssl version. Azure speech sdk uses version 1.1, and the default version of Ubuntu 22.02 system is 3.0, so you must install a 1.1 version of openssl. You can refer to this link: Failed to initialize platform (azure-c-shared). Error: 2153

tarunaroraonline commented 1 month ago

Thanks for responding, i'll take a look to see if this fixes the issue. Much appreciated :)

jackwuwei commented 1 month ago

Thanks for responding, i'll take a look to see if this fixes the issue. Much appreciated :)

You're welcome, this problem has been solved, please reply.

tarunaroraonline commented 1 month ago

Yup all good, this has fixed the problem... Just listing out the steps for others...

download the OpenSSL 1.1 source:

wget https://www.openssl.org/source/openssl-1.1.1u.tar.gz

extract tarball

tar -xf openssl-1.1.1u.tar.gz cd openssl-1.1.1u

Configure and install OpenSSL 1.1:

./config make sudo make install

Update the shared library cache:

sudo ldconfig

Verify the installation:

openssl version

Find the installation path:

openssl version -d

Set the LD_LIBRARY_PATH environment variable:

export LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH

Make this change persistent across sessions:

echo 'export LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH' >> ~/.bashrc source ~/.bashrc

Reinstall the Azure SDK (Optional)

pip uninstall azure-cognitiveservices-speech pip install azure-cognitiveservices-speech

Test Your Script

python gptspeaker.py

jackwuwei commented 1 month ago

Yup all good, this has fixed the problem... Just listing out the steps for others...

download the OpenSSL 1.1 source:

wget https://www.openssl.org/source/openssl-1.1.1u.tar.gz

extract tarball tar -xf openssl-1.1.1u.tar.gz cd openssl-1.1.1u

Configure and install OpenSSL 1.1:

./config make sudo make install

Update the shared library cache:

sudo ldconfig

Verify the installation:

openssl version

Find the installation path:

openssl version -d

Set the LD_LIBRARY_PATH environment variable:

export LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH

Make this change persistent across sessions:

echo 'export LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH' >> ~/.bashrc source ~/.bashrc

Reinstall the Azure SDK (Optional)

pip uninstall azure-cognitiveservices-speech pip install azure-cognitiveservices-speech

Test Your Script

python gptspeaker.py

👍