C#和微软语音。识别和语音。合成

C#和微软语音。识别和语音。合成,c#,speech-synthesis,C#,Speech Synthesis,我不熟悉C#,也不熟悉语音识别。 我搜索了很长时间的教程,但没有找到那么多,我甚至不确定是否所有内容都正确 我下载了: 我在本地编程,我有Windows XP、.net framework 3.5 现在我只想开始一些简单的代码行,比如说“hello world”或者说一两个单词作为输入 我尝试了以下操作,当然不起作用:> 错误: 找不到类型或命名空间名称“SpeechSynthesizer”(缺少Using目录还是Assemblyverweis?) 编辑: 你好,, 我试过你的密码,但

我不熟悉C#,也不熟悉语音识别。 我搜索了很长时间的教程,但没有找到那么多,我甚至不确定是否所有内容都正确

我下载了:

我在本地编程,我有Windows XP、.net framework 3.5

现在我只想开始一些简单的代码行,比如说“hello world”或者说一两个单词作为输入

我尝试了以下操作,当然不起作用:> 错误:

找不到类型或命名空间名称“SpeechSynthesizer”(缺少Using目录还是Assemblyverweis?)

编辑:

你好,, 我试过你的密码,但是 使用SpeechLib; 找不到:>

现在我写道:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Recognition;
using System.Speech.Synthesis;
using System.SpeechLib;

namespace System.SpeechLib { }
namespace System.Speech.Recognition { }
namespace System.Speech.AudioFormat {}
namespace System.Speech.Recognition.SrgsGrammar{}
namespace System.Speech.Synthesis { }
namespace System.Speech.Synthesis.TtsEngine { }
但我发现了一个错误:

numericUpDown1、SpVoice、SpeechVoiceSpeakFlags、textBox1和超时

您可以尝试以下方法:

获取
Interop.SpeechLib.dll

using SpeechLib;

private void ReadText(string readText)
        {
            int iCounter = 0;
            while (Convert.ToInt32(numericUpDown1.Value) > iCounter)
            {
                SpVoice spVoice = new SpVoice();
                spVoice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
                spVoice.WaitUntilDone(Timeout.Infinite);
                iCounter = iCounter + 1;
            }
        }

Project+添加引用.NET选项卡,选择“System.Speech”


项目模板预先选择几个.NET程序集。但只有常见的,如System.dll、System.Core.dll等。您必须自己添加“不寻常”项。

+1<代码>使用只是创建名称空间的快捷方式。要使用它们,您需要将程序集链接到项目。谢谢,我学习了system.speech,现在它可以工作了!greate-(你知道我是怎么改学德语的吗?)是的,高中三年的德语对我很有帮助。但我不认为你能在Windows机器上得到它,除非Windows版本是德国的。不知道需要什么,钱是毫无疑问的。在superuser.com上再问一个问题
using SpeechLib;

private void ReadText(string readText)
        {
            int iCounter = 0;
            while (Convert.ToInt32(numericUpDown1.Value) > iCounter)
            {
                SpVoice spVoice = new SpVoice();
                spVoice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
                spVoice.WaitUntilDone(Timeout.Infinite);
                iCounter = iCounter + 1;
            }
        }