Win10如何安装语音包
一、系统环境
二、安装步骤
2.1、控制面板,打开windows设置
说明:选择时间和语言选项,看到如下界面,主要关注语言及语音即可
2.2、语言安装
选择语言,点击添加语言功能
- 选择泰语,点击一下页
- 记得选择文本到语音的转换,
- 完成即可
2.3、下载语言包
选择安装语音包,如图第2步,输入 泰语/Thai
点击Add添加即可
• 打开“设置”(可以通过在开始菜单搜索“设置”来找到),选择“时间和语言”。
• 在左侧菜单中选择“语音”,然后在右侧找到“管理语音”或类似选项。
• 下载并安装所需的语音包。
SpeechSynthesizer
提供对已安装的语音合成引擎功能的访问。
初始化新 SpeechSynthesizer 实例时,它将使用默认的系统语音。 若要将 配置为 SpeechSynthesizer 使用已安装的语音合成 (文本转语音) 语音之一,请使用 SelectVoice 或 SelectVoiceByHints 方法。 若要获取有关已安装哪些语音的信息,请使用 GetInstalledVoices 方法和 VoiceInfo 类。
System.Speech.Synthesis.TtsEngine
支持基于语音合成标记语言 (SSML) 创建用于呈现文本到语音 (TTS) 的自定义引擎。
三、测试代码
点击查看代码
private SpeechSynthesizer _speech = new SpeechSynthesizer();
private void btnPlayVoice_Click(object sender, EventArgs e)
{
// Initialize a new instance of the SpeechSynthesizer.
//SpeechSynthesizer _speech = new SpeechSynthesizer();
// 选择系统已安装的语音包
//synth.GetInstalledVoices();
List<string> voices = (from o in _speech.GetInstalledVoices()
select o.VoiceInfo.Description).ToList();
string voiceDescription = voices[cbbVoices.SelectedIndex];
foreach (InstalledVoice installedVoice in _speech.GetInstalledVoices())
{
if (installedVoice.VoiceInfo.Description == voiceDescription)
{
_speech.SelectVoice(installedVoice.VoiceInfo.Name);
break;
}
}
// Configure the audio output.
_speech.SetOutputToDefaultAudioDevice();
// Speak a string.
//_speech.Speak("This example demonstrates a basic use of Speech Synthesizer");
string text = txtUserName.Text;
_speech.Speak(text);
}
private void MainForm_Load(object sender, EventArgs e)
{
List<string> voices = (from o in _speech.GetInstalledVoices()
select o.VoiceInfo.Description).ToList();
cbbVoices.Items.Clear();
cbbVoices.Items.AddRange(voices.ToArray());
cbbVoices.SelectedIndex = 0;
}