运行Golang版本的快速入门:将文本转换为语音时,出现此错误。
Synthesis started.
CANCELED: Reason=1.
CANCELED: ErrorCode=5
CANCELED: ErrorDetails=[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: 02f16471298847bb89fcebf5a3d474cc USP state: Sending. Received audio size: 0 bytes.]
CANCELED: Did you set the speech resource key and region values?
此外,通过 spx cli 的语音服务也失败,但 spx cli 不是我主要关心的问题。相反,这是为了表明这个问题有多么普遍。
$ spx synthesize --text "Enjoy using the Speech CLI." --audio output my-sample.wav
SPX - Azure Speech CLI, Version 1.29.0
Copyright (c) 2022 Microsoft Corporation. All Rights Reserved.
audio.output.file=my-sample.wav
audio.output.type=file
diagnostics.config.log.file=log-{run.time}.log
service.config.key= 1ef5****************************
service.config.region=eastus
synthesizer.input.text=Enjoy using the Speech CLI.
synthesizer.input.type=text
x.command=synthesize
x.input.path=@none
SYNTHESIS STARTED: ca5354d966964c15b0c1630c601535a9
CANCELED: Reason=Error
CANCELED: ErrorCode=ConnectionFailure
CANCELED: ErrorDetails=Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED
wss://eastus.tts.speech.microsoft.com/cognitiveservices/websocket/v1
X-ConnectionId: cbaf9bdda02c42c796fef1bdd071bbf9 USP state: Sending. Received audio size: 0 bytes.
CANCELED: Did you update the subscription info?
详情
westus
和第二个示例中的 eastus
。那不起作用(由this github post建议)。我在我的主要工作笔记本电脑上面临这个问题。我的 Golang 代码和 SPX(命令行)都可以在我的另一台笔记本电脑上运行。
您看到的错误消息表明打开服务的网络连接时出现问题。这可能与您的配置或网络问题有关。理想情况下,我们需要 SDK 日志才能正确诊断您遇到的问题。您可以按照这些说明
启用日志记录但是,鉴于您使用的是 Ubuntu 22.04,我大胆猜测您缺少一些依赖项。首先仔细检查您是否安装了最低限度的依赖项:
sudo apt-get update
sudo apt-get install build-essential libssl-dev ca-certificates libasound2 wget
您也可能没有安装正确版本的 OpenSSL 库。认知服务语音 SDK 仍使用 OpenSSL 1.1.1,但 Ubuntu 22.04 已迁移到 OpenSSL 3.0。您可以通过从命令行运行
openssl version
来确认您拥有哪个版本。这里有两个选择:
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb