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是你的完整的包。