speechflow 1.4.3 → 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.
Files changed (106) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +3 -3
  3. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.d.ts +13 -0
  4. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js +153 -0
  5. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js.map +1 -0
  6. package/speechflow-cli/dst/speechflow-node-a2a-gender.d.ts +20 -0
  7. package/speechflow-cli/dst/speechflow-node-a2a-gender.js +349 -0
  8. package/speechflow-cli/dst/speechflow-node-a2a-gender.js.map +1 -0
  9. package/speechflow-cli/dst/speechflow-node-a2a-meter.d.ts +16 -0
  10. package/speechflow-cli/dst/speechflow-node-a2a-meter.js +232 -0
  11. package/speechflow-cli/dst/speechflow-node-a2a-meter.js.map +1 -0
  12. package/speechflow-cli/dst/speechflow-node-a2a-mute.d.ts +17 -0
  13. package/speechflow-cli/dst/speechflow-node-a2a-mute.js +117 -0
  14. package/speechflow-cli/dst/speechflow-node-a2a-mute.js.map +1 -0
  15. package/speechflow-cli/dst/speechflow-node-a2a-vad.d.ts +19 -0
  16. package/speechflow-cli/dst/speechflow-node-a2a-vad.js +374 -0
  17. package/speechflow-cli/dst/speechflow-node-a2a-vad.js.map +1 -0
  18. package/speechflow-cli/dst/speechflow-node-a2a-wav.d.ts +11 -0
  19. package/speechflow-cli/dst/speechflow-node-a2a-wav.js +211 -0
  20. package/speechflow-cli/dst/speechflow-node-a2a-wav.js.map +1 -0
  21. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.d.ts +19 -0
  22. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js +328 -0
  23. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js.map +1 -0
  24. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.d.ts +18 -0
  25. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js +238 -0
  26. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js.map +1 -0
  27. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.d.ts +14 -0
  28. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js +155 -0
  29. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js.map +1 -0
  30. package/speechflow-cli/dst/speechflow-node-t2t-deepl.d.ts +15 -0
  31. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js +146 -0
  32. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js.map +1 -0
  33. package/speechflow-cli/dst/speechflow-node-t2t-format.d.ts +11 -0
  34. package/speechflow-cli/dst/speechflow-node-t2t-format.js +82 -0
  35. package/speechflow-cli/dst/speechflow-node-t2t-format.js.map +1 -0
  36. package/speechflow-cli/dst/speechflow-node-t2t-ollama.d.ts +13 -0
  37. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js +247 -0
  38. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js.map +1 -0
  39. package/speechflow-cli/dst/speechflow-node-t2t-openai.d.ts +13 -0
  40. package/speechflow-cli/dst/speechflow-node-t2t-openai.js +227 -0
  41. package/speechflow-cli/dst/speechflow-node-t2t-openai.js.map +1 -0
  42. package/speechflow-cli/dst/speechflow-node-t2t-sentence.d.ts +17 -0
  43. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js +250 -0
  44. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js.map +1 -0
  45. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.d.ts +13 -0
  46. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js +278 -0
  47. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js.map +1 -0
  48. package/speechflow-cli/dst/speechflow-node-t2t-transformers.d.ts +14 -0
  49. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js +265 -0
  50. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js.map +1 -0
  51. package/speechflow-cli/dst/speechflow-node-x2x-filter.d.ts +11 -0
  52. package/speechflow-cli/dst/speechflow-node-x2x-filter.js +121 -0
  53. package/speechflow-cli/dst/speechflow-node-x2x-filter.js.map +1 -0
  54. package/speechflow-cli/dst/speechflow-node-x2x-trace.d.ts +11 -0
  55. package/speechflow-cli/dst/speechflow-node-x2x-trace.js +111 -0
  56. package/speechflow-cli/dst/speechflow-node-x2x-trace.js.map +1 -0
  57. package/speechflow-cli/dst/speechflow-node-xio-device.d.ts +13 -0
  58. package/speechflow-cli/dst/speechflow-node-xio-device.js +230 -0
  59. package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -0
  60. package/speechflow-cli/dst/speechflow-node-xio-file.d.ts +11 -0
  61. package/speechflow-cli/dst/speechflow-node-xio-file.js +216 -0
  62. package/speechflow-cli/dst/speechflow-node-xio-file.js.map +1 -0
  63. package/speechflow-cli/dst/speechflow-node-xio-mqtt.d.ts +13 -0
  64. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js +188 -0
  65. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js.map +1 -0
  66. package/speechflow-cli/dst/speechflow-node-xio-websocket.d.ts +13 -0
  67. package/speechflow-cli/dst/speechflow-node-xio-websocket.js +278 -0
  68. package/speechflow-cli/dst/speechflow-node-xio-websocket.js.map +1 -0
  69. package/speechflow-cli/dst/speechflow-node.d.ts +65 -0
  70. package/speechflow-cli/dst/speechflow-node.js +180 -0
  71. package/speechflow-cli/dst/speechflow-node.js.map +1 -0
  72. package/speechflow-cli/dst/speechflow-utils.d.ts +74 -0
  73. package/speechflow-cli/dst/speechflow-utils.js +519 -0
  74. package/speechflow-cli/dst/speechflow-utils.js.map +1 -0
  75. package/speechflow-cli/dst/speechflow.d.ts +7 -0
  76. package/speechflow-cli/dst/speechflow.js +837 -0
  77. package/speechflow-cli/dst/speechflow.js.map +1 -0
  78. package/speechflow-cli/package.json +1 -1
  79. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.eot +0 -0
  80. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.ttf +0 -0
  81. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Bold.woff +0 -0
  82. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.eot +0 -0
  83. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.ttf +0 -0
  84. package/speechflow-ui-db/dst/app-font-TypoPRO-SourceSansPro-Regular.woff +0 -0
  85. package/speechflow-ui-db/dst/app-font-fa-brands-400.woff2 +0 -0
  86. package/speechflow-ui-db/dst/app-font-fa-regular-400.woff2 +0 -0
  87. package/speechflow-ui-db/dst/app-font-fa-solid-900.woff2 +0 -0
  88. package/speechflow-ui-db/dst/app-font-fa-v4compatibility.woff2 +0 -0
  89. package/speechflow-ui-db/dst/app-icon.svg +26 -0
  90. package/speechflow-ui-db/dst/index.css +5 -0
  91. package/speechflow-ui-db/dst/index.html +24 -0
  92. package/speechflow-ui-db/dst/index.js +616 -0
  93. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.eot +0 -0
  94. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.ttf +0 -0
  95. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Bold.woff +0 -0
  96. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.eot +0 -0
  97. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.ttf +0 -0
  98. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Regular.woff +0 -0
  99. package/speechflow-ui-st/dst/app-font-fa-brands-400.woff2 +0 -0
  100. package/speechflow-ui-st/dst/app-font-fa-regular-400.woff2 +0 -0
  101. package/speechflow-ui-st/dst/app-font-fa-solid-900.woff2 +0 -0
  102. package/speechflow-ui-st/dst/app-font-fa-v4compatibility.woff2 +0 -0
  103. package/speechflow-ui-st/dst/app-icon.svg +26 -0
  104. package/speechflow-ui-st/dst/index.css +5 -0
  105. package/speechflow-ui-st/dst/index.html +24 -0
  106. package/speechflow-ui-st/dst/index.js +610 -0
