2013-03-22 73 views

回答

2

您可以使用Pocketsphinx API来处理任何二进制数据,包括从文件读取的二进制数据。您只需确保数据具有所需的格式。一旦将二进制数据读入short []类型的缓冲区中,就可以使用pocketsphinx API调用来处理它:

import edu.cmu.pocketsphinx.pocketsphinx;

Pocketsphinx ps = new Decoder(....) 
ps.processRaw(buf, buf.length, false, false); 

毕竟数据进行处理,可以检索结果

Hypothesis hyp = pocketsphinx.getHyp(); 
System.out.println(hyp.getHypstr()) 

欲了解更多详情,请参阅该Pocketsphinx part of the CMUSphinx tutorial

0

虽然有点晚了一天,希望它可能会有所帮助的人其他人正在寻找类似的要求。 看一看在特别SpeechRecognizer类下面的代码在Declaring AudioRecord object AudioRecord录音机=新AudioRecord( AudioSource.VOICE_RECOGNITION,采样率, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT,BUFFERSIZE * 2); 创建另一个类如SpeechRecognizer,您可以选择任何支持的音频源MediaRecord

相关问题