0

After following the directions on azure text-to-speech quick start and speech sdk tutorial and running it in Lubuntu 22 (Ubuntu 22.04.2 LTS) as guest on VirtualBox gets the error message below. But running the same code in Lubuntu 20 (also as VB guest) works. Already tried the directions on installing OpenSSL 1.x (1.1.1u) on speech SDK. And yes, the resource keys and region values are correct.

Couldn't find a fix and is just wondering has anyone happened across this and knows a fix?

Also, if I try running the quickstart in python, it would just create an empty mp3 file. But running the same code on Lubuntu 20 works.

Speech synthesis canceled: CancellationReason.Error
Error details: Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED
wss://westus.tts.speech.microsoft.com/cognitiveservices/websocket/v1
X-ConnectionId: 8226ab1b8b33405cbab7788d635b6647 USP state: Sending. Received audio size: 0 bytes.
Did you set the speech resource key and region values?
S7bvwqX
  • 147
  • 3
  • 13

1 Answers1

0

I tried running the code in Linux (ubuntu 20.04) and the code ran successfully, Refer below:-

enter image description here

When I ran the same code in Ubuntu 22.04 Linux VM, I received the same error code refer below:-

enter image description here

This is a transient error while running the Speech SDK in Linux VM, Refer this Github issue on the same error where the issue was resolved by creating a new speech resource and using the new Speech Key and Region.

I created a new Speech resource in North Europe region and a new Linux VM with x64 architecture with 22.04 Ubuntu distro like below:-

enter image description here

enter image description here

I followed these 2 additional steps to use Azure Speech SDK in Ubuntu 22.04,

  1. As Ubuntu 22.04 VM comes with OpenSSL 1.3, The Speech SDK is not yet updated to be used with OpenSSL 1.3 properly thus according to this github issue-2 you need go install OpenSSL 1.1 to make sure the speech sdk code runs properly in your Ubuntu 22.04 Linux VM.

Commands to install OpenSSL 1.1:-

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  1. As Ubuntu 22.04 VM does not come with inbuilt audio or mic enabled, You need to install the package below for the code to run properly:-
sudo apt-get install libasound2-dev

In addition to this I installed pip package and Speech sdk with the commands below:-

sudo apt-get update
sudo apt-get install python3-pip
pip install azure-cognitiveservices-speech

After installing the necessary dependencies, I copied the Speech Key and Speech Region from the Speech resource and ran the below command to set it as an environment variable:-

export SPEECH_KEY=2a6a8f3b822944d3ac3aeb0b35661a8d
export SPEECH_REGION=northeurope

Now, I ran the text to speech code and it ran successfully, Refer below:-

python3 texttospeech.py

enter image description here

SiddheshDesai
  • 3,668
  • 1
  • 2
  • 11
  • I installed OpenSSL 1.1, the other packages, created new azure resource with northeurope region, but still got the same error msg... It works in Ubuntu 22, but still couldn't get it to work in Lubuntu 22. If Ubuntu works, Lubuntu should too right? I am using Lubuntu 20 VM as a temporary fix... – S7bvwqX Jul 18 '23 at 09:56