How to fix the example given below on Raspberry Pi 4.
ahmed.rhiat
5
Reputation points
Hello !!! . I try to run the example below. It works on Windows10 but it doesn't work on Raspberry Pi 4. I get the following error :
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://francecentral.tts.speech.microsoft.com/cognitiveservices/websocket/v1
X-ConnectionId: c6cf78b633204517ace1070fae3913f3 USP state: Sending. Received audio size: 0 bytes.
Did you update the subscription info?
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
# <code>
import azure.cognitiveservices.speech as speechsdk
# Creates an instance of a speech config with specified subscription key and service region.
# Replace with your own subscription key and service region (e.g., "westus").
speech_key, service_region = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "francecentral"
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
# Set the voice name, refer to https://aka.ms/speech/voices/neural for full list.
speech_config.speech_synthesis_voice_name = "en-US-AvaMultilingualNeural"
# Creates a speech synthesizer using the default speaker as audio output.
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)
# Receives a text from console input.
print("Type some text that you want to speak...")
text = input()
# Synthesizes the received text to speech.
# The synthesized speech is expected to be heard on the speaker with this line executed.
result = speech_synthesizer.speak_text_async(text).get()
speech_config.set_property(speechsdk.PropertyId.Speech_LogFilename, "Log.txt")
# Checks result.
if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:
print("Speech synthesized to speaker for text [{}]".format(text))
elif result.reason == speechsdk.ResultReason.Canceled:
cancellation_details = result.cancellation_details
print("Speech synthesis canceled: {}".format(cancellation_details.reason))
if cancellation_details.reason == speechsdk.CancellationReason.Error:
if cancellation_details.error_details:
print("Error details: {}".format(cancellation_details.error_details))
print("Did you update the subscription info?")
# </code>
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,061 questions
Sign in to answer