@lumiastream/wakeword 1.0.1-alpha.11 → 1.0.1-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/recorders/sox.js +3 -1
- package/lib/voice.js +6 -3
- package/package.json +1 -1
package/lib/recorders/sox.js
CHANGED
|
@@ -6,7 +6,6 @@ export default (options) => {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
let args = [
|
|
9
|
-
"--default-device",
|
|
10
9
|
"--no-show-progress", // show no progress
|
|
11
10
|
"--rate",
|
|
12
11
|
options.sampleRate, // sample rate
|
|
@@ -44,7 +43,10 @@ export default (options) => {
|
|
|
44
43
|
const spawnOptions = {};
|
|
45
44
|
|
|
46
45
|
if (options.device) {
|
|
46
|
+
args.unshift("-t", "waveaudio", options.device);
|
|
47
47
|
spawnOptions.env = { ...process.env, AUDIODEV: options.device };
|
|
48
|
+
} else {
|
|
49
|
+
args.unshift("--default-device");
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
return { cmd, args, spawnOptions };
|
package/lib/voice.js
CHANGED
|
@@ -58,9 +58,12 @@ let rec = new Recognizer({ model, sampleRate: SAMPLE_RATE, grammar: GRAMMAR });
|
|
|
58
58
|
/* ------------------------------------------------------------------ */
|
|
59
59
|
/* 4. Start the microphone */
|
|
60
60
|
/* ------------------------------------------------------------------ */
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
.
|
|
61
|
+
const recArgs = { sampleRate: SAMPLE_RATE, threshold: 0, binPath: soxPath };
|
|
62
|
+
if (process.platform === "win32") {
|
|
63
|
+
recArgs.device = "0";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const mic = record.record(recArgs).stream();
|
|
64
67
|
|
|
65
68
|
mic.on("data", (buf) => {
|
|
66
69
|
if (rec.acceptWaveform(buf)) {
|