gpt4 book ai didi

C# 和 Microsoft Speech.Recognition 和 Speech.Synthesis

转载 作者:行者123 更新时间:2023-11-30 22:43:33 26 4
gpt4 key购买 nike

我是 C# 的新手,也是 Speech.Recognition 的新手。我搜索了很长时间的教程,但没有找到那么多,我什至不确定我是否正确包含了所有内容。

我下载了:

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

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

我试过跟随,当然它不起作用:>错误:

"The Typ- or Namespacename "SpeechSynthesizer" couldn't be found (Is a Using-Direktive or a Assemblyverweis missing?)"

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

namespace System.Speech.Recognition { }
namespace System.Speech.AudioFormat {}
namespace System.Speech.Recognition.SrgsGrammar{}
namespace System.Speech.Synthesis { }
namespace System.Speech.Synthesis.TtsEngine { }

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SpeechSynthesizer foo = new SpeechSynthesizer();
foo.Speak("Test");
}
}
}

编辑:

你好,我试过你的代码,但是使用语音库;找不到:>

现在我写了:

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 and Timeout

最佳答案

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

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

关于C# 和 Microsoft Speech.Recognition 和 Speech.Synthesis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3890102/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com