@@ -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,CAA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GAAG,IAAI,CAAA;QACtB,CAAC;QAED,4EAA4E;QAC5E,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAChC,IAAI,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
+ }
@@ -0,0 +1,211 @@
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
+ /* write WAV header */
16
+ const writeWavHeader = (length, options) => {
17
+ const audioFormat = options?.audioFormat ?? 0x001; /* PCM */
18
+ const channels = options?.channels ?? 1; /* mono */
19
+ const sampleRate = options?.sampleRate ?? 44100; /* 44KHz */
20
+ const bitDepth = options?.bitDepth ?? 16; /* 16-Bit */
21
+ const headerLength = 44;
22
+ const dataLength = length || (4294967295 - 100);
23
+ const fileSize = dataLength + headerLength;
24
+ const header = Buffer.alloc(headerLength);
25
+ const RIFF = Buffer.alloc(4, "RIFF");
26
+ const WAVE = Buffer.alloc(4, "WAVE");
27
+ const fmt = Buffer.alloc(4, "fmt ");
28
+ const data = Buffer.alloc(4, "data");
29
+ const byteRate = (sampleRate * channels * bitDepth) / 8;
30
+ const blockAlign = (channels * bitDepth) / 8;
31
+ let offset = 0;
32
+ RIFF.copy(header, offset);
33
+ offset += RIFF.length;
34
+ header.writeUInt32LE(fileSize - 8, offset);
35
+ offset += 4;
36
+ WAVE.copy(header, offset);
37
+ offset += WAVE.length;
38
+ fmt.copy(header, offset);
39
+ offset += fmt.length;
40
+ header.writeUInt32LE(16, offset);
41
+ offset += 4;
42
+ header.writeUInt16LE(audioFormat, offset);
43
+ offset += 2;
44
+ header.writeUInt16LE(channels, offset);
45
+ offset += 2;
46
+ header.writeUInt32LE(sampleRate, offset);
47
+ offset += 4;
48
+ header.writeUInt32LE(byteRate, offset);
49
+ offset += 4;
50
+ header.writeUInt16LE(blockAlign, offset);
51
+ offset += 2;
52
+ header.writeUInt16LE(bitDepth, offset);
53
+ offset += 2;
54
+ data.copy(header, offset);
55
+ offset += data.length;
56
+ header.writeUInt32LE(dataLength, offset);
57
+ offset += 4;
58
+ return header;
59
+ };
60
+ /* read WAV header */
61
+ const readWavHeader = (buffer) => {
62
+ let offset = 0;
63
+ const riffHead = buffer.subarray(offset, offset + 4).toString();
64
+ offset += 4;
65
+ const fileSize = buffer.readUInt32LE(offset);
66
+ offset += 4;
67
+ const waveHead = buffer.subarray(offset, offset + 4).toString();
68
+ offset += 4;
69
+ const fmtHead = buffer.subarray(offset, offset + 4).toString();
70
+ offset += 4;
71
+ const formatLength = buffer.readUInt32LE(offset);
72
+ offset += 4;
73
+ const audioFormat = buffer.readUInt16LE(offset);
74
+ offset += 2;
75
+ const channels = buffer.readUInt16LE(offset);
76
+ offset += 2;
77
+ const sampleRate = buffer.readUInt32LE(offset);
78
+ offset += 4;
79
+ const byteRate = buffer.readUInt32LE(offset);
80
+ offset += 4;
81
+ const blockAlign = buffer.readUInt16LE(offset);
82
+ offset += 2;
83
+ const bitDepth = buffer.readUInt16LE(offset);
84
+ offset += 2;
85
+ const data = buffer.subarray(offset, offset + 4).toString();
86
+ offset += 4;
87
+ const dataLength = buffer.readUInt32LE(offset);
88
+ offset += 4;
89
+ return {
90
+ riffHead, fileSize, waveHead, fmtHead, formatLength, audioFormat,
91
+ channels, sampleRate, byteRate, blockAlign, bitDepth, data, dataLength
92
+ };
93
+ };
94
+ /* SpeechFlow node for WAV format conversion */
95
+ class SpeechFlowNodeWAV extends speechflow_node_1.default {
96
+ /* declare official node name */
97
+ static name = "wav";
98
+ /* construct node */
99
+ constructor(id, cfg, opts, args) {
100
+ super(id, cfg, opts, args);
101
+ /* declare node configuration parameters */
102
+ this.configure({
103
+ mode: { type: "string", pos: 1, val: "encode", match: /^(?:encode|decode)$/ }
104
+ });
105
+ /* declare node input/output format */
106
+ this.input = "audio";
107
+ this.output = "audio";
108
+ }
109
+ /* open node */
110
+ async open() {
111
+ /* establish a transform stream */
112
+ const self = this;
113
+ let firstChunk = true;
114
+ this.stream = new node_stream_1.default.Transform({
115
+ readableObjectMode: true,
116
+ writableObjectMode: true,
117
+ decodeStrings: false,
118
+ highWaterMark: 1,
119
+ transform(chunk, encoding, callback) {
120
+ if (!Buffer.isBuffer(chunk.payload)) {
121
+ callback(new Error("invalid chunk payload type"));
122
+ return;
123
+ }
124
+ else if (firstChunk) {
125
+ if (self.params.mode === "encode") {
126
+ /* convert raw/PCM to WAV/PCM
127
+ (NOTICE: as this is a continuous stream, the
128
+ resulting WAV header is not 100% conforming
129
+ to the WAV standard, as it has to use a zero
130
+ duration information. This cannot be changed in
131
+ a stream-based processing.) */
132
+ const headerBuffer = writeWavHeader(0, {
133
+ audioFormat: 0x0001 /* PCM */,
134
+ channels: self.config.audioChannels,
135
+ sampleRate: self.config.audioSampleRate,
136
+ bitDepth: self.config.audioBitDepth
137
+ });
138
+ const headerChunk = chunk.clone();
139
+ headerChunk.payload = headerBuffer;
140
+ this.push(headerChunk);
141
+ this.push(chunk);
142
+ callback();
143
+ }
144
+ else if (self.params.mode === "decode") {
145
+ /* convert WAV/PCM to raw/PCM */
146
+ if (chunk.payload.length < 44) {
147
+ callback(new Error("WAV header too short, expected at least 44 bytes"));
148
+ return;
149
+ }
150
+ const header = readWavHeader(chunk.payload);
151
+ self.log("info", "WAV audio stream: " +
152
+ `audioFormat=${header.audioFormat === 0x0001 ? "PCM" :
153
+ "0x" + header.audioFormat.toString(16).padStart(4, "0")} ` +
154
+ `channels=${header.channels} ` +
155
+ `sampleRate=${header.sampleRate} ` +
156
+ `bitDepth=${header.bitDepth}`);
157
+ if (header.audioFormat !== 0x0001 /* PCM */) {
158
+ callback(new Error("WAV not based on PCM format"));
159
+ return;
160
+ }
161
+ if (header.bitDepth !== self.config.audioBitDepth) {
162
+ callback(new Error(`WAV not based on ${self.config.audioBitDepth} bit samples`));
163
+ return;
164
+ }
165
+ if (header.sampleRate !== self.config.audioSampleRate) {
166
+ callback(new Error(`WAV not based on ${self.config.audioSampleRate}Hz sample rate`));
167
+ return;
168
+ }
169
+ if (header.channels !== self.config.audioChannels) {
170
+ callback(new Error(`WAV not based on ${self.config.audioChannels} channel(s)`));
171
+ return;
172
+ }
173
+ chunk.payload = chunk.payload.subarray(44);
174
+ this.push(chunk);
175
+ callback();
176
+ }
177
+ else {
178
+ callback(new Error(`invalid operation mode "${self.params.mode}"`));
179
+ return;
180
+ }
181
+ }
182
+ else {
183
+ /* pass-through original chunk */
184
+ this.push(chunk);
185
+ callback();
186
+ }
187
+ firstChunk = false;
188
+ },
189
+ final(callback) {
190
+ this.push(null);
191
+ callback();
192
+ }
193
+ });
194
+ }
195
+ /* close node */
196
+ async close() {
197
+ /* shutdown stream */
198
+ if (this.stream !== null) {
199
+ await new Promise((resolve) => {
200
+ if (this.stream instanceof node_stream_1.default.Duplex)
201
+ this.stream.end(() => { resolve(); });
202
+ else
203
+ resolve();
204
+ });
205
+ this.stream.destroy();
206
+ this.stream = null;
207
+ }
208
+ }
209
+ }
210
+ exports.default = SpeechFlowNodeWAV;
211
+ //# sourceMappingURL=speechflow-node-a2a-wav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speechflow-node-a2a-wav.js","sourceRoot":"","sources":["../src/speechflow-node-a2a-wav.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;AAEF,6BAA6B;AAC7B,8DAA0C;AAE1C,6BAA6B;AAC7B,wEAAmE;AAEnE,wBAAwB;AACxB,MAAM,cAAc,GAAG,CACnB,MAAc,EACd,OAA6F,EAC/F,EAAE;IACA,MAAM,WAAW,GAAI,OAAO,EAAE,WAAW,IAAI,KAAK,CAAA,CAAC,SAAS;IAC5D,MAAM,QAAQ,GAAO,OAAO,EAAE,QAAQ,IAAO,CAAC,CAAA,CAAK,UAAU;IAC7D,MAAM,UAAU,GAAK,OAAO,EAAE,UAAU,IAAK,KAAK,CAAA,CAAC,WAAW;IAC9D,MAAM,QAAQ,GAAO,OAAO,EAAE,QAAQ,IAAO,EAAE,CAAA,CAAI,YAAY;IAE/D,MAAM,YAAY,GAAG,EAA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;gBACX,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,uBAAuB;QACvB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAChC,IAAI,IAAI,CAAC,MAAM,YAAY,qBAAM,CAAC,MAAM;oBACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAA,CAAC,CAAC,CAAC,CAAA;;oBAEpC,OAAO,EAAE,CAAA;YACjB,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;IACL,CAAC;;AAtHL,oCAuHC"}
@@ -0,0 +1,19 @@
1
+ import SpeechFlowNode from "./speechflow-node";
2
+ export default class SpeechFlowNodeDeepgram extends SpeechFlowNode {
3
+ static name: string;
4
+ private dg;
5
+ private destroyed;
6
+ private initTimeout;
7
+ private connectionTimeout;
8
+ private queue;
9
+ constructor(id: string, cfg: {
10
+ [id: string]: any;
11
+ }, opts: {
12
+ [id: string]: any;
13
+ }, args: any[]);
14
+ status(): Promise<{
15
+ balance: string;
16
+ }>;
17
+ open(): Promise<void>;
18
+ close(): Promise<void>;
19
+ }