@lumiastream/wakeword 1.0.1-alpha.7 → 1.0.1-alpha.8
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/bin/wakeword +1 -1
- package/lib/record.js +6 -5
- package/lib/recorders/arecord.js +1 -1
- package/lib/recorders/index.js +19 -14
- package/lib/recorders/rec.js +1 -1
- package/lib/recorders/sox.js +1 -1
- package/lib/{voice.mjs → voice.js} +3 -2
- package/package.json +3 -3
package/bin/wakeword
CHANGED
package/lib/record.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import assert from "assert";
|
|
4
|
+
import debug from "debug";
|
|
5
|
+
import { spawn } from "child_process";
|
|
6
|
+
import recorders from "./recorders/index.js";
|
|
7
7
|
|
|
8
8
|
class Recording {
|
|
9
9
|
constructor(options = {}) {
|
|
@@ -26,6 +26,7 @@ class Recording {
|
|
|
26
26
|
this.options = Object.assign(defaults, options);
|
|
27
27
|
|
|
28
28
|
const recorder = recorders.load(this.options.recorder);
|
|
29
|
+
console.log(recorder);
|
|
29
30
|
const { cmd, args, spawnOptions = {} } = recorder(this.options);
|
|
30
31
|
|
|
31
32
|
this.cmd = cmd;
|
|
@@ -114,6 +115,6 @@ Enable debugging with the environment variable DEBUG=record.`
|
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
|
|
118
|
+
export default {
|
|
118
119
|
record: (...args) => new Recording(...args),
|
|
119
120
|
};
|
package/lib/recorders/arecord.js
CHANGED
package/lib/recorders/index.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
// import { fileURLToPath } from "node:url";
|
|
2
|
+
// import path from "node:path";
|
|
3
|
+
// const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
|
+
import rec from "./sox.js";
|
|
2
5
|
|
|
3
|
-
function load
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
function load(recorderName) {
|
|
7
|
+
try {
|
|
8
|
+
// const recoderPath = path.resolve(__dirname, recorderName);
|
|
9
|
+
// const module = await import(recoderPath);
|
|
10
|
+
// return module.default;
|
|
11
|
+
return rec;
|
|
12
|
+
} catch (err) {
|
|
13
|
+
if (err.code === "MODULE_NOT_FOUND") {
|
|
14
|
+
throw new Error(`No such recorder found: ${recorderName}`);
|
|
15
|
+
}
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
throw err;
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
21
|
+
export default {
|
|
22
|
+
load,
|
|
23
|
+
};
|
package/lib/recorders/rec.js
CHANGED
package/lib/recorders/sox.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Model, Recognizer, setLogLevel } from "vosk";
|
|
2
|
-
import record from "./record";
|
|
1
|
+
import { Model, Recognizer, setLogLevel } from "vosk-koffi";
|
|
2
|
+
import record from "./record.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
5
5
|
const binPath = join(
|
|
@@ -14,6 +14,7 @@ const binPath = join(
|
|
|
14
14
|
console.log(binPath);
|
|
15
15
|
|
|
16
16
|
let COMMANDS = [
|
|
17
|
+
"blue",
|
|
17
18
|
"[unk]", // always keep an [unk] fallback!
|
|
18
19
|
];
|
|
19
20
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumiastream/wakeword",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.8",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "lib/voice.
|
|
5
|
+
"main": "lib/voice.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"wakeword": "bin/wakeword"
|
|
8
8
|
},
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
"postinstall": "chmod +x binaries/soxmac binaries/soxlinux binaries/sox.exe || true"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"vosk": "^
|
|
19
|
+
"vosk-koffi": "^1.1.1"
|
|
20
20
|
}
|
|
21
21
|
}
|