speechflow 1.4.5 → 1.5.0

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 (166) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +220 -7
  3. package/etc/claude.md +70 -0
  4. package/etc/speechflow.yaml +5 -3
  5. package/etc/stx.conf +7 -0
  6. package/package.json +7 -6
  7. package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.d.ts +1 -0
  8. package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js +155 -0
  9. package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js.map +1 -0
  10. package/speechflow-cli/dst/speechflow-node-a2a-compressor.d.ts +15 -0
  11. package/speechflow-cli/dst/speechflow-node-a2a-compressor.js +287 -0
  12. package/speechflow-cli/dst/speechflow-node-a2a-compressor.js.map +1 -0
  13. package/speechflow-cli/dst/speechflow-node-a2a-dynamics-wt.d.ts +1 -0
  14. package/speechflow-cli/dst/speechflow-node-a2a-dynamics-wt.js +208 -0
  15. package/speechflow-cli/dst/speechflow-node-a2a-dynamics-wt.js.map +1 -0
  16. package/speechflow-cli/dst/speechflow-node-a2a-dynamics.d.ts +15 -0
  17. package/speechflow-cli/dst/speechflow-node-a2a-dynamics.js +312 -0
  18. package/speechflow-cli/dst/speechflow-node-a2a-dynamics.js.map +1 -0
  19. package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.d.ts +1 -0
  20. package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js +161 -0
  21. package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js.map +1 -0
  22. package/speechflow-cli/dst/speechflow-node-a2a-expander.d.ts +13 -0
  23. package/speechflow-cli/dst/speechflow-node-a2a-expander.js +208 -0
  24. package/speechflow-cli/dst/speechflow-node-a2a-expander.js.map +1 -0
  25. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js +13 -3
  26. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js.map +1 -1
  27. package/speechflow-cli/dst/speechflow-node-a2a-filler.d.ts +14 -0
  28. package/speechflow-cli/dst/speechflow-node-a2a-filler.js +233 -0
  29. package/speechflow-cli/dst/speechflow-node-a2a-filler.js.map +1 -0
  30. package/speechflow-cli/dst/speechflow-node-a2a-gain.d.ts +12 -0
  31. package/speechflow-cli/dst/speechflow-node-a2a-gain.js +125 -0
  32. package/speechflow-cli/dst/speechflow-node-a2a-gain.js.map +1 -0
  33. package/speechflow-cli/dst/speechflow-node-a2a-gender.d.ts +0 -1
  34. package/speechflow-cli/dst/speechflow-node-a2a-gender.js +28 -12
  35. package/speechflow-cli/dst/speechflow-node-a2a-gender.js.map +1 -1
  36. package/speechflow-cli/dst/speechflow-node-a2a-meter.d.ts +1 -0
  37. package/speechflow-cli/dst/speechflow-node-a2a-meter.js +12 -8
  38. package/speechflow-cli/dst/speechflow-node-a2a-meter.js.map +1 -1
  39. package/speechflow-cli/dst/speechflow-node-a2a-mute.js +2 -1
  40. package/speechflow-cli/dst/speechflow-node-a2a-mute.js.map +1 -1
  41. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise-wt.d.ts +1 -0
  42. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise-wt.js +55 -0
  43. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise-wt.js.map +1 -0
  44. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.d.ts +14 -0
  45. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js +184 -0
  46. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js.map +1 -0
  47. package/speechflow-cli/dst/speechflow-node-a2a-speex.d.ts +14 -0
  48. package/speechflow-cli/dst/speechflow-node-a2a-speex.js +156 -0
  49. package/speechflow-cli/dst/speechflow-node-a2a-speex.js.map +1 -0
  50. package/speechflow-cli/dst/speechflow-node-a2a-vad.js +3 -3
  51. package/speechflow-cli/dst/speechflow-node-a2a-vad.js.map +1 -1
  52. package/speechflow-cli/dst/speechflow-node-a2a-wav.js +22 -17
  53. package/speechflow-cli/dst/speechflow-node-a2a-wav.js.map +1 -1
  54. package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.d.ts +18 -0
  55. package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.js +317 -0
  56. package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.js.map +1 -0
  57. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js +15 -13
  58. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js.map +1 -1
  59. package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.d.ts +19 -0
  60. package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.js +351 -0
  61. package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.js.map +1 -0
  62. package/speechflow-cli/dst/speechflow-node-t2a-awspolly.d.ts +16 -0
  63. package/speechflow-cli/dst/speechflow-node-t2a-awspolly.js +171 -0
  64. package/speechflow-cli/dst/speechflow-node-t2a-awspolly.js.map +1 -0
  65. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js +19 -14
  66. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js.map +1 -1
  67. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js +11 -6
  68. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js.map +1 -1
  69. package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.d.ts +13 -0
  70. package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.js +141 -0
  71. package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.js.map +1 -0
  72. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js +13 -15
  73. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js.map +1 -1
  74. package/speechflow-cli/dst/speechflow-node-t2t-format.js +10 -15
  75. package/speechflow-cli/dst/speechflow-node-t2t-format.js.map +1 -1
  76. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js +44 -31
  77. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js.map +1 -1
  78. package/speechflow-cli/dst/speechflow-node-t2t-openai.js +44 -45
  79. package/speechflow-cli/dst/speechflow-node-t2t-openai.js.map +1 -1
  80. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js +8 -8
  81. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js.map +1 -1
  82. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js +10 -12
  83. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js.map +1 -1
  84. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js +22 -27
  85. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js.map +1 -1
  86. package/speechflow-cli/dst/speechflow-node-x2x-filter.d.ts +1 -0
  87. package/speechflow-cli/dst/speechflow-node-x2x-filter.js +50 -15
  88. package/speechflow-cli/dst/speechflow-node-x2x-filter.js.map +1 -1
  89. package/speechflow-cli/dst/speechflow-node-x2x-trace.js +17 -18
  90. package/speechflow-cli/dst/speechflow-node-x2x-trace.js.map +1 -1
  91. package/speechflow-cli/dst/speechflow-node-xio-device.js +13 -21
  92. package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -1
  93. package/speechflow-cli/dst/speechflow-node-xio-mqtt.d.ts +1 -0
  94. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js +22 -16
  95. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js.map +1 -1
  96. package/speechflow-cli/dst/speechflow-node-xio-websocket.js +19 -19
  97. package/speechflow-cli/dst/speechflow-node-xio-websocket.js.map +1 -1
  98. package/speechflow-cli/dst/speechflow-node.d.ts +6 -3
  99. package/speechflow-cli/dst/speechflow-node.js +13 -2
  100. package/speechflow-cli/dst/speechflow-node.js.map +1 -1
  101. package/speechflow-cli/dst/speechflow-utils-audio-wt.d.ts +1 -0
  102. package/speechflow-cli/dst/speechflow-utils-audio-wt.js +124 -0
  103. package/speechflow-cli/dst/speechflow-utils-audio-wt.js.map +1 -0
  104. package/speechflow-cli/dst/speechflow-utils-audio.d.ts +13 -0
  105. package/speechflow-cli/dst/speechflow-utils-audio.js +137 -0
  106. package/speechflow-cli/dst/speechflow-utils-audio.js.map +1 -0
  107. package/speechflow-cli/dst/speechflow-utils.d.ts +18 -0
  108. package/speechflow-cli/dst/speechflow-utils.js +123 -35
  109. package/speechflow-cli/dst/speechflow-utils.js.map +1 -1
  110. package/speechflow-cli/dst/speechflow.js +69 -14
  111. package/speechflow-cli/dst/speechflow.js.map +1 -1
  112. package/speechflow-cli/etc/oxlint.jsonc +112 -11
  113. package/speechflow-cli/etc/stx.conf +2 -2
  114. package/speechflow-cli/etc/tsconfig.json +1 -1
  115. package/speechflow-cli/package.d/@shiguredo+rnnoise-wasm+2025.1.5.patch +25 -0
  116. package/speechflow-cli/package.json +102 -94
  117. package/speechflow-cli/src/lib.d.ts +24 -0
  118. package/speechflow-cli/src/speechflow-node-a2a-compressor-wt.ts +151 -0
  119. package/speechflow-cli/src/speechflow-node-a2a-compressor.ts +303 -0
  120. package/speechflow-cli/src/speechflow-node-a2a-expander-wt.ts +158 -0
  121. package/speechflow-cli/src/speechflow-node-a2a-expander.ts +212 -0
  122. package/speechflow-cli/src/speechflow-node-a2a-ffmpeg.ts +13 -3
  123. package/speechflow-cli/src/speechflow-node-a2a-filler.ts +223 -0
  124. package/speechflow-cli/src/speechflow-node-a2a-gain.ts +98 -0
  125. package/speechflow-cli/src/speechflow-node-a2a-gender.ts +31 -17
  126. package/speechflow-cli/src/speechflow-node-a2a-meter.ts +13 -9
  127. package/speechflow-cli/src/speechflow-node-a2a-mute.ts +3 -2
  128. package/speechflow-cli/src/speechflow-node-a2a-rnnoise-wt.ts +62 -0
  129. package/speechflow-cli/src/speechflow-node-a2a-rnnoise.ts +164 -0
  130. package/speechflow-cli/src/speechflow-node-a2a-speex.ts +137 -0
  131. package/speechflow-cli/src/speechflow-node-a2a-vad.ts +3 -3
  132. package/speechflow-cli/src/speechflow-node-a2a-wav.ts +20 -13
  133. package/speechflow-cli/src/speechflow-node-a2t-awstranscribe.ts +308 -0
  134. package/speechflow-cli/src/speechflow-node-a2t-deepgram.ts +15 -13
  135. package/speechflow-cli/src/speechflow-node-a2t-openaitranscribe.ts +337 -0
  136. package/speechflow-cli/src/speechflow-node-t2a-awspolly.ts +187 -0
  137. package/speechflow-cli/src/speechflow-node-t2a-elevenlabs.ts +19 -14
  138. package/speechflow-cli/src/speechflow-node-t2a-kokoro.ts +12 -7
  139. package/speechflow-cli/src/speechflow-node-t2t-awstranslate.ts +152 -0
  140. package/speechflow-cli/src/speechflow-node-t2t-deepl.ts +13 -15
  141. package/speechflow-cli/src/speechflow-node-t2t-format.ts +10 -15
  142. package/speechflow-cli/src/speechflow-node-t2t-ollama.ts +55 -42
  143. package/speechflow-cli/src/speechflow-node-t2t-openai.ts +58 -58
  144. package/speechflow-cli/src/speechflow-node-t2t-sentence.ts +10 -10
  145. package/speechflow-cli/src/speechflow-node-t2t-subtitle.ts +15 -16
  146. package/speechflow-cli/src/speechflow-node-t2t-transformers.ts +27 -32
  147. package/speechflow-cli/src/speechflow-node-x2x-filter.ts +20 -16
  148. package/speechflow-cli/src/speechflow-node-x2x-trace.ts +20 -19
  149. package/speechflow-cli/src/speechflow-node-xio-device.ts +15 -23
  150. package/speechflow-cli/src/speechflow-node-xio-mqtt.ts +23 -16
  151. package/speechflow-cli/src/speechflow-node-xio-websocket.ts +19 -19
  152. package/speechflow-cli/src/speechflow-node.ts +21 -8
  153. package/speechflow-cli/src/speechflow-utils-audio-wt.ts +172 -0
  154. package/speechflow-cli/src/speechflow-utils-audio.ts +147 -0
  155. package/speechflow-cli/src/speechflow-utils.ts +125 -32
  156. package/speechflow-cli/src/speechflow.ts +74 -17
  157. package/speechflow-ui-db/dst/index.js +31 -31
  158. package/speechflow-ui-db/etc/eslint.mjs +0 -1
  159. package/speechflow-ui-db/etc/tsc-client.json +3 -3
  160. package/speechflow-ui-db/package.json +11 -10
  161. package/speechflow-ui-db/src/app.vue +20 -6
  162. package/speechflow-ui-st/dst/index.js +26 -26
  163. package/speechflow-ui-st/etc/eslint.mjs +0 -1
  164. package/speechflow-ui-st/etc/tsc-client.json +3 -3
  165. package/speechflow-ui-st/package.json +11 -10
  166. package/speechflow-ui-st/src/app.vue +5 -12
