C# 使用荷兰语语音合成器
我想在c#中使用tts,我的代码在英语中很好用,但现在我想用荷兰语C# 使用荷兰语语音合成器,c#,C#,我想在c#中使用tts,我的代码在英语中很好用,但现在我想用荷兰语 private void btnSpeak_Click(object sender, EventArgs e) { SpeechSynthesizer synthesizer = new SpeechSynthesizer(); foreach (var v in synthesizer.GetInstalledVoices(CultureInfo.CurrentCulture)) {
private void btnSpeak_Click(object sender, EventArgs e)
{
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
foreach (var v in synthesizer.GetInstalledVoices(CultureInfo.CurrentCulture))
{
VoiceInfo info = v.VoiceInfo;
OutputVoiceInfo(info);
}
synthesizer.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Adult, 0, CultureInfo.CurrentCulture);
synthesizer.Volume = 100; // 0...100
synthesizer.Rate = 1; // -10...10
// Synchronous
if(textBox1.Text != null)
synthesizer.SpeakAsync(textBox1.Text);
}
private static void OutputVoiceInfo(VoiceInfo info)
{
Console.WriteLine("Name: {0}, culture: {1}, gender: {2}, age: {3}.\n", info.Name, info.Culture, info.Gender, info.Age);
Console.WriteLine("Description: {0}\n", info.Description);
}
有什么我应该安装的,以便它能说荷兰语吗 实际上,它可以说Windows中安装的任何支持所选区域性的语言。你确定你安装了能说荷兰语的语音(我假设是
nl-nl
文化)?您应该在控制台的输出中找到这一点,该输出由OutputVoiceInfo()
方法编写。我也有类似的问题。运行以下PowerShell解决了此问题:
$sourcePath = 'HKLM:\software\Microsoft\Speech_OneCore\Voices\Tokens' #Where the OneCore voices live
$destinationPath = 'HKLM:\SOFTWARE\Microsoft\Speech\Voices\Tokens' #For 64-bit apps
$destinationPath2 = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens' #For 32-bit apps
cd $destinationPath
$listVoices = Get-ChildItem $sourcePath
foreach($voice in $listVoices)
{
$source = $voice.PSPath #Get the path of this voices key
copy -Path $source -Destination $destinationPath -Recurse
copy -Path $source -Destination $destinationPath2 -Recurse
}
资料来源:
运行您的示例时使用的是荷兰TTS引擎Microsoft Frank。请参阅此处的备注部分:我还没有安装语音,您可以推荐一种免费语音吗?@just8laze荷兰版Windows默认安装了荷兰语音。对于免费/预装版本;这是最好的。但是,在开发过程中可以使用一些免费的声音。