3

我想知道是否可以在node.js中运行Web Speech API?由于节点是基于Javascript的,我假设它可以被使用,但是我找不到在节点中本地使用它的方法。有没有办法将这个Web语言库“包含”在node.js脚本中来使用它?如何在NodeJS中使用Web语音API

谢谢

+0

你想完成什么?谁会与服务器通话?或者你正在考虑某种录制的wav? – akaphenom

+0

现在有无头铬 –

回答

2

虽然你不能使用节点的WebSpeechAPI(因为它是一个内置的浏览器功能),你可以使用Google Cloud Speech或具有节点的SDK的许多其他云识别器之一。

如果您正在寻找处理所有音频编码并支持脱机热门词汇检测的超轻量级实现,我会推荐Sonus

免责声明:这是我的项目

0

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(); 
    }; 
}); 

链接codepen.io演示

Here是你的完整的包。