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,250 @@
|
|
|
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 luxon_1 = require("luxon");
|
|
48
|
+
/* internal dependencies */
|
|
49
|
+
const speechflow_node_1 = __importDefault(require("./speechflow-node"));
|
|
50
|
+
const utils = __importStar(require("./speechflow-utils"));
|
|
51
|
+
/* SpeechFlow node for sentence splitting */
|
|
52
|
+
class SpeechFlowNodeSentence extends speechflow_node_1.default {
|
|
53
|
+
/* declare official node name */
|
|
54
|
+
static name = "sentence";
|
|
55
|
+
/* internal state */
|
|
56
|
+
queue = new utils.Queue();
|
|
57
|
+
queueRecv = this.queue.pointerUse("recv");
|
|
58
|
+
queueSplit = this.queue.pointerUse("split");
|
|
59
|
+
queueSend = this.queue.pointerUse("send");
|
|
60
|
+
destroyed = false;
|
|
61
|
+
workingOffTimer = null;
|
|
62
|
+
/* construct node */
|
|
63
|
+
constructor(id, cfg, opts, args) {
|
|
64
|
+
super(id, cfg, opts, args);
|
|
65
|
+
/* declare node configuration parameters */
|
|
66
|
+
this.configure({});
|
|
67
|
+
/* declare node input/output format */
|
|
68
|
+
this.input = "text";
|
|
69
|
+
this.output = "text";
|
|
70
|
+
}
|
|
71
|
+
/* open node */
|
|
72
|
+
async open() {
|
|
73
|
+
/* clear destruction flag */
|
|
74
|
+
this.destroyed = false;
|
|
75
|
+
/* work off queued audio frames */
|
|
76
|
+
let workingOff = false;
|
|
77
|
+
const workOffQueue = async () => {
|
|
78
|
+
if (this.destroyed)
|
|
79
|
+
return;
|
|
80
|
+
/* control working off round */
|
|
81
|
+
if (workingOff)
|
|
82
|
+
return;
|
|
83
|
+
workingOff = true;
|
|
84
|
+
if (this.workingOffTimer !== null) {
|
|
85
|
+
clearTimeout(this.workingOffTimer);
|
|
86
|
+
this.workingOffTimer = null;
|
|
87
|
+
}
|
|
88
|
+
this.queue.off("write", workOffQueue);
|
|
89
|
+
/* try to work off one or more chunks */
|
|
90
|
+
while (!this.destroyed) {
|
|
91
|
+
const element = this.queueSplit.peek();
|
|
92
|
+
if (element === undefined)
|
|
93
|
+
break;
|
|
94
|
+
if (element.type === "text-eof") {
|
|
95
|
+
this.queueSplit.walk(+1);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
const chunk = element.chunk;
|
|
99
|
+
const payload = chunk.payload;
|
|
100
|
+
const m = payload.match(/^((?:.|\r?\n)+?[.;?!])\s*((?:.|\r?\n)*)$/);
|
|
101
|
+
if (m !== null) {
|
|
102
|
+
/* contains a sentence */
|
|
103
|
+
const [, sentence, rest] = m;
|
|
104
|
+
if (rest !== "") {
|
|
105
|
+
/* contains more than a sentence */
|
|
106
|
+
const chunk2 = chunk.clone();
|
|
107
|
+
const duration = luxon_1.Duration.fromMillis(chunk.timestampEnd.minus(chunk.timestampStart).toMillis() *
|
|
108
|
+
(sentence.length / payload.length));
|
|
109
|
+
chunk2.timestampStart = chunk.timestampStart.plus(duration);
|
|
110
|
+
chunk.timestampEnd = chunk2.timestampStart;
|
|
111
|
+
chunk.payload = sentence;
|
|
112
|
+
chunk2.payload = rest;
|
|
113
|
+
element.complete = true;
|
|
114
|
+
this.queueSplit.touch();
|
|
115
|
+
this.queueSplit.walk(+1);
|
|
116
|
+
this.queueSplit.insert({ type: "text-frame", chunk: chunk2 });
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
/* contains just the sentence */
|
|
120
|
+
element.complete = true;
|
|
121
|
+
this.queueSplit.touch();
|
|
122
|
+
this.queueSplit.walk(+1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
/* contains less than a sentence */
|
|
127
|
+
const position = this.queueSplit.position();
|
|
128
|
+
if (position < this.queueSplit.maxPosition() - 1) {
|
|
129
|
+
/* merge into following chunk */
|
|
130
|
+
const element2 = this.queueSplit.peek(position + 1);
|
|
131
|
+
if (element2 === undefined)
|
|
132
|
+
break;
|
|
133
|
+
if (element2.type === "text-eof") {
|
|
134
|
+
element.complete = true;
|
|
135
|
+
this.queueSplit.touch();
|
|
136
|
+
this.queueSplit.walk(+1);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
element2.chunk.timestampStart = element.chunk.timestampStart;
|
|
140
|
+
element2.chunk.payload =
|
|
141
|
+
element.chunk.payload + " " +
|
|
142
|
+
element2.chunk.payload;
|
|
143
|
+
this.queueSplit.delete();
|
|
144
|
+
this.queueSplit.touch();
|
|
145
|
+
}
|
|
146
|
+
else
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/* re-initiate working off round (if still not destroyed) */
|
|
151
|
+
workingOff = false;
|
|
152
|
+
if (!this.destroyed) {
|
|
153
|
+
this.workingOffTimer = setTimeout(workOffQueue, 100);
|
|
154
|
+
this.queue.once("write", workOffQueue);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
this.queue.once("write", workOffQueue);
|
|
158
|
+
/* provide Duplex stream and internally attach to classifier */
|
|
159
|
+
const self = this;
|
|
160
|
+
this.stream = new node_stream_1.default.Duplex({
|
|
161
|
+
writableObjectMode: true,
|
|
162
|
+
readableObjectMode: true,
|
|
163
|
+
decodeStrings: false,
|
|
164
|
+
highWaterMark: 1,
|
|
165
|
+
/* receive text chunk (writable side of stream) */
|
|
166
|
+
write(chunk, encoding, callback) {
|
|
167
|
+
if (self.destroyed)
|
|
168
|
+
callback(new Error("stream already destroyed"));
|
|
169
|
+
else if (Buffer.isBuffer(chunk.payload))
|
|
170
|
+
callback(new Error("expected text input as string chunks"));
|
|
171
|
+
else if (chunk.payload.length === 0)
|
|
172
|
+
callback();
|
|
173
|
+
else {
|
|
174
|
+
self.log("info", `received text: ${JSON.stringify(chunk.payload)}`);
|
|
175
|
+
self.queueRecv.append({ type: "text-frame", chunk });
|
|
176
|
+
callback();
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
/* receive no more text chunks (writable side of stream) */
|
|
180
|
+
final(callback) {
|
|
181
|
+
if (self.destroyed) {
|
|
182
|
+
callback();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
/* signal end of file */
|
|
186
|
+
self.queueRecv.append({ type: "text-eof" });
|
|
187
|
+
callback();
|
|
188
|
+
},
|
|
189
|
+
/* send text chunk(s) (readable side of stream) */
|
|
190
|
+
read(_size) {
|
|
191
|
+
/* flush pending text chunks */
|
|
192
|
+
const flushPendingChunks = () => {
|
|
193
|
+
if (self.destroyed) {
|
|
194
|
+
this.push(null);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const element = self.queueSend.peek();
|
|
198
|
+
if (element !== undefined
|
|
199
|
+
&& element.type === "text-eof") {
|
|
200
|
+
this.push(null);
|
|
201
|
+
self.queueSend.walk(+1);
|
|
202
|
+
}
|
|
203
|
+
else if (element !== undefined
|
|
204
|
+
&& element.type === "text-frame"
|
|
205
|
+
&& element.complete === true) {
|
|
206
|
+
while (true) {
|
|
207
|
+
const element = self.queueSend.peek();
|
|
208
|
+
if (element === undefined)
|
|
209
|
+
break;
|
|
210
|
+
else if (element.type === "text-eof") {
|
|
211
|
+
this.push(null);
|
|
212
|
+
self.queueSend.walk(+1);
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
else if (element.type === "text-frame"
|
|
216
|
+
&& element.complete !== true)
|
|
217
|
+
break;
|
|
218
|
+
self.log("info", `send text: ${JSON.stringify(element.chunk.payload)}`);
|
|
219
|
+
this.push(element.chunk);
|
|
220
|
+
self.queueSend.walk(+1);
|
|
221
|
+
self.queue.trim();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else if (!self.destroyed)
|
|
225
|
+
self.queue.once("write", flushPendingChunks);
|
|
226
|
+
};
|
|
227
|
+
flushPendingChunks();
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/* close node */
|
|
232
|
+
async close() {
|
|
233
|
+
/* indicate destruction */
|
|
234
|
+
this.destroyed = true;
|
|
235
|
+
/* clean up timer */
|
|
236
|
+
if (this.workingOffTimer !== null) {
|
|
237
|
+
clearTimeout(this.workingOffTimer);
|
|
238
|
+
this.workingOffTimer = null;
|
|
239
|
+
}
|
|
240
|
+
/* remove any pending event listeners */
|
|
241
|
+
this.queue.removeAllListeners("write");
|
|
242
|
+
/* close stream */
|
|
243
|
+
if (this.stream !== null) {
|
|
244
|
+
this.stream.destroy();
|
|
245
|
+
this.stream = null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
exports.default = SpeechFlowNodeSentence;
|
|
250
|
+
//# sourceMappingURL=speechflow-node-t2t-sentence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechflow-node-t2t-sentence.js","sourceRoot":"","sources":["../src/speechflow-node-t2t-sentence.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,8DAA4C;AAE5C,6BAA6B;AAC7B,iCAAsC;AAEtC,6BAA6B;AAC7B,wEAAmE;AACnE,0DAAoE;AAWpE,8CAA8C;AAC9C,MAAqB,sBAAuB,SAAQ,yBAAc;IAC9D,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,UAAU,CAAA;IAE/B,sBAAsB;IACd,KAAK,GAAQ,IAAI,KAAK,CAAC,KAAK,EAAoB,CAAA;IAChD,SAAS,GAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAA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extends SpeechFlowNode {
|
|
3
|
+
static name: string;
|
|
4
|
+
private sequenceNo;
|
|
5
|
+
private hapi;
|
|
6
|
+
constructor(id: string, cfg: {
|
|
7
|
+
[id: string]: any;
|
|
8
|
+
}, opts: {
|
|
9
|
+
[id: string]: any;
|
|
10
|
+
}, args: any[]);
|
|
11
|
+
open(): Promise<void>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
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_path_1 = __importDefault(require("node:path"));
|
|
46
|
+
const node_stream_1 = __importDefault(require("node:stream"));
|
|
47
|
+
/* external dependencies */
|
|
48
|
+
const luxon_1 = require("luxon");
|
|
49
|
+
const HAPI = __importStar(require("@hapi/hapi"));
|
|
50
|
+
const inert_1 = __importDefault(require("@hapi/inert"));
|
|
51
|
+
const hapi_plugin_websocket_1 = __importDefault(require("hapi-plugin-websocket"));
|
|
52
|
+
/* internal dependencies */
|
|
53
|
+
const speechflow_node_1 = __importStar(require("./speechflow-node"));
|
|
54
|
+
/* SpeechFlow node for subtitle (text-to-text) "translations" */
|
|
55
|
+
class SpeechFlowNodeSubtitle extends speechflow_node_1.default {
|
|
56
|
+
/* declare official node name */
|
|
57
|
+
static name = "subtitle";
|
|
58
|
+
/* internal state */
|
|
59
|
+
sequenceNo = 1;
|
|
60
|
+
hapi = null;
|
|
61
|
+
/* construct node */
|
|
62
|
+
constructor(id, cfg, opts, args) {
|
|
63
|
+
super(id, cfg, opts, args);
|
|
64
|
+
/* declare node configuration parameters */
|
|
65
|
+
this.configure({
|
|
66
|
+
format: { type: "string", pos: 0, val: "srt", match: /^(?:srt|vtt)$/ },
|
|
67
|
+
words: { type: "boolean", val: false },
|
|
68
|
+
mode: { type: "string", val: "export", match: /^(?:export|render)$/ },
|
|
69
|
+
addr: { type: "string", val: "127.0.0.1" },
|
|
70
|
+
port: { type: "number", val: 8585 }
|
|
71
|
+
});
|
|
72
|
+
/* declare node input/output format */
|
|
73
|
+
this.input = "text";
|
|
74
|
+
this.output = this.params.mode === "export" ? "text" : "none";
|
|
75
|
+
}
|
|
76
|
+
/* open node */
|
|
77
|
+
async open() {
|
|
78
|
+
if (this.params.mode === "export") {
|
|
79
|
+
this.sequenceNo = 1;
|
|
80
|
+
/* provide text-to-subtitle conversion */
|
|
81
|
+
const convert = async (chunk) => {
|
|
82
|
+
if (typeof chunk.payload !== "string")
|
|
83
|
+
throw new Error("chunk payload type must be string");
|
|
84
|
+
const convertSingle = (start, end, text, word, occurence) => {
|
|
85
|
+
if (word) {
|
|
86
|
+
occurence ??= 1;
|
|
87
|
+
let match = 1;
|
|
88
|
+
word = word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
89
|
+
text = text.replaceAll(new RegExp(`\\b${word}\\b`, "g"), (m) => {
|
|
90
|
+
if (match++ === occurence)
|
|
91
|
+
return `<b>${m}</b>`;
|
|
92
|
+
else
|
|
93
|
+
return m;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (this.params.format === "srt") {
|
|
97
|
+
const startFmt = start.toFormat("hh:mm:ss,SSS");
|
|
98
|
+
const endFmt = end.toFormat("hh:mm:ss,SSS");
|
|
99
|
+
text = `${this.sequenceNo++}\n` +
|
|
100
|
+
`${startFmt} --> ${endFmt}\n` +
|
|
101
|
+
`${text}\n\n`;
|
|
102
|
+
}
|
|
103
|
+
else if (this.params.format === "vtt") {
|
|
104
|
+
const startFmt = start.toFormat("hh:mm:ss.SSS");
|
|
105
|
+
const endFmt = end.toFormat("hh:mm:ss.SSS");
|
|
106
|
+
text = `${startFmt} --> ${endFmt}\n` +
|
|
107
|
+
`${text}\n\n`;
|
|
108
|
+
}
|
|
109
|
+
return text;
|
|
110
|
+
};
|
|
111
|
+
let output = "";
|
|
112
|
+
if (this.params.words) {
|
|
113
|
+
output += convertSingle(chunk.timestampStart, chunk.timestampEnd, chunk.payload);
|
|
114
|
+
const words = (chunk.meta.get("words") ?? []);
|
|
115
|
+
const occurences = new Map();
|
|
116
|
+
for (const word of words) {
|
|
117
|
+
let occurence = occurences.get(word.word) ?? 0;
|
|
118
|
+
occurence++;
|
|
119
|
+
occurences.set(word.word, occurence);
|
|
120
|
+
output += convertSingle(word.start, word.end, chunk.payload, word.word, occurence);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else
|
|
124
|
+
output += convertSingle(chunk.timestampStart, chunk.timestampEnd, chunk.payload);
|
|
125
|
+
return output;
|
|
126
|
+
};
|
|
127
|
+
/* establish a duplex stream */
|
|
128
|
+
const self = this;
|
|
129
|
+
let firstChunk = true;
|
|
130
|
+
this.stream = new node_stream_1.default.Transform({
|
|
131
|
+
readableObjectMode: true,
|
|
132
|
+
writableObjectMode: true,
|
|
133
|
+
decodeStrings: false,
|
|
134
|
+
highWaterMark: 1,
|
|
135
|
+
transform(chunk, encoding, callback) {
|
|
136
|
+
if (firstChunk && self.params.format === "vtt") {
|
|
137
|
+
this.push(new speechflow_node_1.SpeechFlowChunk(luxon_1.Duration.fromMillis(0), luxon_1.Duration.fromMillis(0), "final", "text", "WEBVTT\n\n"));
|
|
138
|
+
firstChunk = false;
|
|
139
|
+
}
|
|
140
|
+
if (Buffer.isBuffer(chunk.payload))
|
|
141
|
+
callback(new Error("invalid chunk payload type"));
|
|
142
|
+
else {
|
|
143
|
+
if (chunk.payload === "") {
|
|
144
|
+
this.push(chunk);
|
|
145
|
+
callback();
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
convert(chunk).then((payload) => {
|
|
149
|
+
const chunkNew = chunk.clone();
|
|
150
|
+
chunkNew.payload = payload;
|
|
151
|
+
this.push(chunkNew);
|
|
152
|
+
callback();
|
|
153
|
+
}).catch((err) => {
|
|
154
|
+
callback(err);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
final(callback) {
|
|
160
|
+
this.push(null);
|
|
161
|
+
callback();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else if (this.params.mode === "render") {
|
|
166
|
+
/* establish REST/WebSocket API */
|
|
167
|
+
const wsPeers = new Map();
|
|
168
|
+
this.hapi = new HAPI.Server({
|
|
169
|
+
address: this.params.addr,
|
|
170
|
+
port: this.params.port
|
|
171
|
+
});
|
|
172
|
+
await this.hapi.register({ plugin: inert_1.default });
|
|
173
|
+
await this.hapi.register({ plugin: hapi_plugin_websocket_1.default });
|
|
174
|
+
this.hapi.events.on({ name: "request", channels: ["error"] }, (request, event, tags) => {
|
|
175
|
+
if (event.error instanceof Error)
|
|
176
|
+
this.log("error", `HAPI: request-error: ${event.error.message}`);
|
|
177
|
+
else
|
|
178
|
+
this.log("error", `HAPI: request-error: ${event.error}`);
|
|
179
|
+
});
|
|
180
|
+
this.hapi.events.on("log", (event, tags) => {
|
|
181
|
+
if (tags.error) {
|
|
182
|
+
const err = event.error;
|
|
183
|
+
if (err instanceof Error)
|
|
184
|
+
this.log("error", `HAPI: log: ${err.message}`);
|
|
185
|
+
else
|
|
186
|
+
this.log("error", `HAPI: log: ${err}`);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
this.hapi.route({
|
|
190
|
+
method: "GET",
|
|
191
|
+
path: "/{param*}",
|
|
192
|
+
handler: {
|
|
193
|
+
directory: {
|
|
194
|
+
path: node_path_1.default.join(__dirname, "../../speechflow-ui-st/dst"),
|
|
195
|
+
redirectToSlash: true,
|
|
196
|
+
index: true
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
this.hapi.route({
|
|
201
|
+
method: "POST",
|
|
202
|
+
path: "/api",
|
|
203
|
+
options: {
|
|
204
|
+
payload: {
|
|
205
|
+
output: "data",
|
|
206
|
+
parse: true,
|
|
207
|
+
allow: "application/json"
|
|
208
|
+
},
|
|
209
|
+
plugins: {
|
|
210
|
+
websocket: {
|
|
211
|
+
autoping: 30 * 1000,
|
|
212
|
+
connect: (args) => {
|
|
213
|
+
const ctx = args.ctx;
|
|
214
|
+
const ws = args.ws;
|
|
215
|
+
const req = args.req;
|
|
216
|
+
const peer = `${req.socket.remoteAddress}:${req.socket.remotePort}`;
|
|
217
|
+
ctx.peer = peer;
|
|
218
|
+
wsPeers.set(peer, { ctx, ws, req });
|
|
219
|
+
this.log("info", `HAPI: WebSocket: connect: peer ${peer}`);
|
|
220
|
+
},
|
|
221
|
+
disconnect: (args) => {
|
|
222
|
+
const ctx = args.ctx;
|
|
223
|
+
const peer = ctx.peer;
|
|
224
|
+
wsPeers.delete(peer);
|
|
225
|
+
this.log("info", `HAPI: WebSocket: disconnect: peer ${peer}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
handler: (request, h) => {
|
|
231
|
+
return h.response({}).code(204);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
await this.hapi.start();
|
|
235
|
+
this.log("info", `HAPI: started REST/WebSocket network service: http://${this.params.addr}:${this.params.port}`);
|
|
236
|
+
const emit = (chunk) => {
|
|
237
|
+
const data = JSON.stringify(chunk);
|
|
238
|
+
for (const info of wsPeers.values())
|
|
239
|
+
info.ws.send(data);
|
|
240
|
+
};
|
|
241
|
+
this.stream = new node_stream_1.default.Writable({
|
|
242
|
+
objectMode: true,
|
|
243
|
+
decodeStrings: false,
|
|
244
|
+
highWaterMark: 1,
|
|
245
|
+
write(chunk, encoding, callback) {
|
|
246
|
+
if (Buffer.isBuffer(chunk.payload))
|
|
247
|
+
callback(new Error("invalid chunk payload type"));
|
|
248
|
+
else {
|
|
249
|
+
if (chunk.payload === "")
|
|
250
|
+
callback();
|
|
251
|
+
else {
|
|
252
|
+
emit(chunk);
|
|
253
|
+
callback();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
final(callback) {
|
|
258
|
+
callback();
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/* open node */
|
|
264
|
+
async close() {
|
|
265
|
+
/* close stream */
|
|
266
|
+
if (this.stream !== null) {
|
|
267
|
+
this.stream.destroy();
|
|
268
|
+
this.stream = null;
|
|
269
|
+
}
|
|
270
|
+
/* shutdown HAPI */
|
|
271
|
+
if (this.hapi !== null) {
|
|
272
|
+
await this.hapi.stop();
|
|
273
|
+
this.hapi = null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
exports.default = SpeechFlowNodeSubtitle;
|
|
278
|
+
//# sourceMappingURL=speechflow-node-t2t-subtitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechflow-node-t2t-subtitle.js","sourceRoot":"","sources":["../src/speechflow-node-t2t-subtitle.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,0DAAqC;AAErC,8DAAuC;AAEvC,6BAA6B;AAC7B,iCAAiC;AACjC,iDAAsC;AACtC,wDAAuC;AAEvC,kFAAiD;AAEjD,6BAA6B;AAC7B,qEAAmE;AAWnE,kEAAkE;AAClE,MAAqB,sBAAuB,SAAQ,yBAAc;IAC9D,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,UAAU,CAAA;IAE/B,sBAAsB;IACd,UAAU,GAAG,CAAC,CAAA;IACd,IAAI,GAAuB,IAAI,CAAA;IAEvC,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,IA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;IACjB,KAAK,CAAC,KAAK;QACP,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;QAED,qBAAqB;QACrB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;YACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QACpB,CAAC;IACL,CAAC;;AAnPL,yCAoPC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import SpeechFlowNode from "./speechflow-node";
|
|
2
|
+
export default class SpeechFlowNodeTransformers extends SpeechFlowNode {
|
|
3
|
+
static name: string;
|
|
4
|
+
private translator;
|
|
5
|
+
private generator;
|
|
6
|
+
private setup;
|
|
7
|
+
constructor(id: string, cfg: {
|
|
8
|
+
[id: string]: any;
|
|
9
|
+
}, opts: {
|
|
10
|
+
[id: string]: any;
|
|
11
|
+
}, args: any[]);
|
|
12
|
+
open(): Promise<void>;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|