判断SSML音频是否合成成功
1.创建SpeechConfig对象
var config = SpeechConfig.FromSubscription("e1f258de8e244544aa908e2c994b7911", "westus");
2.实例化SpeechSynthesizer
using var synthesizer = new SpeechSynthesizer(config, null);
3.定义ssml内容
var ssmlContent = $"{languageCode}\">{voiceName}\">
{voiceTestSample.Sample}";
4.合成.wav音频
var ssmlSpeakResult = await synthesizer.SpeakSsmlAsync(ssmlContent);
5.检查合成结果
if(ssmlSpeakResult.Reason == ResultReason.SynthesizingAudioCompleted){}
思路:
1.看SpeakSsmlAsync返回结果: Task<speechsynthesisresult></speechsynthesisresult>
2.再看SpeechSynthesisResult是什么类型
可知SpeechSynthesisResult是一个对象
展开Reason发现他是一个枚举类型
它包含了各种音频状态信息,9用于成功合成音频
[En]
It contains a variety of audio status information, 9 for the successful synthesis of audio
通过if语句判断一下:
if (ssmlSpeakResult.Reason == ResultReason.SynthesizingAudioCompleted){
Console.WriteLine("")
}
Original: https://blog.csdn.net/qq_43529569/article/details/121870583
Author: S 占占
Title: 关于SSML音频合成是否成功的判断
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/513066/
转载文章受原作者版权保护。转载请注明原作者出处!