speechflow 1.6.3 → 1.6.5

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 (113) hide show
  1. package/.claude/settings.local.json +3 -0
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +87 -48
  4. package/etc/speechflow.yaml +21 -14
  5. package/package.json +5 -5
  6. package/speechflow-cli/dst/speechflow-main-api.js +3 -7
  7. package/speechflow-cli/dst/speechflow-main-api.js.map +1 -1
  8. package/speechflow-cli/dst/speechflow-main-graph.js +1 -1
  9. package/speechflow-cli/dst/speechflow-main.js +6 -0
  10. package/speechflow-cli/dst/speechflow-main.js.map +1 -1
  11. package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js +1 -21
  12. package/speechflow-cli/dst/speechflow-node-a2a-compressor-wt.js.map +1 -1
  13. package/speechflow-cli/dst/speechflow-node-a2a-compressor.js +2 -1
  14. package/speechflow-cli/dst/speechflow-node-a2a-compressor.js.map +1 -1
  15. package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js +1 -21
  16. package/speechflow-cli/dst/speechflow-node-a2a-expander-wt.js.map +1 -1
  17. package/speechflow-cli/dst/speechflow-node-a2a-expander.js +2 -1
  18. package/speechflow-cli/dst/speechflow-node-a2a-expander.js.map +1 -1
  19. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js +2 -2
  20. package/speechflow-cli/dst/speechflow-node-a2a-ffmpeg.js.map +1 -1
  21. package/speechflow-cli/dst/speechflow-node-a2a-gender.js +38 -42
  22. package/speechflow-cli/dst/speechflow-node-a2a-gender.js.map +1 -1
  23. package/speechflow-cli/dst/speechflow-node-a2a-meter.js +59 -40
  24. package/speechflow-cli/dst/speechflow-node-a2a-meter.js.map +1 -1
  25. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js +1 -0
  26. package/speechflow-cli/dst/speechflow-node-a2a-rnnoise.js.map +1 -1
  27. package/speechflow-cli/dst/speechflow-node-a2a-vad.js +2 -2
  28. package/speechflow-cli/dst/speechflow-node-a2a-vad.js.map +1 -1
  29. package/speechflow-cli/dst/speechflow-node-a2t-openai.d.ts +0 -1
  30. package/speechflow-cli/dst/speechflow-node-a2t-openai.js +0 -6
  31. package/speechflow-cli/dst/speechflow-node-a2t-openai.js.map +1 -1
  32. package/speechflow-cli/dst/speechflow-node-t2a-amazon.d.ts +0 -1
  33. package/speechflow-cli/dst/speechflow-node-t2a-amazon.js +0 -6
  34. package/speechflow-cli/dst/speechflow-node-t2a-amazon.js.map +1 -1
  35. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.d.ts +0 -1
  36. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js +0 -6
  37. package/speechflow-cli/dst/speechflow-node-t2a-elevenlabs.js.map +1 -1
  38. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.d.ts +0 -1
  39. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js +0 -6
  40. package/speechflow-cli/dst/speechflow-node-t2a-kokoro.js.map +1 -1
  41. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js +1 -1
  42. package/speechflow-cli/dst/speechflow-node-t2t-ollama.js.map +1 -1
  43. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js +6 -6
  44. package/speechflow-cli/dst/speechflow-node-t2t-subtitle.js.map +1 -1
  45. package/speechflow-cli/dst/speechflow-node-x2x-trace.d.ts +1 -0
  46. package/speechflow-cli/dst/speechflow-node-x2x-trace.js +22 -2
  47. package/speechflow-cli/dst/speechflow-node-x2x-trace.js.map +1 -1
  48. package/speechflow-cli/dst/speechflow-node-xio-device.js +3 -2
  49. package/speechflow-cli/dst/speechflow-node-xio-device.js.map +1 -1
  50. package/speechflow-cli/dst/speechflow-node-xio-websocket.js.map +1 -1
  51. package/speechflow-cli/dst/speechflow-util-audio.d.ts +1 -0
  52. package/speechflow-cli/dst/speechflow-util-audio.js +21 -0
  53. package/speechflow-cli/dst/speechflow-util-audio.js.map +1 -1
  54. package/speechflow-cli/dst/speechflow-util-error.d.ts +1 -1
  55. package/speechflow-cli/dst/speechflow-util-error.js +7 -1
  56. package/speechflow-cli/dst/speechflow-util-error.js.map +1 -1
  57. package/speechflow-cli/dst/speechflow-util-stream.d.ts +1 -1
  58. package/speechflow-cli/dst/speechflow-util-stream.js +2 -2
  59. package/speechflow-cli/dst/speechflow-util-stream.js.map +1 -1
  60. package/speechflow-cli/etc/oxlint.jsonc +2 -1
  61. package/speechflow-cli/etc/stx.conf +6 -10
  62. package/speechflow-cli/package.json +19 -19
  63. package/speechflow-cli/src/speechflow-main-api.ts +6 -13
  64. package/speechflow-cli/src/speechflow-main-graph.ts +1 -1
  65. package/speechflow-cli/src/speechflow-main.ts +4 -0
  66. package/speechflow-cli/src/speechflow-node-a2a-compressor-wt.ts +1 -29
  67. package/speechflow-cli/src/speechflow-node-a2a-compressor.ts +2 -1
  68. package/speechflow-cli/src/speechflow-node-a2a-expander-wt.ts +1 -29
  69. package/speechflow-cli/src/speechflow-node-a2a-expander.ts +2 -1
  70. package/speechflow-cli/src/speechflow-node-a2a-ffmpeg.ts +2 -2
  71. package/speechflow-cli/src/speechflow-node-a2a-gender.ts +44 -39
  72. package/speechflow-cli/src/speechflow-node-a2a-meter.ts +67 -44
  73. package/speechflow-cli/src/speechflow-node-a2a-rnnoise.ts +1 -0
  74. package/speechflow-cli/src/speechflow-node-a2a-vad.ts +2 -2
  75. package/speechflow-cli/src/speechflow-node-a2t-openai.ts +0 -6
  76. package/speechflow-cli/src/speechflow-node-t2a-amazon.ts +0 -6
  77. package/speechflow-cli/src/speechflow-node-t2a-elevenlabs.ts +0 -6
  78. package/speechflow-cli/src/speechflow-node-t2a-kokoro.ts +0 -6
  79. package/speechflow-cli/src/speechflow-node-t2t-ollama.ts +1 -1
  80. package/speechflow-cli/src/speechflow-node-t2t-subtitle.ts +10 -14
  81. package/speechflow-cli/src/speechflow-node-x2x-trace.ts +25 -2
  82. package/speechflow-cli/src/speechflow-node-xio-device.ts +3 -2
  83. package/speechflow-cli/src/speechflow-node-xio-websocket.ts +1 -1
  84. package/speechflow-cli/src/speechflow-util-audio.ts +30 -0
  85. package/speechflow-cli/src/speechflow-util-error.ts +9 -3
  86. package/speechflow-cli/src/speechflow-util-stream.ts +2 -2
  87. package/speechflow-ui-db/dst/index.js +24 -33
  88. package/speechflow-ui-db/package.json +14 -12
  89. package/speechflow-ui-db/src/app.vue +30 -7
  90. package/speechflow-ui-st/.claude/settings.local.json +3 -0
  91. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-BoldIt.eot +0 -0
  92. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-BoldIt.ttf +0 -0
  93. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-BoldIt.woff +0 -0
  94. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-RegularIt.eot +0 -0
  95. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-RegularIt.ttf +0 -0
  96. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-RegularIt.woff +0 -0
  97. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Semibold.eot +0 -0
  98. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Semibold.ttf +0 -0
  99. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-Semibold.woff +0 -0
  100. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-SemiboldIt.eot +0 -0
  101. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-SemiboldIt.ttf +0 -0
  102. package/speechflow-ui-st/dst/app-font-TypoPRO-SourceSansPro-SemiboldIt.woff +0 -0
  103. package/speechflow-ui-st/dst/index.css +2 -2
  104. package/speechflow-ui-st/dst/index.js +461 -28
  105. package/speechflow-ui-st/package.json +14 -13
  106. package/speechflow-ui-st/src/app.vue +150 -51
  107. package/speechflow-ui-st/src/index.ts +4 -0
  108. package/speechflow-cli/dst/speechflow-util-webaudio-wt.d.ts +0 -1
  109. package/speechflow-cli/dst/speechflow-util-webaudio-wt.js +0 -124
  110. package/speechflow-cli/dst/speechflow-util-webaudio-wt.js.map +0 -1
  111. package/speechflow-cli/dst/speechflow-util-webaudio.d.ts +0 -13
  112. package/speechflow-cli/dst/speechflow-util-webaudio.js +0 -137
  113. package/speechflow-cli/dst/speechflow-util-webaudio.js.map +0 -1
