我首先要说的是,我在 C# 编程方面非常新手。我正在开发一个应用程序,用于使用 C# 结合 SAPI v5.4 ( speechlib ) 以编程方式修改 Windows 语音词典。到目前为止,一切都运行良好,但我需要更深入地了解字符串在合成(有声)时如何解释。
我的理解是,在 SAPI 5.4 中,单词被分解为音素表示,并且我在使用音素正确“训练”单词发音方面取得了一些成功。我还知道我可以手动将单词添加到 Windows 语音识别词典中,提供录音,然后提取单词的发音(音素)...但这很麻烦。探索默认情况下如何合成单词也很有用,即没有我的输入(例如合成器如何解释“海豚”?)。
从编码的角度来看,这是我到目前为止所得到的:
using System;
using System.Speech.Synthesis;
namespace SpeechTest
{
class Program
{
static void Main(string[] args)
{
// Set up the speech synthesizer
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
synthesizer.Volume = 100;
synthesizer.Rate = -2;
// Configure the audio output
synthesizer.SetOutputToDefaultAudioDevice();
// Initialize string to store word of interest (not in the speech dictionary)
string myWord = "dolphins";
// Speak the …Run Code Online (Sandbox Code Playgroud)