使用SAPI是否可以输入拼音输入中文发音?

| 目的是能够发音类似wo3的声音。 System.Speech可以处理汉字,但是有没有办法直接输入拼音?从http://msdn.microsoft.com/zh-cn/library/ms720566(v=vs.85).aspx看来,我应该能够像这样写出拼音
<PRON SYM=\"ni 3\"/>
如何使用PRON SYM? 更新: 以下是一些讨论该问题但没有解决方案的网页: -http://www.ms-news.net/f3012/problem-with-phonemes-and-chinese-tts-3031240.html 更新2 我在.NET中使用System.Speech.Synthesizer。也许这就是问题所在。我可以看到将其输入到语音属性中可以正常工作: 如果我从C#执行此操作,它将仅读取标签:
        var culture = CultureInfo.GetCultureInfo(\"zh-CN\");
        var synth = new SpeechSynthesizer();
        var voices = synth.GetInstalledVoices(culture);

        if (voices.Count > 0)
        {
            synth.SelectVoice(voices[0].VoiceInfo.Name);
            synth.Speak(\"<pron sym=\\\"ni 3 hao 3 xiao 1\\\"/>\");
        }
    
已邀请:
        我已经完成了这个示例,并且工作正常,我不会说中文,因此,我使用自动翻译器获取示例词。 这是表格的设计: 这是其背后的代码;我从中文音素表中获得音素。
using System;
using System.Windows.Forms;
using SpeechLib;

namespace SpeechDemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            //get installed voices
            SpVoice voice = new SpVoice();
            foreach (var item in voice.GetVoices())
            {
                comboBox1.Items.Add(((ISpeechObjectToken)item).GetDescription());
            }
        }

        private void btnSpeakPhonems_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex > 0)
            {
                SpVoice voice = new SpVoice();
                voice.Voice = voice.GetVoices().Item(comboBox1.SelectedIndex);
                voice.Speak(\"<pron sym=\\\"ang 1 zang 1\\\">变脏</pron>\", SpeechVoiceSpeakFlags.SVSFlagsAsync);

            }
        }
    }
}
在测试之前,请务必从ComboBox中选择(Microsoft简体中文)。如果没有,您可以下载Microsoft Speech的语言包(SpeechSDK51LangPack.exe)。 编辑: 在SpeechSynthesizer pron =>音素和sym => ph中。这是代码与SpeechSynthesizer配合良好的代码:
private void button1_Click(object sender, EventArgs e)
{
    var cu = CultureInfo.GetCultureInfo(\"zh-CN\");
    SpeechSynthesizer sp = new SpeechSynthesizer();
    var voices = sp.GetInstalledVoices(cu);
    sp.SelectVoice(voices[0].VoiceInfo.Name);
    string s = \"<?xml version=\\\"1.0\\\"?> <speak version=\\\"1.0\\\" xml:lang=\\\"zh-CN\\\"><phoneme ph=\\\"ang 1 zang 1\\\">变</phoneme></speak>\";
    sp.SpeakSsml(s);
}
    
        您是否尝试过:
<PRON SYM=\"ni 3\"> sometext</PRON>
? 另外,您可能要在这里检查。     
        我认为您的示例仅需稍作修改...。
if (voices.Count > 0)        
{
     synth.SelectVoice(voices[0].VoiceInfo.Name);
     PromptBuilder pb = new PromptBuilder();
     pb.AppendSsml(\"<pron sym=\\\"ni 3 hao 3 xiao 1\\\"/>\");
     synth.Speak(pb);
}
    

要回复问题请先登录注册