speechflow 1.6.0 → 1.6.1

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 (182) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/package.json +2 -2
  4. package/speechflow-cli/dst/speechflow-main-api.d.ts +12 -0
  5. package/speechflow-cli/dst/speechflow-main-api.js +319 -0
  6. package/speechflow-cli/dst/speechflow-main-api.js.map +1 -0
  7. package/speechflow-cli/dst/speechflow-main-cli.d.ts +28 -0
  8. package/speechflow-cli/dst/speechflow-main-cli.js +271 -0
  9. package/speechflow-cli/dst/speechflow-main-cli.js.map +1 -0
  10. package/speechflow-cli/dst/speechflow-main-config.d.ts +9 -0
  11. package/speechflow-cli/dst/speechflow-main-config.js +27 -0
  12. package/speechflow-cli/dst/speechflow-main-config.js.map +1 -0
  13. package/speechflow-cli/dst/speechflow-main-graph.d.ts +34 -0
  14. package/speechflow-cli/dst/speechflow-main-graph.js +367 -0
  15. package/speechflow-cli/dst/speechflow-main-graph.js.map +1 -0
  16. package/speechflow-cli/dst/speechflow-main-nodes.d.ts +10 -0
  17. package/speechflow-cli/dst/speechflow-main-nodes.js +60 -0
  18. package/speechflow-cli/dst/speechflow-main-nodes.js.map +1 -0
  19. package/speechflow-cli/dst/speechflow-main-status.d.ts +11 -0
  20. package/speechflow-cli/dst/speechflow-main-status.js +60 -0
  21. package/speechflow-cli/dst/speechflow-main-status.js.map +1 -0
  22. package/speechflow-cli/dst/speechflow-main.d.ts +7 -0
  23. package/speechflow-cli/dst/speechflow-main.js +127 -0
  24. package/speechflow-cli/dst/speechflow-main.js.map +1 -0
  25. package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js +4 -4
  26. package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js.map +1 -1
  27. package/speechflow-cli/dst/speechflow-node-a2a-compressor.js +5 -6
  28. package/speechflow-cli/dst/speechflow-node-a2a-compressor.js.map +1 -1
  29. package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js +5 -5
  30. package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js.map +1 -1
  31. package/speechflow-cli/dst/speechflow-node-a2a-expander.js +5 -6
  32. package/speechflow-cli/dst/speechflow-node-a2a-expander.js.map +1 -1
  33. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js +5 -5
  34. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js.map +1 -1
  35. package/speechflow-cli/dst/speechflow-node-a2a-filler.js +3 -3
  36. package/speechflow-cli/dst/speechflow-node-a2a-filler.js.map +1 -1
  37. package/speechflow-cli/dst/speechflow-node-a2a-gain.js +2 -2
  38. package/speechflow-cli/dst/speechflow-node-a2a-gain.js.map +1 -1
  39. package/speechflow-cli/dst/speechflow-node-a2a-gender.js +4 -4
  40. package/speechflow-cli/dst/speechflow-node-a2a-gender.js.map +1 -1
  41. package/speechflow-cli/dst/speechflow-node-a2a-meter.js +2 -2
  42. package/speechflow-cli/dst/speechflow-node-a2a-meter.js.map +1 -1
  43. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js +4 -4
  44. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js.map +1 -1
  45. package/speechflow-cli/dst/speechflow-node-a2a-speex.js +4 -4
  46. package/speechflow-cli/dst/speechflow-node-a2a-speex.js.map +1 -1
  47. package/speechflow-cli/dst/speechflow-node-a2a-vad.js +4 -4
  48. package/speechflow-cli/dst/speechflow-node-a2a-vad.js.map +1 -1
  49. package/speechflow-cli/dst/speechflow-node-a2t-amazon.js +6 -6
  50. package/speechflow-cli/dst/speechflow-node-a2t-amazon.js.map +1 -1
  51. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js +4 -4
  52. package/speechflow-cli/dst/speechflow-node-a2t-deepgram.js.map +1 -1
  53. package/speechflow-cli/dst/speechflow-node-a2t-openai.js +4 -4
  54. package/speechflow-cli/dst/speechflow-node-a2t-openai.js.map +1 -1
  55. package/speechflow-cli/dst/speechflow-node-t2a-amazon.js +2 -2
  56. package/speechflow-cli/dst/speechflow-node-t2a-amazon.js.map +1 -1
  57. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js +2 -2
  58. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js.map +1 -1
  59. package/speechflow-cli/dst/speechflow-node-t2t-amazon.js +2 -2
  60. package/speechflow-cli/dst/speechflow-node-t2t-amazon.js.map +1 -1
  61. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js +2 -2
  62. package/speechflow-cli/dst/speechflow-node-t2t-deepl.js.map +1 -1
  63. package/speechflow-cli/dst/speechflow-node-t2t-google.js +5 -5
  64. package/speechflow-cli/dst/speechflow-node-t2t-google.js.map +1 -1
  65. package/speechflow-cli/dst/speechflow-node-t2t-modify.js +2 -2
  66. package/speechflow-cli/dst/speechflow-node-t2t-modify.js.map +1 -1
  67. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js +2 -2
  68. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js.map +1 -1
  69. package/speechflow-cli/dst/speechflow-node-t2t-openai.js +2 -2
  70. package/speechflow-cli/dst/speechflow-node-t2t-openai.js.map +1 -1
  71. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js +2 -2
  72. package/speechflow-cli/dst/speechflow-node-t2t-sentence.js.map +1 -1
  73. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js +2 -2
  74. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js.map +1 -1
  75. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js +2 -2
  76. package/speechflow-cli/dst/speechflow-node-t2t-transformers.js.map +1 -1
  77. package/speechflow-cli/dst/speechflow-node-x2x-filter.js +2 -2
  78. package/speechflow-cli/dst/speechflow-node-x2x-filter.js.map +1 -1
  79. package/speechflow-cli/dst/speechflow-node-xio-device.js +5 -5
  80. package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -1
  81. package/speechflow-cli/dst/speechflow-node-xio-file.js +27 -27
  82. package/speechflow-cli/dst/speechflow-node-xio-file.js.map +1 -1
  83. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js +4 -4
  84. package/speechflow-cli/dst/speechflow-node-xio-mqtt.js.map +1 -1
  85. package/speechflow-cli/dst/speechflow-node-xio-websocket.js +7 -7
  86. package/speechflow-cli/dst/speechflow-node-xio-websocket.js.map +1 -1
  87. package/speechflow-cli/dst/{speechflow-utils-audio-wt.js → speechflow-util-audio-wt.js} +1 -1
  88. package/speechflow-cli/dst/speechflow-util-audio-wt.js.map +1 -0
  89. package/speechflow-cli/dst/speechflow-util-audio.d.ts +22 -0
  90. package/speechflow-cli/dst/speechflow-util-audio.js +251 -0
  91. package/speechflow-cli/dst/speechflow-util-audio.js.map +1 -0
  92. package/speechflow-cli/dst/speechflow-util-error.d.ts +14 -0
  93. package/speechflow-cli/dst/speechflow-util-error.js +131 -0
  94. package/speechflow-cli/dst/speechflow-util-error.js.map +1 -0
  95. package/speechflow-cli/dst/speechflow-util-queue.d.ts +68 -0
  96. package/speechflow-cli/dst/speechflow-util-queue.js +338 -0
  97. package/speechflow-cli/dst/speechflow-util-queue.js.map +1 -0
  98. package/speechflow-cli/dst/speechflow-util-stream.d.ts +18 -0
  99. package/speechflow-cli/dst/speechflow-util-stream.js +219 -0
  100. package/speechflow-cli/dst/speechflow-util-stream.js.map +1 -0
  101. package/speechflow-cli/dst/speechflow-util-webaudio-wt.js +124 -0
  102. package/speechflow-cli/dst/speechflow-util-webaudio-wt.js.map +1 -0
  103. package/speechflow-cli/dst/{speechflow-utils-audio.js → speechflow-util-webaudio.js} +2 -2
  104. package/speechflow-cli/dst/speechflow-util-webaudio.js.map +1 -0
  105. package/speechflow-cli/dst/speechflow-util.d.ts +4 -0
  106. package/speechflow-cli/dst/speechflow-util.js +26 -0
  107. package/speechflow-cli/dst/speechflow-util.js.map +1 -0
  108. package/speechflow-cli/dst/speechflow.js +3 -912
  109. package/speechflow-cli/dst/speechflow.js.map +1 -1
  110. package/speechflow-cli/etc/oxlint.jsonc +4 -1
  111. package/speechflow-cli/package.json +1 -0
  112. package/speechflow-cli/src/speechflow-main-api.ts +315 -0
  113. package/speechflow-cli/src/speechflow-main-cli.ts +259 -0
  114. package/speechflow-cli/src/speechflow-main-config.ts +17 -0
  115. package/speechflow-cli/src/speechflow-main-graph.ts +372 -0
  116. package/speechflow-cli/src/speechflow-main-nodes.ts +61 -0
  117. package/speechflow-cli/src/speechflow-main-status.ts +70 -0
  118. package/speechflow-cli/src/speechflow-main.ts +106 -0
  119. package/speechflow-cli/src/speechflow-node-a2a-compressor-wt.ts +4 -4
  120. package/speechflow-cli/src/speechflow-node-a2a-compressor.ts +5 -6
  121. package/speechflow-cli/src/speechflow-node-a2a-expander-wt.ts +5 -5
  122. package/speechflow-cli/src/speechflow-node-a2a-expander.ts +5 -6
  123. package/speechflow-cli/src/speechflow-node-a2a-ffmpeg.ts +5 -5
  124. package/speechflow-cli/src/speechflow-node-a2a-filler.ts +4 -4
  125. package/speechflow-cli/src/speechflow-node-a2a-gain.ts +2 -2
  126. package/speechflow-cli/src/speechflow-node-a2a-gender.ts +4 -4
  127. package/speechflow-cli/src/speechflow-node-a2a-meter.ts +2 -2
  128. package/speechflow-cli/src/speechflow-node-a2a-rnnoise.ts +4 -4
  129. package/speechflow-cli/src/speechflow-node-a2a-speex.ts +4 -4
  130. package/speechflow-cli/src/speechflow-node-a2a-vad.ts +4 -4
  131. package/speechflow-cli/src/speechflow-node-a2t-amazon.ts +7 -7
  132. package/speechflow-cli/src/speechflow-node-a2t-deepgram.ts +5 -5
  133. package/speechflow-cli/src/speechflow-node-a2t-openai.ts +5 -5
  134. package/speechflow-cli/src/speechflow-node-t2a-amazon.ts +2 -2
  135. package/speechflow-cli/src/speechflow-node-t2a-kokoro.ts +2 -2
  136. package/speechflow-cli/src/speechflow-node-t2t-amazon.ts +2 -2
  137. package/speechflow-cli/src/speechflow-node-t2t-deepl.ts +2 -2
  138. package/speechflow-cli/src/speechflow-node-t2t-google.ts +5 -5
  139. package/speechflow-cli/src/speechflow-node-t2t-modify.ts +2 -2
  140. package/speechflow-cli/src/speechflow-node-t2t-ollama.ts +2 -2
  141. package/speechflow-cli/src/speechflow-node-t2t-openai.ts +2 -2
  142. package/speechflow-cli/src/speechflow-node-t2t-sentence.ts +2 -2
  143. package/speechflow-cli/src/speechflow-node-t2t-subtitle.ts +2 -2
  144. package/speechflow-cli/src/speechflow-node-t2t-transformers.ts +2 -2
  145. package/speechflow-cli/src/speechflow-node-x2x-filter.ts +2 -2
  146. package/speechflow-cli/src/speechflow-node-xio-device.ts +5 -5
  147. package/speechflow-cli/src/speechflow-node-xio-file.ts +9 -10
  148. package/speechflow-cli/src/speechflow-node-xio-mqtt.ts +5 -5
  149. package/speechflow-cli/src/speechflow-node-xio-websocket.ts +7 -7
  150. package/speechflow-cli/src/{speechflow-utils-audio.ts → speechflow-util-audio.ts} +131 -1
  151. package/speechflow-cli/src/speechflow-util-error.ts +184 -0
  152. package/speechflow-cli/src/speechflow-util-queue.ts +320 -0
  153. package/speechflow-cli/src/speechflow-util-stream.ts +197 -0
  154. package/speechflow-cli/src/speechflow-util.ts +10 -0
  155. package/speechflow-cli/src/speechflow.ts +3 -953
  156. package/speechflow-cli/dst/speechflow-node-a2a-dynamics-wt.js +0 -208
  157. package/speechflow-cli/dst/speechflow-node-a2a-dynamics-wt.js.map +0 -1
  158. package/speechflow-cli/dst/speechflow-node-a2a-dynamics.d.ts +0 -15
  159. package/speechflow-cli/dst/speechflow-node-a2a-dynamics.js +0 -312
  160. package/speechflow-cli/dst/speechflow-node-a2a-dynamics.js.map +0 -1
  161. package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.d.ts +0 -18
  162. package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.js +0 -312
  163. package/speechflow-cli/dst/speechflow-node-a2t-awstranscribe.js.map +0 -1
  164. package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.d.ts +0 -19
  165. package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.js +0 -351
  166. package/speechflow-cli/dst/speechflow-node-a2t-openaitranscribe.js.map +0 -1
  167. package/speechflow-cli/dst/speechflow-node-t2a-awspolly.d.ts +0 -16
  168. package/speechflow-cli/dst/speechflow-node-t2a-awspolly.js +0 -204
  169. package/speechflow-cli/dst/speechflow-node-t2a-awspolly.js.map +0 -1
  170. package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.d.ts +0 -13
  171. package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.js +0 -175
  172. package/speechflow-cli/dst/speechflow-node-t2t-awstranslate.js.map +0 -1
  173. package/speechflow-cli/dst/speechflow-utils-audio-wt.js.map +0 -1
  174. package/speechflow-cli/dst/speechflow-utils-audio.js.map +0 -1
  175. package/speechflow-cli/dst/speechflow-utils.d.ts +0 -108
  176. package/speechflow-cli/dst/speechflow-utils.js +0 -746
  177. package/speechflow-cli/dst/speechflow-utils.js.map +0 -1
  178. package/speechflow-cli/src/speechflow-utils.ts +0 -810
  179. /package/speechflow-cli/dst/{speechflow-node-a2a-dynamics-wt.d.ts → speechflow-util-audio-wt.d.ts} +0 -0
  180. /package/speechflow-cli/dst/{speechflow-utils-audio-wt.d.ts → speechflow-util-webaudio-wt.d.ts} +0 -0
  181. /package/speechflow-cli/dst/{speechflow-utils-audio.d.ts → speechflow-util-webaudio.d.ts} +0 -0
  182. /package/speechflow-cli/src/{speechflow-utils-audio-wt.ts → speechflow-util-audio-wt.ts} +0 -0
