@octoseq/visualiser 0.1.0-main.0d2814e → 0.1.0-main.26cefa1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octoseq/visualiser",
3
- "version": "0.1.0-main.0d2814e",
3
+ "version": "0.1.0-main.26cefa1",
4
4
  "description": "WASM-based visualiser for Octoseq",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,6 +18,15 @@ export class WasmVisualiser {
18
18
  * The signal will be available as `inputs.<name>` in Rhai scripts.
19
19
  */
20
20
  push_signal(name: string, samples: Float32Array, sample_rate: number): void;
21
+ /**
22
+ * Run script in analysis mode to collect debug.emit() signals.
23
+ *
24
+ * This runs the script headlessly across the full track duration,
25
+ * collecting all debug.emit() calls without rendering.
26
+ *
27
+ * Returns a JSON-serialized AnalysisResultJson.
28
+ */
29
+ run_analysis(script: string, duration: number, time_step: number): string;
21
30
  /**
22
31
  * Clear all named signals.
23
32
  */
@@ -33,7 +42,33 @@ export class WasmVisualiser {
33
42
  * Get the last script error message, if any.
34
43
  */
35
44
  get_script_error(): string | undefined;
45
+ /**
46
+ * Get the list of available signal names.
47
+ * Returns a JSON array of signal names.
48
+ */
49
+ get_signal_names(): string;
50
+ /**
51
+ * Set the musical time structure for beat-aware signal processing.
52
+ * The JSON format matches the TypeScript MusicalTimeStructure type.
53
+ * Returns true if successful, false if parsing failed.
54
+ */
55
+ set_musical_time(json: string): boolean;
56
+ /**
57
+ * Clear the musical time structure.
58
+ * Beat-aware operations will fall back to 120 BPM default.
59
+ */
60
+ clear_musical_time(): void;
36
61
  push_rotation_data(samples: Float32Array, sample_rate: number): void;
62
+ /**
63
+ * Run script in analysis mode with event extraction support.
64
+ *
65
+ * This runs the script headlessly across the full track duration,
66
+ * collecting all debug.emit() calls AND extracting events from
67
+ * any signal.pick.events() calls.
68
+ *
69
+ * Returns a JSON-serialized ExtendedAnalysisResultJson.
70
+ */
71
+ run_analysis_with_events(script: string, duration: number, time_step: number): string;
37
72
  constructor();
38
73
  render(dt: number): void;
39
74
  resize(width: number, height: number): void;
@@ -51,9 +86,11 @@ export interface InitOutput {
51
86
  readonly memory: WebAssembly.Memory;
52
87
  readonly __wbg_wasmvisualiser_free: (a: number, b: number) => void;
53
88
  readonly create_visualiser: (a: any) => any;
89
+ readonly wasmvisualiser_clear_musical_time: (a: number) => void;
54
90
  readonly wasmvisualiser_clear_signals: (a: number) => void;
55
91
  readonly wasmvisualiser_get_current_vals: (a: number) => [number, number];
56
92
  readonly wasmvisualiser_get_script_error: (a: number) => [number, number];
93
+ readonly wasmvisualiser_get_signal_names: (a: number) => [number, number];
57
94
  readonly wasmvisualiser_has_script: (a: number) => number;
58
95
  readonly wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
59
96
  readonly wasmvisualiser_new: () => number;
@@ -62,14 +99,17 @@ export interface InitOutput {
62
99
  readonly wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
63
100
  readonly wasmvisualiser_render: (a: number, b: number) => void;
64
101
  readonly wasmvisualiser_resize: (a: number, b: number, c: number) => void;
102
+ readonly wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
103
+ readonly wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
104
+ readonly wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
65
105
  readonly wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
66
106
  readonly wasmvisualiser_set_time: (a: number, b: number) => void;
67
107
  readonly wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
68
108
  readonly init_panic_hook: () => void;
69
- readonly wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
70
- readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
71
109
  readonly wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
72
110
  readonly wasm_bindgen__closure__destroy__heb49a8f426ac2d2e: (a: number, b: number) => void;
111
+ readonly wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
112
+ readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
73
113
  readonly wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
74
114
  readonly __wbindgen_malloc: (a: number, b: number) => number;
75
115
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
package/pkg/visualiser.js CHANGED
@@ -241,14 +241,14 @@ if (!('encodeInto' in cachedTextEncoder)) {
241
241
 
242
242
  let WASM_VECTOR_LEN = 0;
243
243
 
244
- function wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2) {
245
- wasm.wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2);
246
- }
247
-
248
244
  function wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8(arg0, arg1, arg2) {
249
245
  wasm.wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8(arg0, arg1, arg2);
250
246
  }
251
247
 
248
+ function wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2) {
249
+ wasm.wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2);
250
+ }
251
+
252
252
  function wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba(arg0, arg1, arg2, arg3) {
253
253
  wasm.wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba(arg0, arg1, arg2, arg3);
254
254
  }
@@ -319,6 +319,32 @@ export class WasmVisualiser {
319
319
  const len1 = WASM_VECTOR_LEN;
320
320
  wasm.wasmvisualiser_push_signal(this.__wbg_ptr, ptr0, len0, ptr1, len1, sample_rate);
321
321
  }
322
+ /**
323
+ * Run script in analysis mode to collect debug.emit() signals.
324
+ *
325
+ * This runs the script headlessly across the full track duration,
326
+ * collecting all debug.emit() calls without rendering.
327
+ *
328
+ * Returns a JSON-serialized AnalysisResultJson.
329
+ * @param {string} script
330
+ * @param {number} duration
331
+ * @param {number} time_step
332
+ * @returns {string}
333
+ */
334
+ run_analysis(script, duration, time_step) {
335
+ let deferred2_0;
336
+ let deferred2_1;
337
+ try {
338
+ const ptr0 = passStringToWasm0(script, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
+ const len0 = WASM_VECTOR_LEN;
340
+ const ret = wasm.wasmvisualiser_run_analysis(this.__wbg_ptr, ptr0, len0, duration, time_step);
341
+ deferred2_0 = ret[0];
342
+ deferred2_1 = ret[1];
343
+ return getStringFromWasm0(ret[0], ret[1]);
344
+ } finally {
345
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
346
+ }
347
+ }
322
348
  /**
323
349
  * Clear all named signals.
324
350
  */
@@ -364,6 +390,43 @@ export class WasmVisualiser {
364
390
  }
365
391
  return v1;
366
392
  }
393
+ /**
394
+ * Get the list of available signal names.
395
+ * Returns a JSON array of signal names.
396
+ * @returns {string}
397
+ */
398
+ get_signal_names() {
399
+ let deferred1_0;
400
+ let deferred1_1;
401
+ try {
402
+ const ret = wasm.wasmvisualiser_get_signal_names(this.__wbg_ptr);
403
+ deferred1_0 = ret[0];
404
+ deferred1_1 = ret[1];
405
+ return getStringFromWasm0(ret[0], ret[1]);
406
+ } finally {
407
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
408
+ }
409
+ }
410
+ /**
411
+ * Set the musical time structure for beat-aware signal processing.
412
+ * The JSON format matches the TypeScript MusicalTimeStructure type.
413
+ * Returns true if successful, false if parsing failed.
414
+ * @param {string} json
415
+ * @returns {boolean}
416
+ */
417
+ set_musical_time(json) {
418
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
419
+ const len0 = WASM_VECTOR_LEN;
420
+ const ret = wasm.wasmvisualiser_set_musical_time(this.__wbg_ptr, ptr0, len0);
421
+ return ret !== 0;
422
+ }
423
+ /**
424
+ * Clear the musical time structure.
425
+ * Beat-aware operations will fall back to 120 BPM default.
426
+ */
427
+ clear_musical_time() {
428
+ wasm.wasmvisualiser_clear_musical_time(this.__wbg_ptr);
429
+ }
367
430
  /**
368
431
  * @param {Float32Array} samples
369
432
  * @param {number} sample_rate
@@ -373,6 +436,33 @@ export class WasmVisualiser {
373
436
  const len0 = WASM_VECTOR_LEN;
374
437
  wasm.wasmvisualiser_push_data(this.__wbg_ptr, ptr0, len0, sample_rate);
375
438
  }
439
+ /**
440
+ * Run script in analysis mode with event extraction support.
441
+ *
442
+ * This runs the script headlessly across the full track duration,
443
+ * collecting all debug.emit() calls AND extracting events from
444
+ * any signal.pick.events() calls.
445
+ *
446
+ * Returns a JSON-serialized ExtendedAnalysisResultJson.
447
+ * @param {string} script
448
+ * @param {number} duration
449
+ * @param {number} time_step
450
+ * @returns {string}
451
+ */
452
+ run_analysis_with_events(script, duration, time_step) {
453
+ let deferred2_0;
454
+ let deferred2_1;
455
+ try {
456
+ const ptr0 = passStringToWasm0(script, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
457
+ const len0 = WASM_VECTOR_LEN;
458
+ const ret = wasm.wasmvisualiser_run_analysis_with_events(this.__wbg_ptr, ptr0, len0, duration, time_step);
459
+ deferred2_0 = ret[0];
460
+ deferred2_1 = ret[1];
461
+ return getStringFromWasm0(ret[0], ret[1]);
462
+ } finally {
463
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
464
+ }
465
+ }
376
466
  constructor() {
377
467
  const ret = wasm.wasmvisualiser_new();
378
468
  this.__wbg_ptr = ret >>> 0;
@@ -1273,21 +1363,21 @@ function __wbg_get_imports() {
1273
1363
  imports.wbg.__wbg_writeTexture_246118eb2f5a1592 = function(arg0, arg1, arg2, arg3, arg4) {
1274
1364
  arg0.writeTexture(arg1, arg2, arg3, arg4);
1275
1365
  };
1276
- imports.wbg.__wbindgen_cast_1ad8672233d2fd7b = function(arg0, arg1) {
1277
- // Cast intrinsic for `Closure(Closure { dtor_idx: 2007, function: Function { arguments: [Externref], shim_idx: 2008, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1278
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
1279
- return ret;
1280
- };
1281
1366
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1282
1367
  // Cast intrinsic for `Ref(String) -> Externref`.
1283
1368
  const ret = getStringFromWasm0(arg0, arg1);
1284
1369
  return ret;
1285
1370
  };
1286
- imports.wbg.__wbindgen_cast_762879c56a766cac = function(arg0, arg1) {
1287
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1873, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 1874, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1371
+ imports.wbg.__wbindgen_cast_3ab85374d1bc89a0 = function(arg0, arg1) {
1372
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2084, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 2085, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1288
1373
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__heb49a8f426ac2d2e, wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8);
1289
1374
  return ret;
1290
1375
  };
1376
+ imports.wbg.__wbindgen_cast_c8fd0bbc5dfe7a9b = function(arg0, arg1) {
1377
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2218, function: Function { arguments: [Externref], shim_idx: 2219, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1378
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
1379
+ return ret;
1380
+ };
1291
1381
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1292
1382
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1293
1383
  const ret = getArrayU8FromWasm0(arg0, arg1);
Binary file
@@ -3,9 +3,11 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_wasmvisualiser_free: (a: number, b: number) => void;
5
5
  export const create_visualiser: (a: any) => any;
6
+ export const wasmvisualiser_clear_musical_time: (a: number) => void;
6
7
  export const wasmvisualiser_clear_signals: (a: number) => void;
7
8
  export const wasmvisualiser_get_current_vals: (a: number) => [number, number];
8
9
  export const wasmvisualiser_get_script_error: (a: number) => [number, number];
10
+ export const wasmvisualiser_get_signal_names: (a: number) => [number, number];
9
11
  export const wasmvisualiser_has_script: (a: number) => number;
10
12
  export const wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
11
13
  export const wasmvisualiser_new: () => number;
@@ -14,14 +16,17 @@ export const wasmvisualiser_push_signal: (a: number, b: number, c: number, d: nu
14
16
  export const wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
15
17
  export const wasmvisualiser_render: (a: number, b: number) => void;
16
18
  export const wasmvisualiser_resize: (a: number, b: number, c: number) => void;
19
+ export const wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
20
+ export const wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
21
+ export const wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
17
22
  export const wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
18
23
  export const wasmvisualiser_set_time: (a: number, b: number) => void;
19
24
  export const wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
20
25
  export const init_panic_hook: () => void;
21
- export const wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
22
- export const wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
23
26
  export const wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
24
27
  export const wasm_bindgen__closure__destroy__heb49a8f426ac2d2e: (a: number, b: number) => void;
28
+ export const wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
29
+ export const wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
25
30
  export const wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
26
31
  export const __wbindgen_malloc: (a: number, b: number) => number;
27
32
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;