c# - Amazon polly tts SSML 标签
问题描述
我过去曾使用 amazon polly 通过文本生成音频文件。这是我使用的代码:
public static void GenerateVoiceFileByAmzonApi(string VoiceName, string StrText,string FileName)
{
Amazon.Polly.AmazonPollyClient cl = new Amazon.Polly.AmazonPollyClient("abc", "abc", RegionEndpoint.USEast1);
Amazon.Polly.Model.SynthesizeSpeechRequest req = new Amazon.Polly.Model.SynthesizeSpeechRequest();
req.Text = StrText;
switch (VoiceName)
{
case VOICE_NAME_AMAZON_GIORGIO:
req.VoiceId = Amazon.Polly.VoiceId.Giorgio;
break;
case VOICE_NAME_AMAZON_CARLA:
req.VoiceId = Amazon.Polly.VoiceId.Carla;
break;
case VOICE_NAME_AMAZON_BIANCA:
req.VoiceId = Amazon.Polly.VoiceId.Bianca;
break;
default:
req.VoiceId = Amazon.Polly.VoiceId.Giorgio;
break;
}
req.TextType
req.OutputFormat = Amazon.Polly.OutputFormat.Ogg_vorbis;
req.TextType = Amazon.Polly.TextType.Text;
Amazon.Polly.Model.SynthesizeSpeechResponse resp = cl.SynthesizeSpeech(req);
using (System.IO.FileStream wFile = new System.IO.FileStream(FileName, System.IO.FileMode.Create))
{
resp.AudioStream.CopyTo(wFile);
wFile.Flush();
wFile.Close();
}
}
此代码有效,但有时我的文本带有不同的感叹号(!)或问号(?),但声音没有改变。
特别是有一些带有感叹号的文本包含警报情况,我喜欢在这些特定的 circustanes 中模拟人声的声音。
您知道是否可以使用 SSML 或其他方法吗?
谢谢 !
解决方案
推荐阅读
- c# - 如何在 C# Linq 中对两列的值进行分组和求和
- java - 然后其余的值需要设置升序
- python-3.x - 为什么我不能从 Spyder 导入 scikit-learn,但我可以从命令行导入?
- mongodb - 如何在 MongoDB 的嵌入式文档中更新以美元开头的字段?
- sql - 在 where 语句中使用星期几
- typo3 - Extbase n:m setOrderings() 排序不正确
- python - 如何将 GCP 安全指挥中心的调查结果导出到 BigQuery?
- c++ - 从像素中获取标记的真实坐标
- java - spring-boot-starter-jersey 不会自动选择自定义转换器类
- html - 受 :first-child 伪类影响,尽管它不是规则设置的元素的第一个孩子
我在 MDN 页面上测试了使用选择器的技能,我遇到了这样的情况:为 :first-child of div element with class .container 编写的 CSS 规则被应用于层次结构中的表元素,但不是第一个子元素div 元素。为什么会这样?我是否缺少表格元素的一些一般规则?正如我所料,只有第一个 p 元素应该受此规则影响。
我附上了 MDN 上使用的 html