Tag: 语音识别

帮助SAPI v5.1 SpeechRecognitionEngine始终使用C#提供相同的错误结果

我正在玩这个SAPI v5.1库。 所以我正在测试我的样本WAV文件。 ( 从这里下载 )。 无论如何,该文件中的声音清晰简单。 它只包含一个三号字。 现在当我运行以下代码时,我得到数字8或“8”。 如果我删除它,我得到7.如果我尝试随机化列表我得到不同的结果,依此类推。 我真的很困惑,开始认为SAPI库中的SpeachRecognition根本不起作用…… 无论如何这里是我正在做的, private void button1_Click(object sender, EventArgs e) { //Add choices to grammar. Choices mychoices = new Choices(); mychoices.Add(“one”); mychoices.Add(“two”); mychoices.Add(“three”); mychoices.Add(“four”); mychoices.Add(“five”); mychoices.Add(“six”); mychoices.Add(“seven”); mychoices.Add(“eight”); mychoices.Add(“nine”); mychoices.Add(“zero”); mychoices.Add(“1”); mychoices.Add(“2”); mychoices.Add(“3”); mychoices.Add(“4”); mychoices.Add(“5”); mychoices.Add(“6”); mychoices.Add(“7”); mychoices.Add(“8”); mychoices.Add(“9”); mychoices.Add(“0”); Grammar myGrammar = new Grammar(new GrammarBuilder(mychoices)); //Create […]

从音频文件而不是麦克风识别语音

如何对来自音频文件(.mp3,wav)而不是麦克风的语音进行语音识别? 我希望能够从C#.NET和Delphi中做到这一点。

良好的语音识别API

我正在开展一个大学项目,我正在使用语音识别。 目前我正在Windows 7上开发它,我正在使用与.net一起提供的system.speech API包,我正在C#上进行。 我面临的问题是口述识别不够准确。 然后每当我启动应用程序时,桌面语音识别都会自动启动。 这对我来说是一个很大的麻烦。 正如我所说的话已经不够清楚,并且冲突的识别被解释为正在执行诸如应用程序切换最小化之类的命令和动作。 这是我的应用程序的一个关键部分,我恳请你为我提出任何好的语音API,除了这个微软的错误。 即使它只能理解简单的听写语法也会很好。

将输入流式传输到System.Speech.Recognition.SpeechRecognitionEngine

我试图从TCP套接字在C#中进行“流式”语音识别。 我遇到的问题是SpeechRecognitionEngine.SetInputToAudioStream()似乎需要一个可以寻找的定义长度的Stream。 现在,我能想到的唯一方法就是在更多输入进来时在MemoryStream上重复运行识别器。 这里有一些代码来说明: SpeechRecognitionEngine appRecognizer = new SpeechRecognitionEngine(); System.Speech.AudioFormat.SpeechAudioFormatInfo formatInfo = new System.Speech.AudioFormat.SpeechAudioFormatInfo(8000, System.Speech.AudioFormat.AudioBitsPerSample.Sixteen, System.Speech.AudioFormat.AudioChannel.Mono); NetworkStream stream = new NetworkStream(socket,true); appRecognizer.SetInputToAudioStream(stream, formatInfo); // At the line above a “NotSupportedException” complaining that “This stream does not support seek operations.” 有谁知道怎么解决这个问题? 它必须支持某种流输入,因为它使用SetInputToDefaultAudioDevice()与麦克风一起正常工作。 谢谢,肖恩

如何在c#中使用谷歌语音识别api?

我想从c#获取音频文件并发送到谷歌语音识别API以获得“语音到文本”的答案。 我的代码是这样的: try { byte[] BA_AudioFile = GetFile(filename); HttpWebRequest _HWR_SpeechToText = null; _HWR_SpeechToText = (HttpWebRequest)HttpWebRequest.Create( “https://www.google.com/speech-api/v2/recognize?output=json&lang=” + DEFAULT_LANGUAGE + “&key=” + key); _HWR_SpeechToText.Credentials = CredentialCache.DefaultCredentials; _HWR_SpeechToText.Method = “POST”; _HWR_SpeechToText.ContentType = “audio/x-flac; rate=44100”; _HWR_SpeechToText.ContentLength = BA_AudioFile.Length; Stream stream = _HWR_SpeechToText.GetRequestStream(); stream.Write(BA_AudioFile, 0, BA_AudioFile.Length); stream.Close(); HttpWebResponse HWR_Response = (HttpWebResponse)_HWR_SpeechToText.GetResponse(); if (HWR_Response.StatusCode == HttpStatusCode.OK) { StreamReader SR_Response = […]