Recognition名称空间的DTMF识别

Recognition名称空间的DTMF识别

本文介绍了带有Speech.Recognition名称空间的DTMF识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我正在尝试使DTMF识别正常工作.
我有一个wav文件,该文件的电话号码为1.重复6次,并记录在8K 16位线性PCM单通道中.没有识别结果Result = null).如果将模式"更改为SrgsGrammarMode.Voice,并将语法更改为"DictationGrammar",则可以得到一些随机识别. wav文件可以在媒体播放器中完美播放.
我在网上浏览了很多,找不到很多示例或帮助.希望这里的人有一些经验.
谢谢
吉姆
代码段:

Hello,
I''m trying to get DTMF Recognition to work.
I have a wav file that has a the number 1 recored from my phone. It''s repeated 6 times and is recorded in 8K 16 bit linear PCM single channel. No recognition occurs Result = null). If I change the Mode to SrgsGrammarMode.Voice and the grammar to DictationGrammar I do get some random recognition. The wav file plays perfectly in media player.
I''ve looked all over the web and can''t find much samples or help. Hopefully someone here has some experience.
thanks
Jim
Code snippet:

string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");
SrgsDocument document = null;
GrammarBuilder builder = null;
Grammar grammar = null;

Choices firstThree = new Choices(new string[] { "1", "2", "3" });
Choices nextThree = new Choices(new string[] { "4", "5", "6" });
Choices lastThree = new Choices(new string[] { "7", "8", "9" });

Choices keyPadChoices = new Choices(new GrammarBuilder[] { firstThree, nextThree, lastThree, new Choices("0") });

builder = new GrammarBuilder(keyPadChoices);
document = new SrgsDocument(builder);

document.Mode = SrgsGrammarMode.Dtmf;
grammar = new Grammar(document);

RecognitionEngine.SetInputToWaveFile(@"c:\111111.wav");
RecognitionEngine.LoadGrammar(grammar);
RecognitionResult Result = RecognitionEngine.Recognize();
if (null != Result)
{
StringBuilder Output = new StringBuilder();
foreach (RecognizedWordUnit Word in Result.Words)
{
	Output.Append(Word.Text + " ");
}

}

推荐答案


这篇关于带有Speech.Recognition名称空间的DTMF识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 01:43