speechflow 1.4.2 → 1.4.4
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/CHANGELOG.md +19 -0
- package/etc/stx.conf +17 -11
- package/package.json +7 -4
- package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.d.ts +13 -0
- package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js +153 -0
- package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-a2a-gender.d.ts +20 -0
- package/speechflow-cli/dst/speechflow-node-a2a-gender.js +349 -0
- package/speechflow-cli/dst/speechflow-node-a2a-gender.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-a2a-meter.d.ts +16 -0
- package/speechflow-cli/dst/speechflow-node-a2a-meter.js +232 -0
- package/speechflow-cli/dst/speechflow-node-a2a-meter.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-a2a-mute.d.ts +17 -0
- package/speechflow-cli/dst/speechflow-node-a2a-mute.js +117 -0
- package/speechflow-cli/dst/speechflow-node-a2a-mute.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-a2a-vad.d.ts +19 -0
- package/speechflow-cli/dst/speechflow-node-a2a-vad.js +374 -0
- package/speechflow-cli/dst/speechflow-node-a2a-vad.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-a2a-wav.d.ts +11 -0
- package/speechflow-cli/dst/speechflow-node-a2a-wav.js +211 -0
- package/speechflow-cli/dst/speechflow-node-a2a-wav.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-a2t-deepgram.d.ts +19 -0
- package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js +328 -0
- package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.d.ts +18 -0
- package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js +238 -0
- package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2a-kokoro.d.ts +14 -0
- package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js +155 -0
- package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2t-deepl.d.ts +15 -0
- package/speechflow-cli/dst/speechflow-node-t2t-deepl.js +146 -0
- package/speechflow-cli/dst/speechflow-node-t2t-deepl.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2t-format.d.ts +11 -0
- package/speechflow-cli/dst/speechflow-node-t2t-format.js +82 -0
- package/speechflow-cli/dst/speechflow-node-t2t-format.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2t-ollama.d.ts +13 -0
- package/speechflow-cli/dst/speechflow-node-t2t-ollama.js +247 -0
- package/speechflow-cli/dst/speechflow-node-t2t-ollama.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2t-openai.d.ts +13 -0
- package/speechflow-cli/dst/speechflow-node-t2t-openai.js +227 -0
- package/speechflow-cli/dst/speechflow-node-t2t-openai.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2t-sentence.d.ts +17 -0
- package/speechflow-cli/dst/speechflow-node-t2t-sentence.js +250 -0
- package/speechflow-cli/dst/speechflow-node-t2t-sentence.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2t-subtitle.d.ts +13 -0
- package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js +278 -0
- package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-t2t-transformers.d.ts +14 -0
- package/speechflow-cli/dst/speechflow-node-t2t-transformers.js +265 -0
- package/speechflow-cli/dst/speechflow-node-t2t-transformers.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-x2x-filter.d.ts +11 -0
- package/speechflow-cli/dst/speechflow-node-x2x-filter.js +121 -0
- package/speechflow-cli/dst/speechflow-node-x2x-filter.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-x2x-trace.d.ts +11 -0
- package/speechflow-cli/dst/speechflow-node-x2x-trace.js +111 -0
- package/speechflow-cli/dst/speechflow-node-x2x-trace.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-xio-device.d.ts +13 -0
- package/speechflow-cli/dst/speechflow-node-xio-device.js +230 -0
- package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-xio-file.d.ts +11 -0
- package/speechflow-cli/dst/speechflow-node-xio-file.js +216 -0
- package/speechflow-cli/dst/speechflow-node-xio-file.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-xio-mqtt.d.ts +13 -0
- package/speechflow-cli/dst/speechflow-node-xio-mqtt.js +188 -0
- package/speechflow-cli/dst/speechflow-node-xio-mqtt.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node-xio-websocket.d.ts +13 -0
- package/speechflow-cli/dst/speechflow-node-xio-websocket.js +278 -0
- package/speechflow-cli/dst/speechflow-node-xio-websocket.js.map +1 -0
- package/speechflow-cli/dst/speechflow-node.d.ts +65 -0
- package/speechflow-cli/dst/speechflow-node.js +180 -0
- package/speechflow-cli/dst/speechflow-node.js.map +1 -0
- package/speechflow-cli/dst/speechflow-utils.d.ts +74 -0
- package/speechflow-cli/dst/speechflow-utils.js +519 -0
- package/speechflow-cli/dst/speechflow-utils.js.map +1 -0
- package/speechflow-cli/dst/speechflow.d.ts +7 -0
- package/speechflow-cli/dst/speechflow.js +837 -0
- package/speechflow-cli/dst/speechflow.js.map +1 -0
- package/speechflow-cli/etc/stx.conf +13 -13
- package/speechflow-cli/package.json +7 -7
- package/speechflow-cli/src/speechflow.ts +5 -5
- package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.eot +0 -0
- package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.ttf +0 -0
- package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.woff +0 -0
- package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.eot +0 -0
- package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.ttf +0 -0
- package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.woff +0 -0
- package/speechflow-ui-db/dst/app-font-fa-brands-400.woff2 +0 -0
- package/speechflow-ui-db/dst/app-font-fa-regular-400.woff2 +0 -0
- package/speechflow-ui-db/dst/app-font-fa-solid-900.woff2 +0 -0
- package/speechflow-ui-db/dst/app-font-fa-v4compatibility.woff2 +0 -0
- package/speechflow-ui-db/dst/app-icon.svg +26 -0
- package/speechflow-ui-db/dst/index.css +5 -0
- package/speechflow-ui-db/dst/index.html +24 -0
- package/speechflow-ui-db/dst/index.js +616 -0
- package/speechflow-ui-db/etc/stx.conf +17 -17
- package/speechflow-ui-db/package.json +2 -2
- package/speechflow-ui-db/src/app.vue +14 -7
- package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.eot +0 -0
- package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.ttf +0 -0
- package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.woff +0 -0
- package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.eot +0 -0
- package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.ttf +0 -0
- package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.woff +0 -0
- package/speechflow-ui-st/dst/app-font-fa-brands-400.woff2 +0 -0
- package/speechflow-ui-st/dst/app-font-fa-regular-400.woff2 +0 -0
- package/speechflow-ui-st/dst/app-font-fa-solid-900.woff2 +0 -0
- package/speechflow-ui-st/dst/app-font-fa-v4compatibility.woff2 +0 -0
- package/speechflow-ui-st/dst/app-icon.svg +26 -0
- package/speechflow-ui-st/dst/index.css +5 -0
- package/speechflow-ui-st/dst/index.html +24 -0
- package/speechflow-ui-st/dst/index.js +610 -0
- package/speechflow-ui-st/etc/stx.conf +17 -17
- package/speechflow-ui-st/package.json +2 -2
- /package/{speechflow-cli/etc → etc}/speechflow.yaml +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
** SpeechFlow - Speech Processing Flow Graph
|
|
4
|
+
** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
+
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
/* standard dependencies */
|
|
12
|
+
const node_stream_1 = __importDefault(require("node:stream"));
|
|
13
|
+
/* internal dependencies */
|
|
14
|
+
const speechflow_node_1 = __importDefault(require("./speechflow-node"));
|
|
15
|
+
/* SpeechFlow node for muting in audio-to-audio passing */
|
|
16
|
+
class SpeechFlowNodeMute extends speechflow_node_1.default {
|
|
17
|
+
/* declare official node name */
|
|
18
|
+
static name = "mute";
|
|
19
|
+
/* internal state */
|
|
20
|
+
muteMode = "none";
|
|
21
|
+
destroyed = false;
|
|
22
|
+
/* construct node */
|
|
23
|
+
constructor(id, cfg, opts, args) {
|
|
24
|
+
super(id, cfg, opts, args);
|
|
25
|
+
/* declare node configuration parameters */
|
|
26
|
+
this.configure({});
|
|
27
|
+
/* declare node input/output format */
|
|
28
|
+
this.input = "audio";
|
|
29
|
+
this.output = "audio";
|
|
30
|
+
}
|
|
31
|
+
/* receive external request */
|
|
32
|
+
async receiveRequest(params) {
|
|
33
|
+
if (this.destroyed)
|
|
34
|
+
throw new Error("mute: node already destroyed");
|
|
35
|
+
try {
|
|
36
|
+
if (params.length === 2 && params[0] === "mode") {
|
|
37
|
+
if (!params[1].match(/^(?:none|silenced|unplugged)$/))
|
|
38
|
+
throw new Error("mute: invalid mode argument in external request");
|
|
39
|
+
const muteMode = params[1];
|
|
40
|
+
this.setMuteMode(muteMode);
|
|
41
|
+
this.sendResponse(["mute", "mode", muteMode]);
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
throw new Error("mute: invalid arguments in external request");
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.log("error", `receive request error: ${error}`);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/* change mute mode */
|
|
52
|
+
setMuteMode(mode) {
|
|
53
|
+
if (this.destroyed) {
|
|
54
|
+
this.log("warning", "attempted to set mute mode on destroyed node");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.log("info", `setting mute mode to "${mode}"`);
|
|
58
|
+
this.muteMode = mode;
|
|
59
|
+
}
|
|
60
|
+
/* open node */
|
|
61
|
+
async open() {
|
|
62
|
+
/* clear destruction flag */
|
|
63
|
+
this.destroyed = false;
|
|
64
|
+
/* establish a transform stream */
|
|
65
|
+
const self = this;
|
|
66
|
+
this.stream = new node_stream_1.default.Transform({
|
|
67
|
+
readableObjectMode: true,
|
|
68
|
+
writableObjectMode: true,
|
|
69
|
+
decodeStrings: false,
|
|
70
|
+
transform(chunk, encoding, callback) {
|
|
71
|
+
if (self.destroyed) {
|
|
72
|
+
callback(new Error("stream already destroyed"));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!Buffer.isBuffer(chunk.payload))
|
|
76
|
+
callback(new Error("invalid chunk payload type"));
|
|
77
|
+
else if (self.muteMode === "unplugged")
|
|
78
|
+
/* pass-through nothing */
|
|
79
|
+
callback();
|
|
80
|
+
else if (self.muteMode === "silenced") {
|
|
81
|
+
/* pass-through a silenced chunk */
|
|
82
|
+
const chunkSilenced = chunk.clone();
|
|
83
|
+
chunkSilenced.meta.set("muted", true);
|
|
84
|
+
const buffer = chunkSilenced.payload;
|
|
85
|
+
buffer.fill(0);
|
|
86
|
+
this.push(chunkSilenced);
|
|
87
|
+
callback();
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
/* pass-through original chunk */
|
|
91
|
+
this.push(chunk);
|
|
92
|
+
callback();
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
final(callback) {
|
|
96
|
+
if (self.destroyed) {
|
|
97
|
+
callback();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.push(null);
|
|
101
|
+
callback();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/* close node */
|
|
106
|
+
async close() {
|
|
107
|
+
/* indicate destruction */
|
|
108
|
+
this.destroyed = true;
|
|
109
|
+
/* close stream */
|
|
110
|
+
if (this.stream !== null) {
|
|
111
|
+
this.stream.destroy();
|
|
112
|
+
this.stream = null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.default = SpeechFlowNodeMute;
|
|
117
|
+
//# sourceMappingURL=speechflow-node-a2a-mute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechflow-node-a2a-mute.js","sourceRoot":"","sources":["../src/speechflow-node-a2a-mute.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;AAEF,6BAA6B;AAC7B,8DAAgC;AAEhC,6BAA6B;AAC7B,wEAAmE;AAQnE,4DAA4D;AAC5D,MAAqB,kBAAmB,SAAQ,yBAAc;IAC1D,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAA;IAE3B,sBAAsB;IACd,QAAQ,GAAa,MAAM,CAAA;IAC3B,SAAS,GAAG,KAAK,CAAA;IAEzB,sBAAsB;IACtB,YAAa,EAAU,EAAE,GAA4B,EAAE,IAA6B,EAAE,IAAW;QAC7F,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAE1B,6CAA6C;QAC7C,IAAI,CAAC,SAAS,CAAC,EAAE,CAA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EAAE,CAAC;oBACjB,QAAQ,EAAE,CAAA;oBACV,OAAM;gBACV,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACf,QAAQ,EAAE,CAAA;YACd,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,KAAK;QACP,4BAA4B;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QAErB,oBAAoB;QACpB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;IACL,CAAC;;AA5GL,qCA6GC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import SpeechFlowNode from "./speechflow-node";
|
|
2
|
+
export default class SpeechFlowNodeVAD extends SpeechFlowNode {
|
|
3
|
+
static name: string;
|
|
4
|
+
private vad;
|
|
5
|
+
private queue;
|
|
6
|
+
private queueRecv;
|
|
7
|
+
private queueVAD;
|
|
8
|
+
private queueSend;
|
|
9
|
+
private destroyed;
|
|
10
|
+
private tailTimer;
|
|
11
|
+
private activeEventListeners;
|
|
12
|
+
constructor(id: string, cfg: {
|
|
13
|
+
[id: string]: any;
|
|
14
|
+
}, opts: {
|
|
15
|
+
[id: string]: any;
|
|
16
|
+
}, args: any[]);
|
|
17
|
+
open(): Promise<void>;
|
|
18
|
+
close(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
** SpeechFlow - Speech Processing Flow Graph
|
|
4
|
+
** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
+
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
/* standard dependencies */
|
|
45
|
+
const node_stream_1 = __importDefault(require("node:stream"));
|
|
46
|
+
/* external dependencies */
|
|
47
|
+
const vad_node_realtime_1 = require("@ericedouard/vad-node-realtime");
|
|
48
|
+
/* internal dependencies */
|
|
49
|
+
const speechflow_node_1 = __importDefault(require("./speechflow-node"));
|
|
50
|
+
const utils = __importStar(require("./speechflow-utils"));
|
|
51
|
+
/* SpeechFlow node for VAD speech-to-speech processing */
|
|
52
|
+
class SpeechFlowNodeVAD extends speechflow_node_1.default {
|
|
53
|
+
/* declare official node name */
|
|
54
|
+
static name = "vad";
|
|
55
|
+
/* internal state */
|
|
56
|
+
vad = null;
|
|
57
|
+
queue = new utils.Queue();
|
|
58
|
+
queueRecv = this.queue.pointerUse("recv");
|
|
59
|
+
queueVAD = this.queue.pointerUse("vad");
|
|
60
|
+
queueSend = this.queue.pointerUse("send");
|
|
61
|
+
destroyed = false;
|
|
62
|
+
tailTimer = null;
|
|
63
|
+
activeEventListeners = new Set();
|
|
64
|
+
/* construct node */
|
|
65
|
+
constructor(id, cfg, opts, args) {
|
|
66
|
+
super(id, cfg, opts, args);
|
|
67
|
+
/* declare node configuration parameters */
|
|
68
|
+
this.configure({
|
|
69
|
+
mode: { type: "string", val: "silenced", match: /^(?:silenced|unplugged)$/ },
|
|
70
|
+
posSpeechThreshold: { type: "number", val: 0.50 },
|
|
71
|
+
negSpeechThreshold: { type: "number", val: 0.35 },
|
|
72
|
+
minSpeechFrames: { type: "number", val: 2 },
|
|
73
|
+
redemptionFrames: { type: "number", val: 12 },
|
|
74
|
+
preSpeechPadFrames: { type: "number", val: 1 },
|
|
75
|
+
postSpeechTail: { type: "number", val: 1500 }
|
|
76
|
+
});
|
|
77
|
+
/* declare node input/output format */
|
|
78
|
+
this.input = "audio";
|
|
79
|
+
this.output = "audio";
|
|
80
|
+
}
|
|
81
|
+
/* open node */
|
|
82
|
+
async open() {
|
|
83
|
+
/* sanity check situation */
|
|
84
|
+
if (this.config.audioBitDepth !== 16 || !this.config.audioLittleEndian)
|
|
85
|
+
throw new Error("VAD node currently supports PCM-S16LE audio only");
|
|
86
|
+
/* clear destruction flag */
|
|
87
|
+
this.destroyed = false;
|
|
88
|
+
/* internal processing constants */
|
|
89
|
+
const vadSampleRateTarget = 16000; /* internal target of VAD */
|
|
90
|
+
const vadSamplesPerFrame = 512; /* required for VAD v5 */
|
|
91
|
+
/* helper function for timer cleanup */
|
|
92
|
+
const clearTailTimer = () => {
|
|
93
|
+
if (this.tailTimer !== null) {
|
|
94
|
+
clearTimeout(this.tailTimer);
|
|
95
|
+
this.tailTimer = null;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
/* establish Voice Activity Detection (VAD) facility */
|
|
99
|
+
let tail = false;
|
|
100
|
+
try {
|
|
101
|
+
this.vad = await vad_node_realtime_1.RealTimeVAD.new({
|
|
102
|
+
model: "v5",
|
|
103
|
+
sampleRate: this.config.audioSampleRate, /* before resampling to 16KHz */
|
|
104
|
+
frameSamples: vadSamplesPerFrame, /* after resampling to 16KHz */
|
|
105
|
+
positiveSpeechThreshold: this.params.posSpeechThreshold,
|
|
106
|
+
negativeSpeechThreshold: this.params.negSpeechThreshold,
|
|
107
|
+
minSpeechFrames: this.params.minSpeechFrames,
|
|
108
|
+
redemptionFrames: this.params.redemptionFrames,
|
|
109
|
+
preSpeechPadFrames: this.params.preSpeechPadFrames,
|
|
110
|
+
onSpeechStart: () => {
|
|
111
|
+
if (this.destroyed)
|
|
112
|
+
return;
|
|
113
|
+
this.log("info", "VAD: speech start");
|
|
114
|
+
if (this.params.mode === "unplugged") {
|
|
115
|
+
tail = false;
|
|
116
|
+
clearTailTimer();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
onSpeechEnd: (audio) => {
|
|
120
|
+
if (this.destroyed)
|
|
121
|
+
return;
|
|
122
|
+
const duration = utils.audioArrayDuration(audio, vadSampleRateTarget);
|
|
123
|
+
this.log("info", `VAD: speech end (duration: ${duration.toFixed(2)}s)`);
|
|
124
|
+
if (this.params.mode === "unplugged") {
|
|
125
|
+
tail = true;
|
|
126
|
+
clearTailTimer();
|
|
127
|
+
this.tailTimer = setTimeout(() => {
|
|
128
|
+
if (this.destroyed || this.tailTimer === null)
|
|
129
|
+
return;
|
|
130
|
+
tail = false;
|
|
131
|
+
this.tailTimer = null;
|
|
132
|
+
}, this.params.postSpeechTail);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
onVADMisfire: () => {
|
|
136
|
+
if (this.destroyed)
|
|
137
|
+
return;
|
|
138
|
+
this.log("info", "VAD: speech end (segment too short)");
|
|
139
|
+
if (this.params.mode === "unplugged") {
|
|
140
|
+
tail = true;
|
|
141
|
+
clearTailTimer();
|
|
142
|
+
this.tailTimer = setTimeout(() => {
|
|
143
|
+
if (this.destroyed || this.tailTimer === null)
|
|
144
|
+
return;
|
|
145
|
+
tail = false;
|
|
146
|
+
this.tailTimer = null;
|
|
147
|
+
}, this.params.postSpeechTail);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
onFrameProcessed: (audio) => {
|
|
151
|
+
if (this.destroyed)
|
|
152
|
+
return;
|
|
153
|
+
try {
|
|
154
|
+
/* annotate the current audio segment */
|
|
155
|
+
const element = this.queueVAD.peek();
|
|
156
|
+
if (element === undefined || element.type !== "audio-frame")
|
|
157
|
+
throw new Error("internal error which cannot happen: no more queued element");
|
|
158
|
+
if (element.segmentIdx >= element.segmentData.length)
|
|
159
|
+
throw new Error("segment index out of bounds");
|
|
160
|
+
const segment = element.segmentData[element.segmentIdx++];
|
|
161
|
+
segment.isSpeech = (audio.isSpeech > audio.notSpeech) || tail;
|
|
162
|
+
/* annotate the entire audio chunk */
|
|
163
|
+
if (element.segmentIdx >= element.segmentData.length) {
|
|
164
|
+
element.isSpeech = element.segmentData.some(segment => segment.isSpeech);
|
|
165
|
+
this.queueVAD.touch();
|
|
166
|
+
this.queueVAD.walk(+1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
this.log("error", `VAD frame processing error: ${error}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
this.vad.start();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
throw new Error(`failed to initialize VAD: ${error}`);
|
|
178
|
+
}
|
|
179
|
+
/* provide Duplex stream and internally attach to VAD */
|
|
180
|
+
const self = this;
|
|
181
|
+
this.stream = new node_stream_1.default.Duplex({
|
|
182
|
+
writableObjectMode: true,
|
|
183
|
+
readableObjectMode: true,
|
|
184
|
+
decodeStrings: false,
|
|
185
|
+
highWaterMark: 1,
|
|
186
|
+
/* receive audio chunk (writable side of stream) */
|
|
187
|
+
write(chunk, encoding, callback) {
|
|
188
|
+
if (self.destroyed) {
|
|
189
|
+
callback(new Error("stream already destroyed"));
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (!Buffer.isBuffer(chunk.payload))
|
|
193
|
+
callback(new Error("expected audio input as Buffer chunks"));
|
|
194
|
+
else if (chunk.payload.byteLength === 0)
|
|
195
|
+
callback();
|
|
196
|
+
else {
|
|
197
|
+
try {
|
|
198
|
+
/* convert audio samples from PCM/I16 to PCM/F32 */
|
|
199
|
+
const data = utils.convertBufToF32(chunk.payload, self.config.audioLittleEndian);
|
|
200
|
+
/* segment audio samples as individual VAD-sized frames */
|
|
201
|
+
const segmentData = [];
|
|
202
|
+
const chunkSize = vadSamplesPerFrame *
|
|
203
|
+
(self.config.audioSampleRate / vadSampleRateTarget);
|
|
204
|
+
const chunks = Math.trunc(data.length / chunkSize);
|
|
205
|
+
for (let i = 0; i < chunks; i++) {
|
|
206
|
+
const frame = data.slice(i * chunkSize, (i + 1) * chunkSize);
|
|
207
|
+
const segment = { data: frame };
|
|
208
|
+
segmentData.push(segment);
|
|
209
|
+
}
|
|
210
|
+
if ((chunks * chunkSize) < data.length) {
|
|
211
|
+
const frame = new Float32Array(chunkSize);
|
|
212
|
+
frame.fill(0);
|
|
213
|
+
frame.set(data.slice(chunks * chunkSize, data.length));
|
|
214
|
+
const segment = { data: frame };
|
|
215
|
+
segmentData.push(segment);
|
|
216
|
+
}
|
|
217
|
+
/* queue the results */
|
|
218
|
+
self.queueRecv.append({
|
|
219
|
+
type: "audio-frame", chunk,
|
|
220
|
+
segmentIdx: 0, segmentData
|
|
221
|
+
});
|
|
222
|
+
/* push segments through Voice Activity Detection (VAD) */
|
|
223
|
+
if (self.vad && !self.destroyed) {
|
|
224
|
+
try {
|
|
225
|
+
for (const segment of segmentData)
|
|
226
|
+
self.vad.processAudio(segment.data);
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
self.log("error", `VAD processAudio error: ${error}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
callback();
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
callback(error instanceof Error ? error : new Error("VAD processing failed"));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
/* receive no more audio chunks (writable side of stream) */
|
|
240
|
+
final(callback) {
|
|
241
|
+
if (self.destroyed) {
|
|
242
|
+
callback();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
/* signal end of file */
|
|
246
|
+
self.queueRecv.append({ type: "audio-eof" });
|
|
247
|
+
callback();
|
|
248
|
+
},
|
|
249
|
+
/* send audio chunk(s) (readable side of stream) */
|
|
250
|
+
read(_size) {
|
|
251
|
+
if (self.destroyed) {
|
|
252
|
+
this.push(null);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
/* try to perform read operation from scratch */
|
|
256
|
+
const tryToRead = () => {
|
|
257
|
+
if (self.destroyed) {
|
|
258
|
+
this.push(null);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
/* flush pending audio chunks */
|
|
262
|
+
const flushPendingChunks = () => {
|
|
263
|
+
let pushed = 0;
|
|
264
|
+
while (true) {
|
|
265
|
+
if (self.destroyed) {
|
|
266
|
+
this.push(null);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const element = self.queueSend.peek();
|
|
270
|
+
if (element === undefined)
|
|
271
|
+
break;
|
|
272
|
+
else if (element.type === "audio-eof") {
|
|
273
|
+
this.push(null);
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
else if (element.type === "audio-frame"
|
|
277
|
+
&& element.isSpeech === undefined)
|
|
278
|
+
break;
|
|
279
|
+
self.queueSend.walk(+1);
|
|
280
|
+
self.queue.trim();
|
|
281
|
+
if (element.isSpeech) {
|
|
282
|
+
this.push(element.chunk);
|
|
283
|
+
pushed++;
|
|
284
|
+
}
|
|
285
|
+
else if (self.params.mode === "silenced") {
|
|
286
|
+
const chunk = element.chunk.clone();
|
|
287
|
+
const buffer = chunk.payload;
|
|
288
|
+
buffer.fill(0);
|
|
289
|
+
this.push(chunk);
|
|
290
|
+
pushed++;
|
|
291
|
+
}
|
|
292
|
+
else if (self.params.mode === "unplugged" && pushed === 0) {
|
|
293
|
+
/* we have to await chunks now, as in unplugged
|
|
294
|
+
mode we else would be never called again until
|
|
295
|
+
we at least once push a new chunk as the result */
|
|
296
|
+
setTimeout(() => {
|
|
297
|
+
if (self.destroyed)
|
|
298
|
+
return;
|
|
299
|
+
tryToRead();
|
|
300
|
+
}, 0);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
/* await forthcoming audio chunks */
|
|
306
|
+
const awaitForthcomingChunks = () => {
|
|
307
|
+
if (self.destroyed)
|
|
308
|
+
return;
|
|
309
|
+
const element = self.queueSend.peek();
|
|
310
|
+
if (element !== undefined
|
|
311
|
+
&& element.type === "audio-frame"
|
|
312
|
+
&& element.isSpeech !== undefined)
|
|
313
|
+
flushPendingChunks();
|
|
314
|
+
else if (!self.destroyed) {
|
|
315
|
+
self.queue.once("write", awaitForthcomingChunks);
|
|
316
|
+
self.activeEventListeners.add(awaitForthcomingChunks);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const element = self.queueSend.peek();
|
|
320
|
+
if (element !== undefined && element.type === "audio-eof")
|
|
321
|
+
this.push(null);
|
|
322
|
+
else if (element !== undefined
|
|
323
|
+
&& element.type === "audio-frame"
|
|
324
|
+
&& element.isSpeech !== undefined)
|
|
325
|
+
flushPendingChunks();
|
|
326
|
+
else if (!self.destroyed) {
|
|
327
|
+
self.queue.once("write", awaitForthcomingChunks);
|
|
328
|
+
self.activeEventListeners.add(awaitForthcomingChunks);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
tryToRead();
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/* close node */
|
|
336
|
+
async close() {
|
|
337
|
+
/* indicate destruction */
|
|
338
|
+
this.destroyed = true;
|
|
339
|
+
/* cleanup tail timer */
|
|
340
|
+
if (this.tailTimer !== null) {
|
|
341
|
+
clearTimeout(this.tailTimer);
|
|
342
|
+
this.tailTimer = null;
|
|
343
|
+
}
|
|
344
|
+
/* remove all event listeners */
|
|
345
|
+
this.activeEventListeners.forEach((listener) => {
|
|
346
|
+
this.queue.removeListener("write", listener);
|
|
347
|
+
});
|
|
348
|
+
this.activeEventListeners.clear();
|
|
349
|
+
/* close stream */
|
|
350
|
+
if (this.stream !== null) {
|
|
351
|
+
this.stream.destroy();
|
|
352
|
+
this.stream = null;
|
|
353
|
+
}
|
|
354
|
+
/* cleanup queue pointers before closing VAD to prevent callback access */
|
|
355
|
+
this.queue.pointerDelete("recv");
|
|
356
|
+
this.queue.pointerDelete("vad");
|
|
357
|
+
this.queue.pointerDelete("send");
|
|
358
|
+
/* close VAD */
|
|
359
|
+
if (this.vad !== null) {
|
|
360
|
+
try {
|
|
361
|
+
const flushPromise = this.vad.flush();
|
|
362
|
+
const timeoutPromise = new Promise((resolve) => setTimeout(resolve, 5000));
|
|
363
|
+
await Promise.race([flushPromise, timeoutPromise]);
|
|
364
|
+
}
|
|
365
|
+
catch (error) {
|
|
366
|
+
this.log("warning", `VAD flush error during close: ${error}`);
|
|
367
|
+
}
|
|
368
|
+
this.vad.destroy();
|
|
369
|
+
this.vad = null;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
exports.default = SpeechFlowNodeVAD;
|
|
374
|
+
//# sourceMappingURL=speechflow-node-a2a-vad.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechflow-node-a2a-vad.js","sourceRoot":"","sources":["../src/speechflow-node-a2a-vad.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,8DAA4C;AAE5C,6BAA6B;AAC7B,sEAA+D;AAE/D,6BAA6B;AAC7B,wEAAmE;AACnE,0DAAoE;AAiBpE,2DAA2D;AAC3D,MAAqB,iBAAkB,SAAQ,yBAAc;IACzD,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,KAAK,CAAA;IAE1B,sBAAsB;IACd,GAAG,GAAuB,IAAI,CAAA;IAC9B,KAAK,GAAO,IAAI,KAAK,CAAC,KAAK,EAAqB,CAAA;IAChD,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACzC,QAAQ,GAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACxC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACzC,SAAS,GAAG,KAAK,CAAA;IACjB,SAAS,GAAyC,IAAI,CAAA;IACtD,oBAAoB,GAAG,IAAI,GAAG,EAAc,CAAA;IAEpD,sBAAsB;IACtB,YAAa,EAAU,EAAE,GAA4B,EAAE,IAA6B,EAAE,IAAW;QAC7F,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAE1B,6CAA6C;QAC7C,IAAI,CAAC,SAAS,CAAC;YACX,IAAI,EAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,E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AAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC/B,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAEhC,iBAAiB;QACjB,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC;gBACD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;gBACrC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3C,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;gBAC9B,MAAM,OAAO,CAAC,IAAI,CAAC,CAAE,YAAY,EAAE,cAAc,CAAE,CAAC,CAAA;YACxD,CAAC;YACD,OAAO,KAAK,EAAE,CAAC;gBACX,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,iCAAiC,KAAK,EAAE,CAAC,CAAA;YACjE,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;YAClB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAA;QACnB,CAAC;IACL,CAAC;;AA9VL,oCA+VC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import SpeechFlowNode from "./speechflow-node";
|
|
2
|
+
export default class SpeechFlowNodeWAV extends SpeechFlowNode {
|
|
3
|
+
static name: string;
|
|
4
|
+
constructor(id: string, cfg: {
|
|
5
|
+
[id: string]: any;
|
|
6
|
+
}, opts: {
|
|
7
|
+
[id: string]: any;
|
|
8
|
+
}, args: any[]);
|
|
9
|
+
open(): Promise<void>;
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
}
|