admin管理员组文章数量:1290938
I am wondering if it is possible to run the Web Speech API in node.js? Since node is Javascript based, I was assuming it could be used, but I can't find a way to use it natively in node. Would there be a way to "include" this Web Speech Library in a node.js script to use it?
Thank you
I am wondering if it is possible to run the Web Speech API in node.js? Since node is Javascript based, I was assuming it could be used, but I can't find a way to use it natively in node. Would there be a way to "include" this Web Speech Library in a node.js script to use it?
Thank you
Share Improve this question asked Feb 2, 2017 at 16:10 BobBob 3635 silver badges14 bronze badges 2- what are you trying to acplish? Who would be speaking to the server? Or are you considering a recorded wav of some sort? – akaphenom Commented Feb 2, 2017 at 16:16
- there is headless chrome now – Muhammad Umer Commented Dec 29, 2017 at 9:31
3 Answers
Reset to default 7While you can't use the WebSpeechAPI in Node (as it is a built in browser capability), you can use Google Cloud Speech or one of the many other cloud recognizers that have Node SDKs.
If you're looking for a super lightweight implementation that handles all of the audio encoding and supports offline hotword detection I would remend Sonus.
Disclaimer: this is my project
You can try WSNR npm module, but it requires running a chrome browser.
Demo.JS
angular.module('PubNubAngularApp', ["pubnub.angular.service"])
.controller('MySpeechCtrl', function($rootScope, $scope, Pubnub) {
$scope.theText = "Don't just stand there, say something!";
$scope.dictateIt = function () {
$scope.theText = "";
var recognition = new webkitSpeechRecognition();
recognition.onresult = function (event) {
$scope.$apply(function() {
for (var i = event.resultIndex; i < event.results.length; i++) {
if (event.results[i].isFinal) {
$scope.theText += event.results[i][0].transcript;
}
}
});
};
recognition.start();
};
});
Link to codepen.io demo
Here is the plete package for you.
本文标签: javascriptHow to use the Web Speech API in NodeJSStack Overflow
版权声明:本文标题:javascript - How to use the Web Speech API in NodeJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741517169a2382963.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论