@@ -1,208 +0,0 @@
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
- /* unified dynamics processor with compression and expansion */
43
- class DynamicsProcessor extends AudioWorkletProcessor {
44
- /* internal state */
45
- env = [];
46
- sampleRate;
47
- reduction = 0;
48
- /* eslint no-undef: off */
49
- static get parameterDescriptors() {
50
- return [
51
- { name: "mode", defaultValue: 0, minValue: 0, maxValue: 2, automationRate: "k-rate" }, // 0=compress, 1=expand, 2=both
52
- { name: "threshold", defaultValue: -23, minValue: -100, maxValue: 0, automationRate: "k-rate" }, // dBFS
53
- { name: "ratio", defaultValue: 4.0, minValue: 1.0, maxValue: 20, automationRate: "k-rate" }, // compression/expansion ratio
54
- { name: "attack", defaultValue: 0.010, minValue: 0.0, maxValue: 1, automationRate: "k-rate" }, // seconds
55
- { name: "release", defaultValue: 0.050, minValue: 0.0, maxValue: 1, automationRate: "k-rate" }, // seconds
56
- { name: "knee", defaultValue: 6.0, minValue: 0.0, maxValue: 40, automationRate: "k-rate" }, // dB
57
- { name: "makeup", defaultValue: 0.0, minValue: -24, maxValue: 24, automationRate: "k-rate" }, // dB
58
- { name: "expandThreshold", defaultValue: -45, minValue: -100, maxValue: 0, automationRate: "k-rate" }, // dBFS for expansion
59
- { name: "expandRatio", defaultValue: 4.0, minValue: 1.0, maxValue: 20, automationRate: "k-rate" }, // expansion ratio
60
- { name: "floor", defaultValue: -64, minValue: -100, maxValue: 0, automationRate: "k-rate" } // dBFS minimum output level
61
- ];
62
- }
63
- /* class constructor for custom option processing */
64
- constructor(options) {
65
- super();
66
- const { sampleRate } = options.processorOptions;
67
- this.sampleRate = sampleRate;
68
- }
69
- /* determine compression gain difference */
70
- compressGainDBFor(levelDB, thresholdDB, ratio, kneeDB) {
71
- /* short-circuit for unreasonable ratio */
72
- if (ratio <= 1.0)
73
- return 0;
74
- /* determine thresholds */
75
- const halfKnee = kneeDB * 0.5;
76
- const belowThr = levelDB < thresholdDB;
77
- const aboveKnee = levelDB >= (thresholdDB + halfKnee);
78
- /* short-circuit for no compression (below threshold) */
79
- if (belowThr)
80
- return 0;
81
- /* apply soft-knee */
82
- if (kneeDB > 0 && !aboveKnee) {
83
- const x = (levelDB - thresholdDB) / kneeDB;
84
- const idealGainDB = (thresholdDB + (levelDB - thresholdDB) / ratio) - levelDB;
85
- return idealGainDB * x * x;
86
- }
87
- /* determine target level */
88
- const targetOut = thresholdDB + (levelDB - thresholdDB) / ratio;
89
- /* return gain difference */
90
- return targetOut - levelDB;
91
- }
92
- /* determine expansion gain difference */
93
- expandGainDBFor(levelDB, thresholdDB, ratio, kneeDB) {
94
- /* short-circuit for unreasonable ratio */
95
- if (ratio <= 1.0)
96
- return 0;
97
- /* determine thresholds */
98
- const halfKnee = kneeDB * 0.5;
99
- const belowKnee = levelDB < (thresholdDB - halfKnee);
100
- const aboveThr = levelDB >= thresholdDB;
101
- /* short-circuit for no expansion (above threshold) */
102
- if (aboveThr)
103
- return 0;
104
- /* apply soft-knee */
105
- if (kneeDB > 0 && !belowKnee) {
106
- const x = (levelDB - (thresholdDB - halfKnee)) / kneeDB;
107
- const idealGainDB = (thresholdDB + (levelDB - thresholdDB) * ratio) - levelDB;
108
- return idealGainDB * x * x;
109
- }
110
- /* determine target level */
111
- const targetOut = thresholdDB + (levelDB - thresholdDB) / ratio;
112
- /* return gain difference */
113
- return targetOut - levelDB;
114
- }
115
- /* update envelope (smoothed amplitude contour) for single channel */
116
- updateEnvelopeForChannel(chan, samples, attack, release) {
117
- /* fetch old envelope value */
118
- if (this.env[chan] === undefined)
119
- this.env[chan] = 1e-12;
120
- let env = this.env[chan];
121
- /* calculate attack/release alpha values */
122
- const alphaA = Math.exp(-1 / (attack * this.sampleRate));
123
- const alphaR = Math.exp(-1 / (release * this.sampleRate));
124
- /* iterate over all samples and calculate RMS */
125
- for (const s of samples) {
126
- const x = Math.abs(s);
127
- const det = x * x;
128
- if (det > env)
129
- env = alphaA * env + (1 - alphaA) * det;
130
- else
131
- env = alphaR * env + (1 - alphaR) * det;
132
- }
133
- this.env[chan] = Math.sqrt(Math.max(env, 1e-12));
134
- }
135
- /* process a single sample frame */
136
- process(inputs, outputs, parameters) {
137
- /* sanity check */
138
- const input = inputs[0];
139
- const output = outputs[0];
140
- if (!input || input.length === 0 || !output)
141
- return true;
142
- /* determine number of channels */
143
- const nCh = input.length;
144
- /* reset envelope array if channel count changed */
145
- if (nCh !== this.env.length)
146
- this.env = [];
147
- /* initially just copy input to output (pass-through) */
148
- for (let c = 0; c < output.length; c++) {
149
- if (!output[c] || !input[c])
150
- continue;
151
- output[c].set(input[c]);
152
- }
153
- /* fetch parameters */
154
- const mode = Math.round(parameters["mode"][0]);
155
- const thresholdDB = parameters["threshold"][0];
156
- const ratio = parameters["ratio"][0];
157
- const kneeDB = parameters["knee"][0];
158
- const attackS = Math.max(parameters["attack"][0], 1 / this.sampleRate);
159
- const releaseS = Math.max(parameters["release"][0], 1 / this.sampleRate);
160
- const makeupDB = parameters["makeup"][0];
161
- const expandThresholdDB = parameters["expandThreshold"][0];
162
- const expandRatio = parameters["expandRatio"][0];
163
- const floorDB = parameters["floor"][0];
164
- /* update envelope per channel */
165
- for (let ch = 0; ch < nCh; ch++)
166
- this.updateEnvelopeForChannel(ch, input[ch], attackS, releaseS);
167
- /* determine linear value from decibel makeup value */
168
- const makeUpLin = utils.dB2lin(makeupDB);
169
- /* iterate over all channels */
170
- this.reduction = 0;
171
- for (let ch = 0; ch < nCh; ch++) {
172
- const levelDB = utils.lin2dB(this.env[ch]);
173
- let totalGainDB = 0;
174
- /* apply compression if needed */
175
- if (mode === 0 || mode === 2) {
176
- const compressGainDB = this.compressGainDBFor(levelDB, thresholdDB, ratio, kneeDB);
177
- totalGainDB += compressGainDB;
178
- /* on first channel, calculate reduction for compression */
179
- if (ch === 0)
180
- this.reduction = Math.min(0, compressGainDB);
181
- }
182
- /* apply expansion if needed */
183
- if (mode === 1 || mode === 2) {
184
- const expandGainDB = this.expandGainDBFor(levelDB, expandThresholdDB, expandRatio, kneeDB);
185
- totalGainDB += expandGainDB;
186
- }
187
- /* calculate total gain with makeup */
188
- let gainLin = utils.dB2lin(totalGainDB) * makeUpLin;
189
- /* do not attenuate below floor (for expansion) */
190
- if (mode === 1 || mode === 2) {
191
- const expectedOutLevelDB = levelDB + totalGainDB + makeupDB;
192
- if (expectedOutLevelDB < floorDB) {
193
- const neededLiftDB = floorDB - expectedOutLevelDB;
194
- gainLin /= utils.dB2lin(neededLiftDB);
195
- }
196
- }
197
- /* apply gain change to channel */
198
- const inp = input[ch];
199
- const out = output[ch];
200
- for (let i = 0; i < inp.length; i++)
201
- out[i] = inp[i] * gainLin;
202
- }
203
- return true;
204
- }
205
- }
206
- /* register the new audio nodes */
207
- registerProcessor("dynamics", DynamicsProcessor);
208
- //# sourceMappingURL=speechflow-node-a2a-dynamics-wt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"speechflow-node-a2a-dynamics-wt.js","sourceRoot":"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"}
@@ -1,15 +0,0 @@
1
- import SpeechFlowNode from "./speechflow-node";
2
- export default class SpeechFlowNodeDynamics extends SpeechFlowNode {
3
- static name: string;
4
- private destroyed;
5
- private dynamics;
6
- private bus;
7
- private intervalId;
8
- constructor(id: string, cfg: {
9
- [id: string]: any;
10
- }, opts: {
11
- [id: string]: any;
12
- }, args: any[]);
13
- open(): Promise<void>;
14
- close(): Promise<void>;
15
- }
@@ -1,312 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"speechflow-node-a2a-dynamics.js","sourceRoot":"","sources":["../src/speechflow-node-a2a-dynamics.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;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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"}
@@ -1,18 +0,0 @@
1
- import SpeechFlowNode from "./speechflow-node";
2
- export default class SpeechFlowNodeA2TAWSTranscribe extends SpeechFlowNode {
3
- static name: string;
4
- private client;
5
- private clientStream;
6
- private destroyed;
7
- private initTimeout;
8
- private connectionTimeout;
9
- private queue;
10
- constructor(id: string, cfg: {
11
- [id: string]: any;
12
- }, opts: {
13
- [id: string]: any;
14
- }, args: any[]);
15
- status(): Promise<{}>;
16
- open(): Promise<void>;
17
- close(): Promise<void>;
18
- }