个人体验:个人免费,美式英语语音合成质量比较高,系统提供了多种语音风格选择。
语音合成示例代码
static string speechKey = "6daa5e17bb9b4681aabdf3.。。。。。。";
static string speechRegion = "eastus2";
async static Task Main(string[] args)
{
var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion);
speechConfig.SpeechSynthesisVoiceName = "en-US-JennyNeural";
speechConfig.OutputFormat = OutputFormat.Simple;
speechConfig.SetSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3);
using (var speechSynthesizer = new SpeechSynthesizer(speechConfig))
{
string text = "Enter some text that you want to speak";
var speechSynthesisResult = await speechSynthesizer.SpeakTextAsync(text);
File.WriteAllBytes("aa.mp3", speechSynthesisResult.AudioData);
Process.Start("explorer.exe","aa.mp3");
}
}
所有语音列表
var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion);
var allVoices = new SpeechSynthesizer(speechConfig).GetVoicesAsync().Result.Voices.ToList();
allVoices.ForEach(x =>
{
if (x.Locale == "en-US" && x.Gender == SynthesisVoiceGender.Male)
{
Console.WriteLine(x.Gender + "," + x.ShortName);
if (x.StyleList.Count() > 1)
{
Console.Write("\t");
foreach (var style in x.StyleList)
{
Console.Write(style + ",");
}
Console.WriteLine();
}
}
});