- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
调用SpeakSsmlAsync
时(Microsoft Speech SDK),返回如下错误信息:
> CANCELED: Reason=Error
> CANCELED: ErrorCode=BadRequest
> CANCELED: ErrorDetails=[HTTPAPI result code = HTTPAPI_OK. HTTP status code=400.]
> CANCELED: Did you update the subscription info?
重现步骤:
从以下位置下载快速入门示例 https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/quickstart/text-to-speech/csharp-dotnet-windows
用自己的值替换订阅 ID 和区域,设置事件文档中描述的配置,清理和重建项目
启动程序并输入一些文本,如“abracadabra”
--> 工作正常(使用 SpeakTextAsync
)
替换SpeakTextAsync
与 SpeakSsmlAsync
启动程序并输入一些文本
--> ErrorCode=BadRequest
使用适当的 SSML 代码重试 <speak version="1.0" xmlns="https://www.w3.org/2001/10/synthesis" xml:lang="en-US">abracadabra</speak>
"
--> ErrorCode=BadRequest
系统
代码
using System;
using System.Threading.Tasks;
using Microsoft.CognitiveServices.Speech;
namespace helloworld
{
class Program
{
private static string endpointSpeechKey = "<MyOwnServiceKey>";
private static string region = "westeurope";
public static async Task SynthesisToSpeakerAsync()
{
var config = SpeechConfig.FromSubscription(endpointSpeechKey, region);
using (var synthesizer = new SpeechSynthesizer(config))
{
Console.WriteLine("Type some text that you want to speak...");
Console.Write("> ");
string text = Console.ReadLine();
using (var result = await synthesizer.SpeakSsmlAsync(text))
{
if (result.Reason == ResultReason.SynthesizingAudioCompleted)
{
Console.WriteLine($"Speech synthesized to speaker for text [{text}]");
}
else if (result.Reason == ResultReason.Canceled)
{
var cancellation = SpeechSynthesisCancellationDetails.FromResult(result);
Console.WriteLine($"CANCELED: Reason={cancellation.Reason}");
if (cancellation.Reason == CancellationReason.Error)
{
Console.WriteLine($"CANCELED: ErrorCode={cancellation.ErrorCode}");
Console.WriteLine($"CANCELED: ErrorDetails=[{cancellation.ErrorDetails}]");
Console.WriteLine($"CANCELED: Did you update the subscription info?");
}
}
}
// This is to give some time for the speaker to finish playing back the audio
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
static void Main()
{
SynthesisToSpeakerAsync().Wait();
}
}
}
调试截图
最佳答案
Azure 似乎仅在包含语音标签时才接受 SSML。否则,您将收到 http-400 错误。
使用下面的代码,对 SpeakSsmlAsync 的调用成功运行:
text = @"<speak version='1.0' xmlns='https://www.w3.org/2001/10/synthesis' xml:lang='en-US'><voice name='en-US-ZiraRUS'>abracadabra</voice></speak>";
using (var result = await synthesizer.SpeakSsmlAsync(text))
搜索 Microsoft SSML 时要小心。有区别
https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/speech-synthesis-markup
(这是针对 Azure 语音服务进行编程时需要的)和
https://learn.microsoft.com/en-us/cortana/skills/speech-synthesis-markup-language
关于c# - SpeakSsmlAsync 返回 BadRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56423958/
我需要使用 HttpClientFactory 来连接到外部 api。Startup.cs 中的代码如下所示 public void SetUpHttpClients(IServiceCollecti
我目前正在使用 Eventstore,但收到以下错误:Could not recognize BadRequest; 来自: game process tick failed UnknownError
我尝试为我设置的新 Azure 应用服务生成 Azure 应用服务托管证书。 当我运行命令生成 Azure 应用服务托管证书时: az webapp config ssl create --resou
我正在尝试进行 PATCH 操作,如果请求正文包含契约(Contract)中未指定的字段,则该操作应该会失败。例如,如果我调用此方法: [HttpPatch("{id}")] public async
调用SpeakSsmlAsync时(Microsoft Speech SDK),返回如下错误信息: > CANCELED: Reason=Error > CANCELED: ErrorCode=Bad
我想为以下代码编写单元测试用例 HomeController.cs [HttpPost] [ActionName("CreateDemo")] public async
看来HttpGet方法的返回类型不必是 ActionResult .例如,以下方法有效: [HttpGet] [Route("list")] public async Task> List() 但是,
所以我正在研究 Gtk/X11/Linux app将屏幕捕获到 .gif 并且停止捕获的方法之一是按键(Esc、Space 或 End)。您也可以使用超时。但是,要实现按键以结束捕获,我必须能够捕获键
我正在运行一个 rails 应用程序,我有一个简单的显示操作,其中的代码类似于以下内容: @post = Post.find(params[:id]) 所以如果你去帖子/1 例如,如果有帖子,您将看到
我正在尝试使用 Register-AzureRmAutomationDscNode powershell 命令在 Azure VM 上注册 DSC 配置。 Register-AzureRmAutoma
我正在创建一个仅运行简单的“等待”的管道,仅用于测试,因为我试图理解为什么我的其他管道返回错误(相同的错误)。 当我尝试调试时,它发送以下错误: { "code": "BadRequest",
我不知道怎么做,但是 Azure 允许您为同一个 VIP 在不同的 VMS 中输入两个相同的端点。现在我无法删除这些端点。有人知道我该怎么办吗? 端点 删除端点时出错 我也尝试过删除 VIP 和保留
我将 Azure Media Services v3 与 Azure Function v3 应用程序结合使用,在尝试从 https url 创建新作业时遇到问题。 我在提交作业的 Azure Fun
我想使用基于查询的 PowerShell 创建日志警报。我按照 https://learn.microsoft.com/en-us/azure/azure-monitor/platform/alert
此处使用 .net core Web api。 我的 api 中有一个端点: [HttpPost("data")] public async Task PostData(List udata) {
我正在开发一个 Spring 应用程序,目前我正在对我们的客户注册表实现搜索。 我们用户请求的一个关键点是最多可以对以下参数中的一个进行搜索:名称OR id(可以是部分)OR 店铺id(顾客注册的店铺
我将 Azure Media Services v3 与 Azure Function v3 应用程序结合使用,在尝试从 https url 创建新作业时遇到问题。 我在提交作业的 Azure Fun
我想使用基于查询的 PowerShell 创建日志警报。我按照 https://learn.microsoft.com/en-us/azure/azure-monitor/platform/alert
此处使用 .net core Web api。 我的 api 中有一个端点: [HttpPost("data")] public async Task PostData(List udata) {
我正在编写一个 x11 剪贴板客户端,但 INCR 遇到了困难。基本上,我的问题是,当我调用 XDeleteProperty 来启动 INCR 传输时,我收到了 BadRequest 错误代码 这是一
我是一名优秀的程序员,十分优秀!