@octoseq/visualiser 0.1.0-main.c336fba → 0.1.0-main.e1a2213

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.c336fba",
3
+ "version": "0.1.0-main.e1a2213",
4
4
  "description": "WASM-based visualiser for Octoseq",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -8,6 +8,10 @@ export class WasmVisualiser {
8
8
  * Check if a script is currently loaded.
9
9
  */
10
10
  has_script(): boolean;
11
+ /**
12
+ * Check if a signal variable exists in the current script.
13
+ */
14
+ has_signal(name: string): boolean;
11
15
  /**
12
16
  * Load a Rhai script for controlling the visualiser.
13
17
  * Returns true if the script was loaded successfully.
@@ -89,6 +93,18 @@ export class WasmVisualiser {
89
93
  * - `sample_rate`: Sample rate of the signal.
90
94
  */
91
95
  push_band_signal(band_id: string, band_label: string, feature: string, samples: Float32Array, sample_rate: number): void;
96
+ /**
97
+ * Push a stem-scoped signal for use in scripts.
98
+ * The signal will be available as `inputs.stems[stem_id].{feature}` in Rhai scripts.
99
+ * Stores under both stem_id and stem_label for dual-access support.
100
+ *
101
+ * - `stem_id`: The unique ID of the stem.
102
+ * - `stem_label`: The user-visible label of the stem.
103
+ * - `feature`: Signal type ("energy", "onset", "flux").
104
+ * - `samples`: Signal data.
105
+ * - `sample_rate`: Sample rate of the signal.
106
+ */
107
+ push_stem_signal(stem_id: string, stem_label: string, feature: string, samples: Float32Array, sample_rate: number): void;
92
108
  /**
93
109
  * Set the musical time structure for beat-aware signal processing.
94
110
  * The JSON format matches the TypeScript MusicalTimeStructure type.
@@ -99,6 +115,22 @@ export class WasmVisualiser {
99
115
  * Clear all band event streams.
100
116
  */
101
117
  clear_band_events(): void;
118
+ /**
119
+ * Push a named event stream (e.g., "beatCandidates") for script access.
120
+ *
121
+ * The event stream will be available as `inputs.<name>` in Rhai scripts.
122
+ * This is used for MIR-derived events like beat candidates, onset peaks, etc.
123
+ *
124
+ * The JSON format should be an array of event objects with:
125
+ * - time: f32
126
+ * - weight: f32
127
+ * - beat_position: Option<f32>
128
+ * - beat_phase: Option<f32>
129
+ * - cluster_id: Option<u32>
130
+ *
131
+ * Returns true if successful, false if parsing failed.
132
+ */
133
+ push_event_stream(name: string, events_json: string): boolean;
102
134
  /**
103
135
  * Set debug visualization options.
104
136
  */
@@ -112,12 +144,34 @@ export class WasmVisualiser {
112
144
  * Beat-aware operations will fall back to 120 BPM default.
113
145
  */
114
146
  clear_musical_time(): void;
147
+ /**
148
+ * Clear all stem signals.
149
+ */
150
+ clear_stem_signals(): void;
115
151
  /**
116
152
  * Get frequency bounds for all active bands at a given time.
117
153
  * Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
118
154
  */
119
155
  get_band_bounds_at(time: number): string;
156
+ /**
157
+ * Get all Signal variables from the current script.
158
+ * Returns a JSON array of ScriptSignalInfo objects.
159
+ */
160
+ get_script_signals(): string;
120
161
  push_rotation_data(samples: Float32Array, sample_rate: number): void;
162
+ /**
163
+ * Render with a frame budget timeout.
164
+ *
165
+ * If the frame takes longer than `budget_ms` to process, it will be dropped
166
+ * and a warning logged. This prevents expensive scripts from freezing the browser.
167
+ *
168
+ * Returns true if the frame completed, false if it was dropped due to budget.
169
+ */
170
+ render_with_budget(dt: number, budget_ms: number): boolean;
171
+ /**
172
+ * Clear all named event streams.
173
+ */
174
+ clear_event_streams(): void;
121
175
  /**
122
176
  * Check if frequency bands are currently set.
123
177
  */
@@ -128,12 +182,37 @@ export class WasmVisualiser {
128
182
  * Returns true if successful, false if parsing failed.
129
183
  */
130
184
  register_mesh_asset(asset_id: string, obj_content: string): boolean;
185
+ /**
186
+ * Set available stems for script namespace generation.
187
+ * This registers stem IDs and labels so the script engine can generate
188
+ * `inputs.stems["stem_id"]` and `inputs.stems["label"]` accessors.
189
+ *
190
+ * The JSON format should be an array of [id, label] pairs:
191
+ * `[["stem-abc123", "Drums"], ["stem-def456", "Bass"]]`
192
+ *
193
+ * Returns true if successful, false if parsing failed.
194
+ */
195
+ set_available_stems(json: string): boolean;
131
196
  /**
132
197
  * Set the frequency band structure for band-aware processing.
133
198
  * The JSON format matches the TypeScript FrequencyBandStructure type.
134
199
  * Returns true if successful, false if parsing failed.
135
200
  */
136
201
  set_frequency_bands(json: string): boolean;
202
+ /**
203
+ * Analyze a signal chain with localized sampling.
204
+ *
205
+ * Returns JSON with either:
206
+ * - SignalChainAnalysis on success
207
+ * - { "error": "message" } on failure
208
+ *
209
+ * Parameters:
210
+ * - signal_name: Name of the signal variable in the script
211
+ * - center_time: Time to center analysis around (seconds)
212
+ * - window_beats: Number of beats before/after center to sample
213
+ * - sample_count: Number of samples to take
214
+ */
215
+ analyze_signal_chain(signal_name: string, center_time: number, window_beats: number, sample_count: number): string;
137
216
  /**
138
217
  * Get the number of events for a specific band.
139
218
  * Returns 0 if no events are stored for this band.
@@ -144,15 +223,30 @@ export class WasmVisualiser {
144
223
  * Returns a JSON array of strings.
145
224
  */
146
225
  get_band_signal_keys(): string;
226
+ /**
227
+ * Get list of stem keys (IDs and labels) that have signals.
228
+ * Returns a JSON array of strings.
229
+ */
230
+ get_stem_signal_keys(): string;
147
231
  /**
148
232
  * Clear the frequency band structure.
149
233
  */
150
234
  clear_frequency_bands(): void;
235
+ /**
236
+ * Get camera state as JSON for inspector.
237
+ * Returns current position, rotation, target, fov, near, far, mode, and signal flags.
238
+ */
239
+ get_camera_state_json(): string;
151
240
  /**
152
241
  * Unregister a mesh asset.
153
242
  * Returns true if the asset was unregistered, false if it didn't exist.
154
243
  */
155
244
  unregister_mesh_asset(asset_id: string): boolean;
245
+ /**
246
+ * Get the number of events in a named event stream.
247
+ * Returns 0 if no events are stored for this name.
248
+ */
249
+ get_event_stream_count(name: string): number;
156
250
  /**
157
251
  * Get the number of frequency bands.
158
252
  */
@@ -167,6 +261,31 @@ export class WasmVisualiser {
167
261
  * Returns a JSON-serialized ExtendedAnalysisResultJson.
168
262
  */
169
263
  run_analysis_with_events(script: string, duration: number, time_step: number): string;
264
+ /**
265
+ * Get entity positions as JSON for debugging.
266
+ * Returns a JSON array of objects with id, type, and position fields.
267
+ */
268
+ get_entity_positions_json(): string;
269
+ /**
270
+ * Push an authored event stream for script access.
271
+ *
272
+ * The event stream will be available as `inputs.authored["name"]` in Rhai scripts.
273
+ * This is used for user-authored events (promoted or manually created).
274
+ *
275
+ * The JSON format should be an array of event objects with:
276
+ * - time: f32
277
+ * - weight: f32
278
+ * - beat_position: Option<f32>
279
+ * - beat_phase: Option<f32>
280
+ * - cluster_id: Option<u32>
281
+ *
282
+ * Returns true if successful, false if parsing failed.
283
+ */
284
+ push_authored_event_stream(name: string, events_json: string): boolean;
285
+ /**
286
+ * Clear all authored event streams.
287
+ */
288
+ clear_authored_event_streams(): void;
170
289
  /**
171
290
  * Drain and return any pending structured script diagnostics as JSON.
172
291
  *
@@ -174,6 +293,11 @@ export class WasmVisualiser {
174
293
  * queue so repeated polling does not duplicate messages.
175
294
  */
176
295
  take_script_diagnostics_json(): string;
296
+ /**
297
+ * Get the number of events in an authored event stream.
298
+ * Returns 0 if no events are stored for this name.
299
+ */
300
+ get_authored_event_stream_count(name: string): number;
177
301
  constructor();
178
302
  render(dt: number): void;
179
303
  resize(width: number, height: number): void;
@@ -201,35 +325,51 @@ export interface InitOutput {
201
325
  readonly __wbg_wasmvisualiser_free: (a: number, b: number) => void;
202
326
  readonly create_visualiser: (a: any) => any;
203
327
  readonly get_script_api_metadata_json: () => [number, number];
328
+ readonly wasmvisualiser_analyze_signal_chain: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
329
+ readonly wasmvisualiser_clear_authored_event_streams: (a: number) => void;
204
330
  readonly wasmvisualiser_clear_band_events: (a: number) => void;
205
331
  readonly wasmvisualiser_clear_band_signals: (a: number) => void;
332
+ readonly wasmvisualiser_clear_event_streams: (a: number) => void;
206
333
  readonly wasmvisualiser_clear_frequency_bands: (a: number) => void;
207
334
  readonly wasmvisualiser_clear_isolation: (a: number) => void;
208
335
  readonly wasmvisualiser_clear_musical_time: (a: number) => void;
209
336
  readonly wasmvisualiser_clear_signals: (a: number) => void;
337
+ readonly wasmvisualiser_clear_stem_signals: (a: number) => void;
338
+ readonly wasmvisualiser_get_authored_event_stream_count: (a: number, b: number, c: number) => number;
210
339
  readonly wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
211
340
  readonly wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
212
341
  readonly wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
342
+ readonly wasmvisualiser_get_camera_state_json: (a: number) => [number, number];
213
343
  readonly wasmvisualiser_get_current_vals: (a: number) => [number, number];
344
+ readonly wasmvisualiser_get_entity_positions_json: (a: number) => [number, number];
345
+ readonly wasmvisualiser_get_event_stream_count: (a: number, b: number, c: number) => number;
214
346
  readonly wasmvisualiser_get_frequency_band_count: (a: number) => number;
215
347
  readonly wasmvisualiser_get_script_error: (a: number) => [number, number];
348
+ readonly wasmvisualiser_get_script_signals: (a: number) => [number, number];
216
349
  readonly wasmvisualiser_get_signal_names: (a: number) => [number, number];
350
+ readonly wasmvisualiser_get_stem_signal_keys: (a: number) => [number, number];
217
351
  readonly wasmvisualiser_has_frequency_bands: (a: number) => number;
218
352
  readonly wasmvisualiser_has_script: (a: number) => number;
353
+ readonly wasmvisualiser_has_signal: (a: number, b: number, c: number) => number;
219
354
  readonly wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
220
355
  readonly wasmvisualiser_list_mesh_assets: (a: number) => [number, number];
221
356
  readonly wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
222
357
  readonly wasmvisualiser_new: () => number;
358
+ readonly wasmvisualiser_push_authored_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
223
359
  readonly wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
224
360
  readonly wasmvisualiser_push_band_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
225
361
  readonly wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
362
+ readonly wasmvisualiser_push_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
226
363
  readonly wasmvisualiser_push_signal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
364
+ readonly wasmvisualiser_push_stem_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
227
365
  readonly wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
228
366
  readonly wasmvisualiser_register_mesh_asset: (a: number, b: number, c: number, d: number, e: number) => number;
229
367
  readonly wasmvisualiser_render: (a: number, b: number) => void;
368
+ readonly wasmvisualiser_render_with_budget: (a: number, b: number, c: number) => number;
230
369
  readonly wasmvisualiser_resize: (a: number, b: number, c: number) => void;
231
370
  readonly wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
232
371
  readonly wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
372
+ readonly wasmvisualiser_set_available_stems: (a: number, b: number, c: number) => number;
233
373
  readonly wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
234
374
  readonly wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
235
375
  readonly wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
@@ -239,10 +379,10 @@ export interface InitOutput {
239
379
  readonly wasmvisualiser_unregister_mesh_asset: (a: number, b: number, c: number) => number;
240
380
  readonly wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
241
381
  readonly init_panic_hook: () => void;
242
- readonly wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
243
- readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
244
382
  readonly wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
245
383
  readonly wasm_bindgen__closure__destroy__heb49a8f426ac2d2e: (a: number, b: number) => void;
384
+ readonly wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
385
+ readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
246
386
  readonly wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
247
387
  readonly __wbindgen_malloc: (a: number, b: number) => number;
248
388
  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
  }
@@ -293,6 +293,17 @@ export class WasmVisualiser {
293
293
  const ret = wasm.wasmvisualiser_has_script(this.__wbg_ptr);
294
294
  return ret !== 0;
295
295
  }
296
+ /**
297
+ * Check if a signal variable exists in the current script.
298
+ * @param {string} name
299
+ * @returns {boolean}
300
+ */
301
+ has_signal(name) {
302
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
303
+ const len0 = WASM_VECTOR_LEN;
304
+ const ret = wasm.wasmvisualiser_has_signal(this.__wbg_ptr, ptr0, len0);
305
+ return ret !== 0;
306
+ }
296
307
  /**
297
308
  * Load a Rhai script for controlling the visualiser.
298
309
  * Returns true if the script was loaded successfully.
@@ -491,6 +502,33 @@ export class WasmVisualiser {
491
502
  const len3 = WASM_VECTOR_LEN;
492
503
  wasm.wasmvisualiser_push_band_signal(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, sample_rate);
493
504
  }
505
+ /**
506
+ * Push a stem-scoped signal for use in scripts.
507
+ * The signal will be available as `inputs.stems[stem_id].{feature}` in Rhai scripts.
508
+ * Stores under both stem_id and stem_label for dual-access support.
509
+ *
510
+ * - `stem_id`: The unique ID of the stem.
511
+ * - `stem_label`: The user-visible label of the stem.
512
+ * - `feature`: Signal type ("energy", "onset", "flux").
513
+ * - `samples`: Signal data.
514
+ * - `sample_rate`: Sample rate of the signal.
515
+ * @param {string} stem_id
516
+ * @param {string} stem_label
517
+ * @param {string} feature
518
+ * @param {Float32Array} samples
519
+ * @param {number} sample_rate
520
+ */
521
+ push_stem_signal(stem_id, stem_label, feature, samples, sample_rate) {
522
+ const ptr0 = passStringToWasm0(stem_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
523
+ const len0 = WASM_VECTOR_LEN;
524
+ const ptr1 = passStringToWasm0(stem_label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
525
+ const len1 = WASM_VECTOR_LEN;
526
+ const ptr2 = passStringToWasm0(feature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
527
+ const len2 = WASM_VECTOR_LEN;
528
+ const ptr3 = passArrayF32ToWasm0(samples, wasm.__wbindgen_malloc);
529
+ const len3 = WASM_VECTOR_LEN;
530
+ wasm.wasmvisualiser_push_stem_signal(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, sample_rate);
531
+ }
494
532
  /**
495
533
  * Set the musical time structure for beat-aware signal processing.
496
534
  * The JSON format matches the TypeScript MusicalTimeStructure type.
@@ -510,6 +548,32 @@ export class WasmVisualiser {
510
548
  clear_band_events() {
511
549
  wasm.wasmvisualiser_clear_band_events(this.__wbg_ptr);
512
550
  }
551
+ /**
552
+ * Push a named event stream (e.g., "beatCandidates") for script access.
553
+ *
554
+ * The event stream will be available as `inputs.<name>` in Rhai scripts.
555
+ * This is used for MIR-derived events like beat candidates, onset peaks, etc.
556
+ *
557
+ * The JSON format should be an array of event objects with:
558
+ * - time: f32
559
+ * - weight: f32
560
+ * - beat_position: Option<f32>
561
+ * - beat_phase: Option<f32>
562
+ * - cluster_id: Option<u32>
563
+ *
564
+ * Returns true if successful, false if parsing failed.
565
+ * @param {string} name
566
+ * @param {string} events_json
567
+ * @returns {boolean}
568
+ */
569
+ push_event_stream(name, events_json) {
570
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
571
+ const len0 = WASM_VECTOR_LEN;
572
+ const ptr1 = passStringToWasm0(events_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
573
+ const len1 = WASM_VECTOR_LEN;
574
+ const ret = wasm.wasmvisualiser_push_event_stream(this.__wbg_ptr, ptr0, len0, ptr1, len1);
575
+ return ret !== 0;
576
+ }
513
577
  /**
514
578
  * Set debug visualization options.
515
579
  * @param {boolean} wireframe
@@ -531,6 +595,12 @@ export class WasmVisualiser {
531
595
  clear_musical_time() {
532
596
  wasm.wasmvisualiser_clear_musical_time(this.__wbg_ptr);
533
597
  }
598
+ /**
599
+ * Clear all stem signals.
600
+ */
601
+ clear_stem_signals() {
602
+ wasm.wasmvisualiser_clear_stem_signals(this.__wbg_ptr);
603
+ }
534
604
  /**
535
605
  * Get frequency bounds for all active bands at a given time.
536
606
  * Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
@@ -549,6 +619,23 @@ export class WasmVisualiser {
549
619
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
550
620
  }
551
621
  }
622
+ /**
623
+ * Get all Signal variables from the current script.
624
+ * Returns a JSON array of ScriptSignalInfo objects.
625
+ * @returns {string}
626
+ */
627
+ get_script_signals() {
628
+ let deferred1_0;
629
+ let deferred1_1;
630
+ try {
631
+ const ret = wasm.wasmvisualiser_get_script_signals(this.__wbg_ptr);
632
+ deferred1_0 = ret[0];
633
+ deferred1_1 = ret[1];
634
+ return getStringFromWasm0(ret[0], ret[1]);
635
+ } finally {
636
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
637
+ }
638
+ }
552
639
  /**
553
640
  * @param {Float32Array} samples
554
641
  * @param {number} sample_rate
@@ -558,6 +645,27 @@ export class WasmVisualiser {
558
645
  const len0 = WASM_VECTOR_LEN;
559
646
  wasm.wasmvisualiser_push_data(this.__wbg_ptr, ptr0, len0, sample_rate);
560
647
  }
648
+ /**
649
+ * Render with a frame budget timeout.
650
+ *
651
+ * If the frame takes longer than `budget_ms` to process, it will be dropped
652
+ * and a warning logged. This prevents expensive scripts from freezing the browser.
653
+ *
654
+ * Returns true if the frame completed, false if it was dropped due to budget.
655
+ * @param {number} dt
656
+ * @param {number} budget_ms
657
+ * @returns {boolean}
658
+ */
659
+ render_with_budget(dt, budget_ms) {
660
+ const ret = wasm.wasmvisualiser_render_with_budget(this.__wbg_ptr, dt, budget_ms);
661
+ return ret !== 0;
662
+ }
663
+ /**
664
+ * Clear all named event streams.
665
+ */
666
+ clear_event_streams() {
667
+ wasm.wasmvisualiser_clear_event_streams(this.__wbg_ptr);
668
+ }
561
669
  /**
562
670
  * Check if frequency bands are currently set.
563
671
  * @returns {boolean}
@@ -582,6 +690,24 @@ export class WasmVisualiser {
582
690
  const ret = wasm.wasmvisualiser_register_mesh_asset(this.__wbg_ptr, ptr0, len0, ptr1, len1);
583
691
  return ret !== 0;
584
692
  }
693
+ /**
694
+ * Set available stems for script namespace generation.
695
+ * This registers stem IDs and labels so the script engine can generate
696
+ * `inputs.stems["stem_id"]` and `inputs.stems["label"]` accessors.
697
+ *
698
+ * The JSON format should be an array of [id, label] pairs:
699
+ * `[["stem-abc123", "Drums"], ["stem-def456", "Bass"]]`
700
+ *
701
+ * Returns true if successful, false if parsing failed.
702
+ * @param {string} json
703
+ * @returns {boolean}
704
+ */
705
+ set_available_stems(json) {
706
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
707
+ const len0 = WASM_VECTOR_LEN;
708
+ const ret = wasm.wasmvisualiser_set_available_stems(this.__wbg_ptr, ptr0, len0);
709
+ return ret !== 0;
710
+ }
585
711
  /**
586
712
  * Set the frequency band structure for band-aware processing.
587
713
  * The JSON format matches the TypeScript FrequencyBandStructure type.
@@ -595,6 +721,38 @@ export class WasmVisualiser {
595
721
  const ret = wasm.wasmvisualiser_set_frequency_bands(this.__wbg_ptr, ptr0, len0);
596
722
  return ret !== 0;
597
723
  }
724
+ /**
725
+ * Analyze a signal chain with localized sampling.
726
+ *
727
+ * Returns JSON with either:
728
+ * - SignalChainAnalysis on success
729
+ * - { "error": "message" } on failure
730
+ *
731
+ * Parameters:
732
+ * - signal_name: Name of the signal variable in the script
733
+ * - center_time: Time to center analysis around (seconds)
734
+ * - window_beats: Number of beats before/after center to sample
735
+ * - sample_count: Number of samples to take
736
+ * @param {string} signal_name
737
+ * @param {number} center_time
738
+ * @param {number} window_beats
739
+ * @param {number} sample_count
740
+ * @returns {string}
741
+ */
742
+ analyze_signal_chain(signal_name, center_time, window_beats, sample_count) {
743
+ let deferred2_0;
744
+ let deferred2_1;
745
+ try {
746
+ const ptr0 = passStringToWasm0(signal_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
747
+ const len0 = WASM_VECTOR_LEN;
748
+ const ret = wasm.wasmvisualiser_analyze_signal_chain(this.__wbg_ptr, ptr0, len0, center_time, window_beats, sample_count);
749
+ deferred2_0 = ret[0];
750
+ deferred2_1 = ret[1];
751
+ return getStringFromWasm0(ret[0], ret[1]);
752
+ } finally {
753
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
754
+ }
755
+ }
598
756
  /**
599
757
  * Get the number of events for a specific band.
600
758
  * Returns 0 if no events are stored for this band.
@@ -624,12 +782,46 @@ export class WasmVisualiser {
624
782
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
625
783
  }
626
784
  }
785
+ /**
786
+ * Get list of stem keys (IDs and labels) that have signals.
787
+ * Returns a JSON array of strings.
788
+ * @returns {string}
789
+ */
790
+ get_stem_signal_keys() {
791
+ let deferred1_0;
792
+ let deferred1_1;
793
+ try {
794
+ const ret = wasm.wasmvisualiser_get_stem_signal_keys(this.__wbg_ptr);
795
+ deferred1_0 = ret[0];
796
+ deferred1_1 = ret[1];
797
+ return getStringFromWasm0(ret[0], ret[1]);
798
+ } finally {
799
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
800
+ }
801
+ }
627
802
  /**
628
803
  * Clear the frequency band structure.
629
804
  */
630
805
  clear_frequency_bands() {
631
806
  wasm.wasmvisualiser_clear_frequency_bands(this.__wbg_ptr);
632
807
  }
808
+ /**
809
+ * Get camera state as JSON for inspector.
810
+ * Returns current position, rotation, target, fov, near, far, mode, and signal flags.
811
+ * @returns {string}
812
+ */
813
+ get_camera_state_json() {
814
+ let deferred1_0;
815
+ let deferred1_1;
816
+ try {
817
+ const ret = wasm.wasmvisualiser_get_camera_state_json(this.__wbg_ptr);
818
+ deferred1_0 = ret[0];
819
+ deferred1_1 = ret[1];
820
+ return getStringFromWasm0(ret[0], ret[1]);
821
+ } finally {
822
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
823
+ }
824
+ }
633
825
  /**
634
826
  * Unregister a mesh asset.
635
827
  * Returns true if the asset was unregistered, false if it didn't exist.
@@ -642,6 +834,18 @@ export class WasmVisualiser {
642
834
  const ret = wasm.wasmvisualiser_unregister_mesh_asset(this.__wbg_ptr, ptr0, len0);
643
835
  return ret !== 0;
644
836
  }
837
+ /**
838
+ * Get the number of events in a named event stream.
839
+ * Returns 0 if no events are stored for this name.
840
+ * @param {string} name
841
+ * @returns {number}
842
+ */
843
+ get_event_stream_count(name) {
844
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
845
+ const len0 = WASM_VECTOR_LEN;
846
+ const ret = wasm.wasmvisualiser_get_event_stream_count(this.__wbg_ptr, ptr0, len0);
847
+ return ret >>> 0;
848
+ }
645
849
  /**
646
850
  * Get the number of frequency bands.
647
851
  * @returns {number}
@@ -677,6 +881,55 @@ export class WasmVisualiser {
677
881
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
678
882
  }
679
883
  }
884
+ /**
885
+ * Get entity positions as JSON for debugging.
886
+ * Returns a JSON array of objects with id, type, and position fields.
887
+ * @returns {string}
888
+ */
889
+ get_entity_positions_json() {
890
+ let deferred1_0;
891
+ let deferred1_1;
892
+ try {
893
+ const ret = wasm.wasmvisualiser_get_entity_positions_json(this.__wbg_ptr);
894
+ deferred1_0 = ret[0];
895
+ deferred1_1 = ret[1];
896
+ return getStringFromWasm0(ret[0], ret[1]);
897
+ } finally {
898
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
899
+ }
900
+ }
901
+ /**
902
+ * Push an authored event stream for script access.
903
+ *
904
+ * The event stream will be available as `inputs.authored["name"]` in Rhai scripts.
905
+ * This is used for user-authored events (promoted or manually created).
906
+ *
907
+ * The JSON format should be an array of event objects with:
908
+ * - time: f32
909
+ * - weight: f32
910
+ * - beat_position: Option<f32>
911
+ * - beat_phase: Option<f32>
912
+ * - cluster_id: Option<u32>
913
+ *
914
+ * Returns true if successful, false if parsing failed.
915
+ * @param {string} name
916
+ * @param {string} events_json
917
+ * @returns {boolean}
918
+ */
919
+ push_authored_event_stream(name, events_json) {
920
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
921
+ const len0 = WASM_VECTOR_LEN;
922
+ const ptr1 = passStringToWasm0(events_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
923
+ const len1 = WASM_VECTOR_LEN;
924
+ const ret = wasm.wasmvisualiser_push_authored_event_stream(this.__wbg_ptr, ptr0, len0, ptr1, len1);
925
+ return ret !== 0;
926
+ }
927
+ /**
928
+ * Clear all authored event streams.
929
+ */
930
+ clear_authored_event_streams() {
931
+ wasm.wasmvisualiser_clear_authored_event_streams(this.__wbg_ptr);
932
+ }
680
933
  /**
681
934
  * Drain and return any pending structured script diagnostics as JSON.
682
935
  *
@@ -696,6 +949,18 @@ export class WasmVisualiser {
696
949
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
697
950
  }
698
951
  }
952
+ /**
953
+ * Get the number of events in an authored event stream.
954
+ * Returns 0 if no events are stored for this name.
955
+ * @param {string} name
956
+ * @returns {number}
957
+ */
958
+ get_authored_event_stream_count(name) {
959
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
960
+ const len0 = WASM_VECTOR_LEN;
961
+ const ret = wasm.wasmvisualiser_get_authored_event_stream_count(this.__wbg_ptr, ptr0, len0);
962
+ return ret >>> 0;
963
+ }
699
964
  constructor() {
700
965
  const ret = wasm.wasmvisualiser_new();
701
966
  this.__wbg_ptr = ret >>> 0;
@@ -1414,6 +1679,10 @@ function __wbg_get_imports() {
1414
1679
  const ret = arg0.offset;
1415
1680
  return ret;
1416
1681
  };
1682
+ imports.wbg.__wbg_performance_c77a440eff2efd9b = function(arg0) {
1683
+ const ret = arg0.performance;
1684
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1685
+ };
1417
1686
  imports.wbg.__wbg_popErrorScope_af0b22f136a861d6 = function(arg0) {
1418
1687
  const ret = arg0.popErrorScope();
1419
1688
  return ret;
@@ -1622,16 +1891,11 @@ function __wbg_get_imports() {
1622
1891
  const ret = getStringFromWasm0(arg0, arg1);
1623
1892
  return ret;
1624
1893
  };
1625
- imports.wbg.__wbindgen_cast_9983f14242864161 = function(arg0, arg1) {
1626
- // Cast intrinsic for `Closure(Closure { dtor_idx: 2225, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 2226, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1894
+ imports.wbg.__wbindgen_cast_b743f52d3f95a85b = function(arg0, arg1) {
1895
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3213, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 3214, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1627
1896
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__heb49a8f426ac2d2e, wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8);
1628
1897
  return ret;
1629
1898
  };
1630
- imports.wbg.__wbindgen_cast_adb0bbfefc4aa204 = function(arg0, arg1) {
1631
- // Cast intrinsic for `Closure(Closure { dtor_idx: 2357, function: Function { arguments: [Externref], shim_idx: 2358, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1632
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
1633
- return ret;
1634
- };
1635
1899
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1636
1900
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1637
1901
  const ret = getArrayU8FromWasm0(arg0, arg1);
@@ -1642,6 +1906,11 @@ function __wbg_get_imports() {
1642
1906
  const ret = arg0;
1643
1907
  return ret;
1644
1908
  };
1909
+ imports.wbg.__wbindgen_cast_f3b2b39be0a941e7 = function(arg0, arg1) {
1910
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3345, function: Function { arguments: [Externref], shim_idx: 3346, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1911
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
1912
+ return ret;
1913
+ };
1645
1914
  imports.wbg.__wbindgen_init_externref_table = function() {
1646
1915
  const table = wasm.__wbindgen_externrefs;
1647
1916
  const offset = table.grow(4);
Binary file
@@ -4,35 +4,51 @@ 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
6
  export const get_script_api_metadata_json: () => [number, number];
7
+ export const wasmvisualiser_analyze_signal_chain: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
8
+ export const wasmvisualiser_clear_authored_event_streams: (a: number) => void;
7
9
  export const wasmvisualiser_clear_band_events: (a: number) => void;
8
10
  export const wasmvisualiser_clear_band_signals: (a: number) => void;
11
+ export const wasmvisualiser_clear_event_streams: (a: number) => void;
9
12
  export const wasmvisualiser_clear_frequency_bands: (a: number) => void;
10
13
  export const wasmvisualiser_clear_isolation: (a: number) => void;
11
14
  export const wasmvisualiser_clear_musical_time: (a: number) => void;
12
15
  export const wasmvisualiser_clear_signals: (a: number) => void;
16
+ export const wasmvisualiser_clear_stem_signals: (a: number) => void;
17
+ export const wasmvisualiser_get_authored_event_stream_count: (a: number, b: number, c: number) => number;
13
18
  export const wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
14
19
  export const wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
15
20
  export const wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
21
+ export const wasmvisualiser_get_camera_state_json: (a: number) => [number, number];
16
22
  export const wasmvisualiser_get_current_vals: (a: number) => [number, number];
23
+ export const wasmvisualiser_get_entity_positions_json: (a: number) => [number, number];
24
+ export const wasmvisualiser_get_event_stream_count: (a: number, b: number, c: number) => number;
17
25
  export const wasmvisualiser_get_frequency_band_count: (a: number) => number;
18
26
  export const wasmvisualiser_get_script_error: (a: number) => [number, number];
27
+ export const wasmvisualiser_get_script_signals: (a: number) => [number, number];
19
28
  export const wasmvisualiser_get_signal_names: (a: number) => [number, number];
29
+ export const wasmvisualiser_get_stem_signal_keys: (a: number) => [number, number];
20
30
  export const wasmvisualiser_has_frequency_bands: (a: number) => number;
21
31
  export const wasmvisualiser_has_script: (a: number) => number;
32
+ export const wasmvisualiser_has_signal: (a: number, b: number, c: number) => number;
22
33
  export const wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
23
34
  export const wasmvisualiser_list_mesh_assets: (a: number) => [number, number];
24
35
  export const wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
25
36
  export const wasmvisualiser_new: () => number;
37
+ export const wasmvisualiser_push_authored_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
26
38
  export const wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
27
39
  export const wasmvisualiser_push_band_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
28
40
  export const wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
41
+ export const wasmvisualiser_push_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
29
42
  export const wasmvisualiser_push_signal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
43
+ export const wasmvisualiser_push_stem_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
30
44
  export const wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
31
45
  export const wasmvisualiser_register_mesh_asset: (a: number, b: number, c: number, d: number, e: number) => number;
32
46
  export const wasmvisualiser_render: (a: number, b: number) => void;
47
+ export const wasmvisualiser_render_with_budget: (a: number, b: number, c: number) => number;
33
48
  export const wasmvisualiser_resize: (a: number, b: number, c: number) => void;
34
49
  export const wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
35
50
  export const wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
51
+ export const wasmvisualiser_set_available_stems: (a: number, b: number, c: number) => number;
36
52
  export const wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
37
53
  export const wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
38
54
  export const wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
@@ -42,10 +58,10 @@ export const wasmvisualiser_take_script_diagnostics_json: (a: number) => [number
42
58
  export const wasmvisualiser_unregister_mesh_asset: (a: number, b: number, c: number) => number;
43
59
  export const wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
44
60
  export const init_panic_hook: () => void;
45
- export const wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
46
- export const wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
47
61
  export const wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
48
62
  export const wasm_bindgen__closure__destroy__heb49a8f426ac2d2e: (a: number, b: number) => void;
63
+ export const wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
64
+ export const wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
49
65
  export const wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
50
66
  export const __wbindgen_malloc: (a: number, b: number) => number;
51
67
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;