@@ -132,6 +132,36 @@ export async function processInt16ArrayInSegments (
132
132
  return data
133
133
  }
134
134
 
135
+ /* update envelope (smoothed amplitude contour) for single channel */
136
+ export function updateEnvelopeForChannel(
137
+ env: number[],
138
+ sampleRate: number,
139
+ chan: number,
140
+ samples: Float32Array,
141
+ attack: number,
142
+ release: number
143
+ ): number {
144
+ /* fetch old envelope value */
145
+ if (env[chan] === undefined)
146
+ env[chan] = 1e-12
147
+ let currentEnv = env[chan]
148
+
149
+ /* calculate attack/release alpha values */
150
+ const alphaA = Math.exp(-1 / (attack * sampleRate))
151
+ const alphaR = Math.exp(-1 / (release * sampleRate))
152
+
153
+ /* iterate over all samples and calculate RMS */
154
+ for (const s of samples) {
155
+ const x = Math.abs(s)
156
+ const det = x * x
157
+ if (det > currentEnv)
158
+ currentEnv = alphaA * currentEnv + (1 - alphaA) * det
159
+ else
160
+ currentEnv = alphaR * currentEnv + (1 - alphaR) * det
161
+ }
162
+ return Math.sqrt(Math.max(currentEnv, 1e-12))
163
+ }
164
+
135
165
  /* helper functions for linear/decibel conversions */
