From a6985f3e1f33909c91a10f6b06dea34fb7736e0b Mon Sep 17 00:00:00 2001 From: ad31c0 <78684321+ad31c0@users.noreply.github.com> Date: Mon, 24 May 2021 22:33:02 +0200 Subject: [PATCH] Revert "Add VAD platform capability through webrtcvad (#190)" (#209) This reverts commit 6ef72cb28a979abfe30efa118577eb977f486e00. --- config.js | 4 +++- main.js | 2 +- package-lock.json | 18 ------------------ package.json | 3 +-- service/platform/index.js | 40 --------------------------------------- 5 files changed, 5 insertions(+), 62 deletions(-) diff --git a/config.js b/config.js index f4c93150..f26b719a 100644 --- a/config.js +++ b/config.js @@ -78,4 +78,6 @@ module.exports.ENABLE_DB_ENCRYPTION = false; module.exports.SEMPRE_URL = process.env.THINGENGINE_NLP_URL || 'https://nlp-staging.almond.stanford.edu'; module.exports.THINGPEDIA_URL = process.env.THINGPEDIA_URL || 'https://dev.almond.stanford.edu/thingpedia'; module.exports.CLOUD_SYNC_URL = process.env.THINGENGINE_CLOUD_SYNC_URL || 'https://dev.almond.stanford.edu'; -module.exports.NL_URL = process.env.THINGENGINE_NL_URL || 'https://nlp-staging.almond.stanford.edu'; +module.exports.MS_SPEECH_RECOGNITION_PRIMARY_KEY = 'de1f02817356494483ba502b2ce95f6f'; +module.exports.MS_SPEECH_RECOGNITION_SECONDARY_KEY = '3dc6ce0b832940f0b0c984a1517c457e'; + diff --git a/main.js b/main.js index a81e669c..8ecc10eb 100644 --- a/main.js +++ b/main.js @@ -63,7 +63,7 @@ async function init(platform) { if (platform.hasCapability('sound')) { const speech = new Genie.SpeechHandler(conversation, platform, { - nlUrl: Config.NL_URL + subscriptionKey: Config.MS_SPEECH_RECOGNITION_PRIMARY_KEY }); let play; diff --git a/package-lock.json b/package-lock.json index 462f46ad..ec2e78cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6150,24 +6150,6 @@ "resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.5.tgz", "integrity": "sha1-eWkVhNmGB/UHC9O3CkDmuyLkAes=" }, - "webrtcvad": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/webrtcvad/-/webrtcvad-1.0.1.tgz", - "integrity": "sha512-oLfReCmGMpRducFWKP+o0GpKZLPj0u6qkln3P7wGaEzyjxtBiFuzvK28pmKF5SSihEkC1RGKO7Pi9C4VfY1q4Q==", - "optional": true, - "requires": { - "bindings": "^1.3.0", - "node-addon-api": "^1.7.1" - }, - "dependencies": { - "node-addon-api": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", - "optional": true - } - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index 63102fb3..64ecf6c9 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,7 @@ "optionalDependencies": { "canberra": "^0.1.2", "pulseaudio2": "^0.5.0", - "snowboy": "^1.3.1", - "webrtcvad": "^1.0.1" + "snowboy": "^1.3.1" }, "devDependencies": { "coveralls": "^3.1.0", diff --git a/service/platform/index.js b/service/platform/index.js index 90894cbf..1e7c6fcd 100644 --- a/service/platform/index.js +++ b/service/platform/index.js @@ -243,38 +243,6 @@ class SoundEffectsApi { } } -let webrtcvad; -try { - webrtcvad = require('webrtcvad').default; -} catch(e) { - console.log("VAD not available"); - webrtcvad = null; -} - -class VAD { - constructor() { - this._instance = null; - } - - setup(bitrate, level) { - if (this._instance) - this._instance = null; - - if (webrtcvad) { - this._instance = new webrtcvad(bitrate, level); - // console.log("setup VAD bitrate", bitrate, "level", level); - return true; - } - - return false; - } - - process(chunk) { - if (!this._instance) - return false; - return this._instance.process(chunk); - } -} class ServerPlatform extends Tp.BasePlatform { constructor() { @@ -292,7 +260,6 @@ class ServerPlatform extends Tp.BasePlatform { safeMkdirSync(this._cacheDir); this._wakeWordDetector = null; - this._voiceDetector = null; this._soundEffects = null; this._sqliteKey = null; @@ -350,9 +317,6 @@ class ServerPlatform extends Tp.BasePlatform { if (canberra) this._soundEffects = new SoundEffectsApi(); - - if (webrtcvad && VAD) - this._voiceDetector = new VAD(); } else { this._pulse = null; } @@ -409,8 +373,6 @@ class ServerPlatform extends Tp.BasePlatform { case 'wakeword-detector': this._ensurePulseAudio(); return this._wakeWordDetector !== null; - case 'voice-detector': - return this._voiceDetector !== null; case 'sound-effects': this._ensurePulseAudio(); @@ -438,8 +400,6 @@ class ServerPlatform extends Tp.BasePlatform { case 'wakeword-detector': this._ensurePulseAudio(); return this._wakeWordDetector; - case 'voice-detector': - return this._voiceDetector; case 'sound-effects': this._ensurePulseAudio(); return this._soundEffects;