Pocketsphinx.js JavaScript 语音识别 项目简介
Pocketsphinx.js 是一个在浏览器上通过纯 JavaScript 实现语音识别的功能,支持 Chrome 和 Firefox 浏览器。提供录音的功能。特性:100% 纯 JavaScript API,可通过 Web Workers 录制支持 PocketSphinx 所支持的所有声音模型支持大多数 PocketSphinx 的命令行参数支持 JavaScript 有限状态语法 FSG 输入支持在编译时的来自文件的统计语言模型支持键盘监测可用于实时识别的可选音频录制库示例代码:var array = ... // array that contains an audio buffer
var buffer = new Module.AudioBuffer();
for (var i = 0 ; i < array.length ; i++)
buffer.push_back(array[i]); // Feed the array with audio data
var output = recognizer.start(); // Starts recognition on current language model
output = recognizer.process(buffer); // Processes the buffer
var hyp = recognizer.getHyp(); // Gets the current recognized string (hypothesis)
/* ... */
for (var i = 0 ; i < array.length ; i++)
buffer.set(i, array[i]); // Feed buffer with new data
output = recognizer.process(buffer);
hyp = recognizer.getHyp();
/* ... */
output = recognizer.stop();
// Gets the final recognized string:
var final_hyp = recognizer.getHyp();
buffer.delete();在线演示:http://syl22-00.github.io/pocketsphinx.js/live-demo-chinese.html
var buffer = new Module.AudioBuffer();
for (var i = 0 ; i < array.length ; i++)
buffer.push_back(array[i]); // Feed the array with audio data
var output = recognizer.start(); // Starts recognition on current language model
output = recognizer.process(buffer); // Processes the buffer
var hyp = recognizer.getHyp(); // Gets the current recognized string (hypothesis)
/* ... */
for (var i = 0 ; i < array.length ; i++)
buffer.set(i, array[i]); // Feed buffer with new data
output = recognizer.process(buffer);
hyp = recognizer.getHyp();
/* ... */
output = recognizer.stop();
// Gets the final recognized string:
var final_hyp = recognizer.getHyp();
buffer.delete();在线演示:http://syl22-00.github.io/pocketsphinx.js/live-demo-chinese.html