sophontalk-services 0.0.11 → 0.0.12

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.
@@ -1,5 +1,5 @@
1
1
  import { env as m } from "onnxruntime-web";
2
- const v = 16e3, k = 25, P = 10, b = 80, N = 4, y = 0.97, L = 1e-10, C = 20, R = !0, F = !0, g = 25, D = 1e3 / g, h = {
2
+ const v = 16e3, k = 25, b = 10, P = 80, N = 4, y = 0.97, L = 1e-10, C = 20, F = !0, R = !0, g = 25, D = 1e3 / g, h = {
3
3
  workersPath: "/workers/",
4
4
  jsonUrl: "/complete_dataset.json",
5
5
  zipUrl: "/processed_images.zip"
@@ -196,14 +196,20 @@ class U {
196
196
  return this.def.promise;
197
197
  }
198
198
  run(e) {
199
+ if (e.audioFeatures.buffer.byteLength === 0) {
200
+ const t = "Audio features buffer is detached; pass a fresh buffer or avoid reusing transferred data.";
201
+ this.handlers.onError?.(t), this.emitter.emit("error", t);
202
+ return;
203
+ }
204
+ const r = new Float32Array(e.audioFeatures);
199
205
  this.worker.postMessage(
200
206
  {
201
207
  type: "run",
202
- audioFeatures: e.audioFeatures,
208
+ audioFeatures: r,
203
209
  audioDimensions: e.audioDimensions,
204
210
  reset: e.reset !== !1
205
211
  },
206
- [e.audioFeatures.buffer]
212
+ [r.buffer]
207
213
  );
208
214
  }
209
215
  createSilentFrameGenerator(e) {
@@ -221,14 +227,14 @@ export {
221
227
  L as ENERGY_FLOOR,
222
228
  D as FRAME_INTERVAL_MS,
223
229
  k as FRAME_LENGTH_MS,
224
- P as FRAME_SHIFT_MS,
230
+ b as FRAME_SHIFT_MS,
225
231
  Q as FeatureExtractor,
226
232
  U as InferenceEngine,
227
- b as NUM_MEL_BINS,
233
+ P as NUM_MEL_BINS,
228
234
  N as NUM_SEQUENCE_FRAMES,
229
235
  y as PREEMPH_COEFF,
230
- R as REMOVE_DC_OFFSET,
231
- F as ROUND_TO_POWER_OF_TWO,
236
+ F as REMOVE_DC_OFFSET,
237
+ R as ROUND_TO_POWER_OF_TWO,
232
238
  v as SAMPLE_RATE,
233
239
  g as TARGET_FPS,
234
240
  G as calculatePingPongState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sophontalk-services",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",