136
166
  export function lin2dB (x: number): number {
137
167
  return 20 * Math.log10(Math.max(x, 1e-12))
@@ -5,8 +5,8 @@
5
5
  */
6
6
 
7
7
  /* helper function for promise-based timeout */
8
- export function timeoutPromise (duration: number = 10 * 1000, info = "timeout") {
9
- return new Promise<void>((resolve, reject) => {
8
+ export function timeoutPromise<T = void> (duration: number = 10 * 1000, info = "timeout") {
9
+ return new Promise<T>((resolve, reject) => {
10
10
  setTimeout(() => { reject(new Error(info)) }, duration)
11
11
  })
12
12
  }
@@ -21,7 +21,13 @@ export function ensureError (error: unknown, prefix?: string, debug = false): Er
21
21
  msg = `${prefix}: ${msg}`
22
22
  if (debug && error instanceof Error)
23
23
  msg = `${msg}\n${error.stack}`
24
- return new Error(msg, { cause: error })
24
+ if (error instanceof Error) {
25
+ const err = new Error(msg, { cause: error })
26
+ err.stack = error.stack
27
+ return err
28
+ }
29
+ else
30
+ return new Error(msg)
25
31
  }
26
32
 
27
33
  /* helper function for retrieving a Promise object */
@@ -36,12 +36,12 @@ export function createTransformStreamForWritableSide () {
36
36
 
37
37
  /* create a Duplex/Transform stream which has
38
38
  object-mode on Readable side and buffer/string-mode on Writable side */
39
- export function createTransformStreamForReadableSide (type: "text" | "audio", getTimeZero: () => DateTime) {
39
+ export function createTransformStreamForReadableSide (type: "text" | "audio", getTimeZero: () => DateTime, highWaterMark?: number) {
40
40
  return new Stream.Transform({
41
41
  readableObjectMode: true,
42
42
  writableObjectMode: true,
43
43
  decodeStrings: false,
44
- highWaterMark: (type === "audio" ? 19200 : 65536), /* audio: 400ms @ 48kHz/16bit/mono, text: 64KB */
44
+ highWaterMark: highWaterMark ?? (type === "audio" ? 19200 : 65536), /* audio: 400ms @ 48kHz/16bit/mono, text: 64KB */
45
45
  transform (chunk: Buffer | string, encoding, callback) {
46
46
  if (chunk === null) {
47
47
  this.push(null)