bumblebee-hotword
Advanced tools
Comparing version 0.0.9 to 0.1.0
@@ -123,3 +123,4 @@ const EventEmitter = require('events'); | ||
this.webWorkersPath+"/downsampling_worker.js", | ||
this.bufferSize); | ||
this.bufferSize, | ||
this.microphone); | ||
@@ -161,2 +162,23 @@ let keywordIDs = {}; | ||
} | ||
setMicrophone(id) { | ||
this.microphone = id; | ||
} | ||
async getMicrophones() { | ||
const deviceInfos = await navigator.mediaDevices.enumerateDevices(); | ||
const mics = []; | ||
for (let i = 0; i !== deviceInfos.length; ++i) { | ||
const deviceInfo = deviceInfos[i]; | ||
if (deviceInfo.kind === 'audioinput') { | ||
let id = deviceInfo.deviceId; | ||
let name = deviceInfo.label || 'microphone '+i; | ||
mics.push({ | ||
id, | ||
name | ||
}); | ||
} | ||
} | ||
return mics; | ||
} | ||
} | ||
@@ -163,0 +185,0 @@ |
@@ -1,2 +0,2 @@ | ||
const PorcupineManager = (function (webVoiceProcessor, porcupineWorkerScript, downsamplingScript, bufferSize) { | ||
const PorcupineManager = (function (webVoiceProcessor, porcupineWorkerScript, downsamplingScript, bufferSize, microphone) { | ||
let porcupineWorker; | ||
@@ -17,3 +17,3 @@ | ||
webVoiceProcessor.start([this], volume, downsamplingScript, errorCallback, audioProcessCallback, audioContextCallback, bufferSize); | ||
webVoiceProcessor.start([this], volume, downsamplingScript, errorCallback, audioProcessCallback, audioContextCallback, bufferSize, microphone); | ||
}; | ||
@@ -20,0 +20,0 @@ |
@@ -11,5 +11,10 @@ let downsampler; | ||
let start = function (engines, volume, downsamplerScript, errorCallback, audioProcessCallback, audioContextCallback, bufferSize) { | ||
let start = function (engines, volume, downsamplerScript, errorCallback, audioProcessCallback, audioContextCallback, bufferSize, microphone) { | ||
if (!downsampler) { | ||
navigator.mediaDevices.getUserMedia({audio: true}) | ||
const constraints = { | ||
audio: { | ||
deviceId: microphone ? {exact: microphone} : undefined | ||
} | ||
}; | ||
navigator.mediaDevices.getUserMedia(constraints) | ||
.then(stream => { | ||
@@ -16,0 +21,0 @@ |
{ | ||
"name": "bumblebee-hotword", | ||
"version": "0.0.9", | ||
"version": "0.1.0", | ||
"description": "A minimalist hotword / wake word for the web, based on Porcupine", | ||
@@ -5,0 +5,0 @@ "main": "lib/bumblebee.js", |
@@ -161,3 +161,3 @@  | ||
yarn install | ||
yarn run | ||
yarn start | ||
``` | ||
@@ -170,3 +170,3 @@ | ||
yarn install | ||
yarn run | ||
yarn start | ||
``` | ||
@@ -180,2 +180,6 @@ | ||
**0.1.0:** | ||
- add microphone selection | ||
**0.0.9:** | ||
@@ -182,0 +186,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
191622
2150
208
0