@@ -0,0 +1,312 @@
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 node_web_audio_api_1 = require("node-web-audio-api");
49
+ /* internal dependencies */
50
+ const speechflow_node_1 = __importDefault(require("./speechflow-node"));
51
+ const utils = __importStar(require("./speechflow-utils"));
52
+ const speechflow_utils_audio_1 = require("./speechflow-utils-audio");
53
+ /* audio dynamics class */
54
+ class AudioDynamics extends speechflow_utils_audio_1.WebAudio {
55
+ /* internal state */
56
+ config;
57
+ dynamicsNode = null;
58
+ gainNode = null;
59
+ /* construct object */
60
+ constructor(sampleRate, channels, config = {}) {
61
+ super(sampleRate, channels);
62
+ /* store configuration */
63
+ this.config = {
64
+ mode: config.mode ?? "compress",
65
+ type: config.type ?? "standalone",
66
+ sideChainMode: config.sideChainMode ?? "compress",
67
+ thresholdDb: config.thresholdDb ?? -23,
68
+ ratio: config.ratio ?? 4.0,
69
+ attackMs: config.attackMs ?? 10,
70
+ releaseMs: config.releaseMs ?? 50,
71
+ kneeDb: config.kneeDb ?? 6.0,
72
+ makeupDb: config.makeupDb ?? 0,
73
+ expandThresholdDb: config.expandThresholdDb ?? -45,
74
+ expandRatio: config.expandRatio ?? 4.0,
75
+ floorDb: config.floorDb ?? -64
76
+ };
77
+ }
78
+ /* setup object */
79
+ async setup() {
80
+ await super.setup();
81
+ /* add audio worklet module */
82
+ const url = node_path_1.default.resolve(__dirname, "speechflow-node-a2a-dynamics-wt.js");
83
+ await this.audioContext.audioWorklet.addModule(url);
84
+ /* determine operation modes (based on compressor logic) */
85
+ const needsDynamics = (this.config.type === "standalone") ||
86
+ (this.config.type === "sidechain" && this.config.sideChainMode === "measure");
87
+ const needsGain = (this.config.type === "standalone") ||
88
+ (this.config.type === "sidechain" && this.config.sideChainMode === "adjust");
89
+ /* create dynamics worklet node */
90
+ if (needsDynamics) {
91
+ this.dynamicsNode = new node_web_audio_api_1.AudioWorkletNode(this.audioContext, "dynamics", {
92
+ numberOfInputs: 1,
93
+ numberOfOutputs: 1,
94
+ processorOptions: {
95
+ sampleRate: this.audioContext.sampleRate
96
+ }
97
+ });
98
+ }
99
+ /* create gain node */
100
+ if (needsGain)
101
+ this.gainNode = this.audioContext.createGain();
102
+ /* connect nodes (according to type and mode) */
103
+ if (this.config.type === "standalone") {
104
+ this.sourceNode.connect(this.dynamicsNode);
105
+ if (this.gainNode !== null) {
106
+ this.dynamicsNode.connect(this.gainNode);
107
+ this.gainNode.connect(this.captureNode);
108
+ }
109
+ else {
110
+ this.dynamicsNode.connect(this.captureNode);
111
+ }
112
+ }
113
+ else if (this.config.type === "sidechain" && this.config.sideChainMode === "measure") {
114
+ this.sourceNode.connect(this.dynamicsNode);
115
+ }
116
+ else if (this.config.type === "sidechain" && this.config.sideChainMode === "adjust") {
117
+ this.sourceNode.connect(this.gainNode);
118
+ this.gainNode.connect(this.captureNode);
119
+ }
120
+ /* configure dynamics worklet node */
121
+ const currentTime = this.audioContext.currentTime;
122
+ if (needsDynamics) {
123
+ const node = this.dynamicsNode;
124
+ const params = node.parameters;
125
+ /* map mode string to number */
126
+ const modeNum = this.config.mode === "compress" ? 0 :
127
+ this.config.mode === "expand" ? 1 : 2;
128
+ params.get("mode").setValueAtTime(modeNum, currentTime);
129
+ params.get("threshold").setValueAtTime(this.config.thresholdDb, currentTime);
130
+ params.get("ratio").setValueAtTime(this.config.ratio, currentTime);
131
+ params.get("attack").setValueAtTime(this.config.attackMs / 1000, currentTime);
132
+ params.get("release").setValueAtTime(this.config.releaseMs / 1000, currentTime);
133
+ params.get("knee").setValueAtTime(this.config.kneeDb, currentTime);
134
+ params.get("makeup").setValueAtTime(this.config.makeupDb, currentTime);
135
+ params.get("expandThreshold").setValueAtTime(this.config.expandThresholdDb, currentTime);
136
+ params.get("expandRatio").setValueAtTime(this.config.expandRatio, currentTime);
137
+ params.get("floor").setValueAtTime(this.config.floorDb, currentTime);
138
+ }
139
+ /* configure gain node */
140
+ if (needsGain) {
141
+ const gain = Math.pow(10, this.config.makeupDb / 20);
142
+ this.gainNode.gain.setValueAtTime(gain, currentTime);
143
+ }
144
+ }
145
+ /* get the current gain reduction */
146
+ getGainReduction() {
147
+ const processor = this.dynamicsNode?.port?.processor;
148
+ return processor?.reduction ?? 0;
149
+ }
150
+ /* set the current gain */
151
+ setGain(decibel) {
152
+ const gain = Math.pow(10, decibel / 20);
153
+ this.gainNode?.gain.setTargetAtTime(gain, this.audioContext.currentTime, 0.002);
154
+ }
155
+ /* destroy the dynamics processor */
156
+ async destroy() {
157
+ await super.destroy();
158
+ /* destroy nodes */
159
+ if (this.dynamicsNode !== null) {
160
+ this.dynamicsNode.disconnect();
161
+ this.dynamicsNode = null;
162
+ }
163
+ if (this.gainNode !== null) {
164
+ this.gainNode.disconnect();
165
+ this.gainNode = null;
166
+ }
167
+ }
168
+ }
169
+ /* SpeechFlow node for unified dynamics processing in audio-to-audio passing */
170
+ class SpeechFlowNodeDynamics extends speechflow_node_1.default {
171
+ /* declare official node name */
172
+ static name = "dynamics";
173
+ /* internal state */
174
+ destroyed = false;
175
+ dynamics = null;
176
+ bus = null;
177
+ intervalId = null;
178
+ /* construct node */
179
+ constructor(id, cfg, opts, args) {
180
+ super(id, cfg, opts, args);
181
+ /* declare node configuration parameters */
182
+ this.configure({
183
+ mode: { type: "string", val: "compress", match: /^(?:compress|expand|both)$/ },
184
+ type: { type: "string", val: "standalone", match: /^(?:standalone|sidechain)$/ },
185
+ sideChainMode: { type: "string", val: "compress", match: /^(?:compress|measure|adjust)$/ },
186
+ bus: { type: "string", val: "dynamics", match: /^.+$/ },
187
+ thresholdDb: { type: "number", val: -23, match: (n) => n <= 0 && n >= -100 },
188
+ ratio: { type: "number", val: 4.0, match: (n) => n >= 1 && n <= 20 },
189
+ attackMs: { type: "number", val: 10, match: (n) => n >= 0 && n <= 1000 },
190
+ releaseMs: { type: "number", val: 50, match: (n) => n >= 0 && n <= 1000 },
191
+ kneeDb: { type: "number", val: 6.0, match: (n) => n >= 0 && n <= 40 },
192
+ makeupDb: { type: "number", val: 0, match: (n) => n >= -24 && n <= 24 },
193
+ expandThresholdDb: { type: "number", val: -45, match: (n) => n <= 0 && n >= -100 },
194
+ expandRatio: { type: "number", val: 4.0, match: (n) => n >= 1 && n <= 20 },
195
+ floorDb: { type: "number", val: -64, match: (n) => n <= 0 && n >= -100 }
196
+ });
197
+ /* sanity check mode and type combinations */
198
+ if (this.params.type === "standalone" && this.params.sideChainMode !== "compress")
199
+ throw new Error("type \"standalone\" implies sideChainMode \"compress\"");
200
+ if (this.params.type === "sidechain" && this.params.sideChainMode === "compress")
201
+ throw new Error("type \"sidechain\" implies sideChainMode \"measure\" or \"adjust\"");
202
+ if (this.params.mode === "expand" && this.params.floorDb >= this.params.expandThresholdDb)
203
+ throw new Error("floor dB must be less than expand threshold dB for proper expansion");
204
+ /* declare node input/output format */
205
+ this.input = "audio";
206
+ this.output = "audio";
207
+ }
208
+ /* open node */
209
+ async open() {
210
+ /* clear destruction flag */
211
+ this.destroyed = false;
212
+ /* setup dynamics */
213
+ this.dynamics = new AudioDynamics(this.config.audioSampleRate, this.config.audioChannels, {
214
+ mode: this.params.mode,
215
+ type: this.params.type,
216
+ sideChainMode: this.params.sideChainMode,
217
+ thresholdDb: this.params.thresholdDb,
218
+ ratio: this.params.ratio,
219
+ attackMs: this.params.attackMs,
220
+ releaseMs: this.params.releaseMs,
221
+ kneeDb: this.params.kneeDb,
222
+ makeupDb: this.params.makeupDb,
223
+ expandThresholdDb: this.params.expandThresholdDb,
224
+ expandRatio: this.params.expandRatio,
225
+ floorDb: this.params.floorDb
226
+ });
227
+ await this.dynamics.setup();
228
+ /* optionally establish sidechain processing */
229
+ if (this.params.type === "sidechain") {
230
+ this.bus = this.accessBus(this.params.bus);
231
+ if (this.params.sideChainMode === "measure") {
232
+ this.intervalId = setInterval(() => {
233
+ const decibel = this.dynamics?.getGainReduction();
234
+ this.bus?.emit("sidechain-decibel", decibel);
235
+ }, 10);
236
+ }
237
+ else if (this.params.sideChainMode === "adjust") {
238
+ this.bus.on("sidechain-decibel", (decibel) => {
239
+ this.dynamics?.setGain(decibel);
240
+ });
241
+ }
242
+ }
243
+ /* establish a transform stream */
244
+ const self = this;
245
+ this.stream = new node_stream_1.default.Transform({
246
+ readableObjectMode: true,
247
+ writableObjectMode: true,
248
+ decodeStrings: false,
249
+ transform(chunk, encoding, callback) {
250
+ if (self.destroyed) {
251
+ callback(new Error("stream already destroyed"));
252
+ return;
253
+ }
254
+ if (!Buffer.isBuffer(chunk.payload))
255
+ callback(new Error("invalid chunk payload type"));
256
+ else {
257
+ /* process chunk through dynamics */
258
+ const payload = utils.convertBufToI16(chunk.payload);
259
+ self.dynamics?.process(payload).then((result) => {
260
+ if (self.destroyed)
261
+ throw new Error("stream already destroyed");
262
+ if ((self.params.type === "standalone") ||
263
+ (self.params.type === "sidechain" && self.params.sideChainMode === "adjust")) {
264
+ /* take over processed data */
265
+ const payload = utils.convertI16ToBuf(result);
266
+ chunk.payload = payload;
267
+ }
268
+ this.push(chunk);
269
+ callback();
270
+ }).catch((error) => {
271
+ callback(new Error(`dynamics processing failed: ${error}`));
272
+ });
273
+ }
274
+ },
275
+ final(callback) {
276
+ if (self.destroyed) {
277
+ callback();
278
+ return;
279
+ }
280
+ this.push(null);
281
+ callback();
282
+ }
283
+ });
284
+ }
285
+ /* close node */
286
+ async close() {
287
+ /* indicate destruction */
288
+ this.destroyed = true;
289
+ /* clear interval */
290
+ if (this.intervalId !== null) {
291
+ clearInterval(this.intervalId);
292
+ this.intervalId = null;
293
+ }
294
+ /* destroy bus */
295
+ if (this.bus !== null) {
296
+ this.bus.removeAllListeners();
297
+ this.bus = null;
298
+ }
299
+ /* destroy dynamics */
300
+ if (this.dynamics !== null) {
301
+ await this.dynamics.destroy();
302
+ this.dynamics = null;
303
+ }
304
+ /* close stream */
305
+ if (this.stream !== null) {
306
+ this.stream.destroy();
307
+ this.stream = null;
308
+ }
309
+ }
310
+ }
311
+ exports.default = SpeechFlowNodeDynamics;
312
+ //# sourceMappingURL=speechflow-node-a2a-dynamics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speechflow-node-a2a-dynamics.js","sourceRoot":"","sources":["../src/speechflow-node-a2a-dynamics.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,0DAAwC;AACxC,8DAA0C;AAG1C,6BAA6B;AAC7B,2DAA+D;AAE/D,6BAA6B;AAC7B,wEAAmE;AACnE,0DAAoE;AACpE,qEAA0E;AAkB1E,4BAA4B;AAC5B,MAAM,aAAc,SAAQ,iCAAQ;IAChC,sBAAsB;IACd,MAAM,CAA0C;IAChD,YAAY,GAAiC,IAAI,CAAA;IACjD,QAAQ,GAA6B,IAAI,CAAA;IAEjD,wBAAwB;IACxB,YACI,UAAkB,EAClB,QAAkB,EAClB,SAAkC,EAAE;QAEpC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAE3B,2BAA2B;QAC3B,IAAI,CAAC,MAAM,GAAG;YACV,IAAI,EAAe,MAAM,CAAC,IAAI,IAAiB,UAAU;YACzD,IAAI,EAAe,MAAM,CAAC,IAAI,IAAiB,YAAY;YAC3D,aAAa,EAAM,MAAM,CAAC,aAAa,IAAQ,UAAU;YACzD,WAAW,EAAQ,MAAM,CAAC,WAAW,IAAU,CAAC,EAAE;YAClD,KAAK,EAAc,MAAM,CAAC,KAAK,IAAgB,GAAG;YAClD,QAAQ,EAAW,MAAM,CAAC,QAAQ,IAAa,EAAE;YACjD,SAAS,EAAU,MAAM,CAAC,SAAS,IAAY,EAAE;YACjD,MAAM,EAAa,MAAM,CAAC,MAAM,IAAe,GAAG;YAClD,QAAQ,EAAW,MAAM,CAAC,QAAQ,IAAa,CAAC;YAChD,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,IAAI,CAAC,EAAE;YAClD,WAAW,EAAQ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J,CAAC,CAAA;IACN,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,KAAK;QACP,4BAA4B;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QAErB,sBAAsB;QACtB,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC3B,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;QAC1B,CAAC;QAED,mBAAmB;QACnB,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAA;YAC7B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAA;QACnB,CAAC;QAED,wBAAwB;QACxB,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;YAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACxB,CAAC;QAED,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;;AA5JL,yCA6JC"}
@@ -0,0 +1,161 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ const utils = __importStar(require("./speechflow-utils"));
42
+ /* downward expander with soft knee */
43
+ class ExpanderProcessor extends AudioWorkletProcessor {
44
+ /* internal state */
45
+ env = [];
46
+ sampleRate;
47
+ /* eslint no-undef: off */
48
+ static get parameterDescriptors() {
49
+ return [
50
+ { name: "threshold", defaultValue: -45, minValue: -100, maxValue: 0, automationRate: "k-rate" }, // dBFS
51
+ { name: "floor", defaultValue: -64, minValue: -100, maxValue: 0, automationRate: "k-rate" }, // dBFS minimum output level
52
+ { name: "ratio", defaultValue: 4.0, minValue: 1.0, maxValue: 20, automationRate: "k-rate" }, // expansion ratio
53
+ { name: "attack", defaultValue: 0.010, minValue: 0.0, maxValue: 1, automationRate: "k-rate" }, // seconds
54
+ { name: "release", defaultValue: 0.050, minValue: 0.0, maxValue: 1, automationRate: "k-rate" }, // seconds
55
+ { name: "knee", defaultValue: 6.0, minValue: 0.0, maxValue: 40, automationRate: "k-rate" }, // dB
56
+ { name: "makeup", defaultValue: 0.0, minValue: -24, maxValue: 24, automationRate: "k-rate" } // dB
57
+ ];
58
+ }
59
+ /* class constructor for custom option processing */
60
+ constructor(options) {
61
+ super();
62
+ const { sampleRate } = options.processorOptions;
63
+ this.sampleRate = sampleRate;
64
+ }
65
+ /* determine gain difference */
66
+ gainDBFor(levelDB, thresholdDB, ratio, kneeDB) {
67
+ /* short-circuit for unreasonable ratio */
68
+ if (ratio <= 1.0)
69
+ return 0;
70
+ /* determine thresholds */
71
+ const halfKnee = kneeDB * 0.5;
72
+ const belowKnee = levelDB < (thresholdDB - halfKnee);
73
+ const aboveThr = levelDB >= thresholdDB;
74
+ /* short-circuit for no expansion (above threshold) */
75
+ if (aboveThr)
76
+ return 0;
77
+ /* apply soft-knee */
78
+ if (kneeDB > 0 && !belowKnee) {
79
+ const x = (levelDB - (thresholdDB - halfKnee)) / kneeDB;
80
+ const idealGainDB = (thresholdDB + (levelDB - thresholdDB) * ratio) - levelDB;
81
+ return idealGainDB * x * x;
82
+ }
83
+ /* determine target level */
84
+ const targetOut = thresholdDB + (levelDB - thresholdDB) / ratio;
85
+ /* return gain difference */
86
+ return targetOut - levelDB;
87
+ }
88
+ /* update envelope (smoothed amplitude contour) for single channel */
89
+ updateEnvelopeForChannel(chan, samples, attack, release) {
90
+ /* fetch old envelope value */
91
+ if (this.env[chan] === undefined)
92
+ this.env[chan] = 1e-12;
93
+ let env = this.env[chan];
94
+ /* calculate attack/release alpha values */
95
+ const alphaA = Math.exp(-1 / (attack * this.sampleRate));
96
+ const alphaR = Math.exp(-1 / (release * this.sampleRate));
97
+ /* iterate over all samples and calculate RMS */
98
+ for (const s of samples) {
99
+ const x = Math.abs(s);
100
+ const det = x * x;
101
+ if (det > env)
102
+ env = alphaA * env + (1 - alphaA) * det;
103
+ else
104
+ env = alphaR * env + (1 - alphaR) * det;
105
+ }
106
+ this.env[chan] = Math.sqrt(Math.max(env, 1e-12));
107
+ }
108
+ /* process a single sample frame */
109
+ process(inputs, outputs, parameters) {
110
+ /* sanity check */
111
+ const input = inputs[0];
112
+ const output = outputs[0];
113
+ if (!input || input.length === 0 || !output)
114
+ return true;
115
+ /* determine number of channels */
116
+ const nCh = input.length;
117
+ /* reset envelope array if channel count changed */
118
+ if (nCh !== this.env.length)
119
+ this.env = [];
120
+ /* initially just copy input to output (pass-through) */
121
+ for (let c = 0; c < output.length; c++) {
122
+ if (!output[c] || !input[c])
123
+ continue;
124
+ output[c].set(input[c]);
125
+ }
126
+ /* fetch parameters */
127
+ const thresholdDB = parameters["threshold"][0];
128
+ const floorDB = parameters["floor"][0];
129
+ const ratio = parameters["ratio"][0];
130
+ const kneeDB = parameters["knee"][0];
131
+ const attackS = Math.max(parameters["attack"][0], 1 / this.sampleRate);
132
+ const releaseS = Math.max(parameters["release"][0], 1 / this.sampleRate);
133
+ const makeupDB = parameters["makeup"][0];
134
+ /* update envelope per channel */
135
+ for (let ch = 0; ch < nCh; ch++)
136
+ this.updateEnvelopeForChannel(ch, input[ch], attackS, releaseS);
137
+ /* determine linear value from decibel makeup value */
138
+ const makeUpLin = utils.dB2lin(makeupDB);
139
+ /* iterate over all channels */
140
+ for (let ch = 0; ch < nCh; ch++) {
141
+ const levelDB = utils.lin2dB(this.env[ch]);
142
+ const gainDB = this.gainDBFor(levelDB, thresholdDB, ratio, kneeDB);
143
+ let gainLin = utils.dB2lin(gainDB) * makeUpLin;
144
+ /* do not attenuate below floor */
145
+ const expectedOutLevelDB = levelDB + gainDB + makeupDB;
146
+ if (expectedOutLevelDB < floorDB) {
147
+ const neededLiftDB = floorDB - expectedOutLevelDB;
148
+ gainLin /= utils.dB2lin(neededLiftDB);
149
+ }
150
+ /* apply gain change to channel */
151
+ const inp = input[ch];
152
+ const out = output[ch];
153
+ for (let i = 0; i < inp.length; i++)
154
+ out[i] = inp[i] * gainLin;
155
+ }
156
+ return true;
157
+ }
158
+ }
159
+ /* register the new audio nodes */
160
+ registerProcessor("expander", ExpanderProcessor);
161
+ //# sourceMappingURL=speechflow-node-a2a-expander-wt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speechflow-node-a2a-expander-wt.js","sourceRoot":"","sources":["../src/speechflow-node-a2a-expander-wt.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,0DAA2C;AAE3C,wCAAwC;AACxC,MAAM,iBAAkB,SAAQ,qBAAqB;IACjD,sBAAsB;IACd,GAAG,GAAa,EAAE,CAAA;IAClB,UAAU,CAAQ;IAE1B,2BAA2B;IAC3B,MAAM,KAAK,oBAAoB;QAC3B,OAAO;YACH,EAAE,IAAI,EAAE,WAAW,EAAG,YAAY,EAAE,CAAC,EAAE,EAAI,QAAQ,EAAE,CAAC,GAAG,EAAI,QAAQ,EAAE,CAAC,EAAI,cAAc,EAAE,QAAQ,EAAE,EAAE,OAAO;YAC/G,EAAE,IAAI,EAAE,OAAO,EAAO,YAAY,EAAE,CAAC,EAAE,EAAI,QAAQ,EAAE,CAAC,GAAG,EAAI,QAAQ,EAAE,CAAC,EAAI,cAAc,EAAE,QAAQ,EAAE,EAAE,4BAA4B;YACpI,EAAE,IAAI,EAAE,OAAO,EAAO,YAAY,EAAE,GAAG,EAAI,QAAQ,EAAE,GAAG,EAAK,QAAQ,EAAE,EAAE,EAAG,cAAc,EAAE,QAAQ,EAAE,EAAE,kBAAkB;YAC1H,EAAE,IAAI,EAAE,QAAQ,EAAM,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAK,QAAQ,EAAE,CAAC,EAAI,cAAc,EAAE,QAAQ,EAAE,EAAE,UAAU;YAClH,EAAE,IAAI,EAAE,SAAS,EAAK,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAK,QAAQ,EAAE,CAAC,EAAI,cAAc,EAAE,QAAQ,EAAE,EAAE,UAAU;YAClH,EAAE,IAAI,EAAE,MAAM,EAAQ,YAAY,EAAE,GAA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AAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;gBAC/B,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;QACjC,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AAED,oCAAoC;AACpC,iBAAiB,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import SpeechFlowNode from "./speechflow-node";
2
+ export default class SpeechFlowNodeExpander extends SpeechFlowNode {
3
+ static name: string;
4
+ private destroyed;
5
+ private expander;
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
+ }