@octoseq/visualiser 0.1.0-main.d9e42ef → 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 +1 -1
- package/pkg/visualiser.d.ts +99 -3
- package/pkg/visualiser.js +200 -11
- package/pkg/visualiser_bg.wasm +0 -0
- package/pkg/visualiser_bg.wasm.d.ts +14 -3
package/package.json
CHANGED
package/pkg/visualiser.d.ts
CHANGED
|
@@ -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.
|
|
@@ -128,11 +144,20 @@ export class WasmVisualiser {
|
|
|
128
144
|
* Beat-aware operations will fall back to 120 BPM default.
|
|
129
145
|
*/
|
|
130
146
|
clear_musical_time(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Clear all stem signals.
|
|
149
|
+
*/
|
|
150
|
+
clear_stem_signals(): void;
|
|
131
151
|
/**
|
|
132
152
|
* Get frequency bounds for all active bands at a given time.
|
|
133
153
|
* Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
|
|
134
154
|
*/
|
|
135
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;
|
|
136
161
|
push_rotation_data(samples: Float32Array, sample_rate: number): void;
|
|
137
162
|
/**
|
|
138
163
|
* Render with a frame budget timeout.
|
|
@@ -157,12 +182,37 @@ export class WasmVisualiser {
|
|
|
157
182
|
* Returns true if successful, false if parsing failed.
|
|
158
183
|
*/
|
|
159
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;
|
|
160
196
|
/**
|
|
161
197
|
* Set the frequency band structure for band-aware processing.
|
|
162
198
|
* The JSON format matches the TypeScript FrequencyBandStructure type.
|
|
163
199
|
* Returns true if successful, false if parsing failed.
|
|
164
200
|
*/
|
|
165
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;
|
|
166
216
|
/**
|
|
167
217
|
* Get the number of events for a specific band.
|
|
168
218
|
* Returns 0 if no events are stored for this band.
|
|
@@ -173,10 +223,20 @@ export class WasmVisualiser {
|
|
|
173
223
|
* Returns a JSON array of strings.
|
|
174
224
|
*/
|
|
175
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;
|
|
176
231
|
/**
|
|
177
232
|
* Clear the frequency band structure.
|
|
178
233
|
*/
|
|
179
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;
|
|
180
240
|
/**
|
|
181
241
|
* Unregister a mesh asset.
|
|
182
242
|
* Returns true if the asset was unregistered, false if it didn't exist.
|
|
@@ -206,6 +266,26 @@ export class WasmVisualiser {
|
|
|
206
266
|
* Returns a JSON array of objects with id, type, and position fields.
|
|
207
267
|
*/
|
|
208
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;
|
|
209
289
|
/**
|
|
210
290
|
* Drain and return any pending structured script diagnostics as JSON.
|
|
211
291
|
*
|
|
@@ -213,6 +293,11 @@ export class WasmVisualiser {
|
|
|
213
293
|
* queue so repeated polling does not duplicate messages.
|
|
214
294
|
*/
|
|
215
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;
|
|
216
301
|
constructor();
|
|
217
302
|
render(dt: number): void;
|
|
218
303
|
resize(width: number, height: number): void;
|
|
@@ -240,6 +325,8 @@ export interface InitOutput {
|
|
|
240
325
|
readonly __wbg_wasmvisualiser_free: (a: number, b: number) => void;
|
|
241
326
|
readonly create_visualiser: (a: any) => any;
|
|
242
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;
|
|
243
330
|
readonly wasmvisualiser_clear_band_events: (a: number) => void;
|
|
244
331
|
readonly wasmvisualiser_clear_band_signals: (a: number) => void;
|
|
245
332
|
readonly wasmvisualiser_clear_event_streams: (a: number) => void;
|
|
@@ -247,26 +334,34 @@ export interface InitOutput {
|
|
|
247
334
|
readonly wasmvisualiser_clear_isolation: (a: number) => void;
|
|
248
335
|
readonly wasmvisualiser_clear_musical_time: (a: number) => void;
|
|
249
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;
|
|
250
339
|
readonly wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
|
|
251
340
|
readonly wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
|
|
252
341
|
readonly wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
|
|
342
|
+
readonly wasmvisualiser_get_camera_state_json: (a: number) => [number, number];
|
|
253
343
|
readonly wasmvisualiser_get_current_vals: (a: number) => [number, number];
|
|
254
344
|
readonly wasmvisualiser_get_entity_positions_json: (a: number) => [number, number];
|
|
255
345
|
readonly wasmvisualiser_get_event_stream_count: (a: number, b: number, c: number) => number;
|
|
256
346
|
readonly wasmvisualiser_get_frequency_band_count: (a: number) => number;
|
|
257
347
|
readonly wasmvisualiser_get_script_error: (a: number) => [number, number];
|
|
348
|
+
readonly wasmvisualiser_get_script_signals: (a: number) => [number, number];
|
|
258
349
|
readonly wasmvisualiser_get_signal_names: (a: number) => [number, number];
|
|
350
|
+
readonly wasmvisualiser_get_stem_signal_keys: (a: number) => [number, number];
|
|
259
351
|
readonly wasmvisualiser_has_frequency_bands: (a: number) => number;
|
|
260
352
|
readonly wasmvisualiser_has_script: (a: number) => number;
|
|
353
|
+
readonly wasmvisualiser_has_signal: (a: number, b: number, c: number) => number;
|
|
261
354
|
readonly wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
|
|
262
355
|
readonly wasmvisualiser_list_mesh_assets: (a: number) => [number, number];
|
|
263
356
|
readonly wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
|
|
264
357
|
readonly wasmvisualiser_new: () => number;
|
|
358
|
+
readonly wasmvisualiser_push_authored_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
265
359
|
readonly wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
266
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;
|
|
267
361
|
readonly wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
|
|
268
362
|
readonly wasmvisualiser_push_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
269
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;
|
|
270
365
|
readonly wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
|
|
271
366
|
readonly wasmvisualiser_register_mesh_asset: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
272
367
|
readonly wasmvisualiser_render: (a: number, b: number) => void;
|
|
@@ -274,6 +369,7 @@ export interface InitOutput {
|
|
|
274
369
|
readonly wasmvisualiser_resize: (a: number, b: number, c: number) => void;
|
|
275
370
|
readonly wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
276
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;
|
|
277
373
|
readonly wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
|
|
278
374
|
readonly wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
|
|
279
375
|
readonly wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
|
|
@@ -281,12 +377,12 @@ export interface InitOutput {
|
|
|
281
377
|
readonly wasmvisualiser_set_time: (a: number, b: number) => void;
|
|
282
378
|
readonly wasmvisualiser_take_script_diagnostics_json: (a: number) => [number, number];
|
|
283
379
|
readonly wasmvisualiser_unregister_mesh_asset: (a: number, b: number, c: number) => number;
|
|
284
|
-
readonly init_panic_hook: () => void;
|
|
285
380
|
readonly wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
|
|
286
|
-
readonly
|
|
287
|
-
readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
|
|
381
|
+
readonly init_panic_hook: () => void;
|
|
288
382
|
readonly wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
|
|
289
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;
|
|
290
386
|
readonly wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
|
|
291
387
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
292
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.
|
|
@@ -557,6 +595,12 @@ export class WasmVisualiser {
|
|
|
557
595
|
clear_musical_time() {
|
|
558
596
|
wasm.wasmvisualiser_clear_musical_time(this.__wbg_ptr);
|
|
559
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Clear all stem signals.
|
|
600
|
+
*/
|
|
601
|
+
clear_stem_signals() {
|
|
602
|
+
wasm.wasmvisualiser_clear_stem_signals(this.__wbg_ptr);
|
|
603
|
+
}
|
|
560
604
|
/**
|
|
561
605
|
* Get frequency bounds for all active bands at a given time.
|
|
562
606
|
* Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
|
|
@@ -575,6 +619,23 @@ export class WasmVisualiser {
|
|
|
575
619
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
576
620
|
}
|
|
577
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
|
+
}
|
|
578
639
|
/**
|
|
579
640
|
* @param {Float32Array} samples
|
|
580
641
|
* @param {number} sample_rate
|
|
@@ -629,6 +690,24 @@ export class WasmVisualiser {
|
|
|
629
690
|
const ret = wasm.wasmvisualiser_register_mesh_asset(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
630
691
|
return ret !== 0;
|
|
631
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
|
+
}
|
|
632
711
|
/**
|
|
633
712
|
* Set the frequency band structure for band-aware processing.
|
|
634
713
|
* The JSON format matches the TypeScript FrequencyBandStructure type.
|
|
@@ -642,6 +721,38 @@ export class WasmVisualiser {
|
|
|
642
721
|
const ret = wasm.wasmvisualiser_set_frequency_bands(this.__wbg_ptr, ptr0, len0);
|
|
643
722
|
return ret !== 0;
|
|
644
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
|
+
}
|
|
645
756
|
/**
|
|
646
757
|
* Get the number of events for a specific band.
|
|
647
758
|
* Returns 0 if no events are stored for this band.
|
|
@@ -671,12 +782,46 @@ export class WasmVisualiser {
|
|
|
671
782
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
672
783
|
}
|
|
673
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
|
+
}
|
|
674
802
|
/**
|
|
675
803
|
* Clear the frequency band structure.
|
|
676
804
|
*/
|
|
677
805
|
clear_frequency_bands() {
|
|
678
806
|
wasm.wasmvisualiser_clear_frequency_bands(this.__wbg_ptr);
|
|
679
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
|
+
}
|
|
680
825
|
/**
|
|
681
826
|
* Unregister a mesh asset.
|
|
682
827
|
* Returns true if the asset was unregistered, false if it didn't exist.
|
|
@@ -753,6 +898,38 @@ export class WasmVisualiser {
|
|
|
753
898
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
754
899
|
}
|
|
755
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
|
+
}
|
|
756
933
|
/**
|
|
757
934
|
* Drain and return any pending structured script diagnostics as JSON.
|
|
758
935
|
*
|
|
@@ -772,6 +949,18 @@ export class WasmVisualiser {
|
|
|
772
949
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
773
950
|
}
|
|
774
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
|
+
}
|
|
775
964
|
constructor() {
|
|
776
965
|
const ret = wasm.wasmvisualiser_new();
|
|
777
966
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -1702,16 +1891,11 @@ function __wbg_get_imports() {
|
|
|
1702
1891
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
1703
1892
|
return ret;
|
|
1704
1893
|
};
|
|
1705
|
-
imports.wbg.
|
|
1706
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
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`.
|
|
1707
1896
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__heb49a8f426ac2d2e, wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8);
|
|
1708
1897
|
return ret;
|
|
1709
1898
|
};
|
|
1710
|
-
imports.wbg.__wbindgen_cast_81075635f0fa4021 = function(arg0, arg1) {
|
|
1711
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 2592, function: Function { arguments: [Externref], shim_idx: 2593, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1712
|
-
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
|
|
1713
|
-
return ret;
|
|
1714
|
-
};
|
|
1715
1899
|
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
1716
1900
|
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
1717
1901
|
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
@@ -1722,6 +1906,11 @@ function __wbg_get_imports() {
|
|
|
1722
1906
|
const ret = arg0;
|
|
1723
1907
|
return ret;
|
|
1724
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
|
+
};
|
|
1725
1914
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
1726
1915
|
const table = wasm.__wbindgen_externrefs;
|
|
1727
1916
|
const offset = table.grow(4);
|
package/pkg/visualiser_bg.wasm
CHANGED
|
Binary file
|
|
@@ -4,6 +4,8 @@ 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;
|
|
9
11
|
export const wasmvisualiser_clear_event_streams: (a: number) => void;
|
|
@@ -11,26 +13,34 @@ export const wasmvisualiser_clear_frequency_bands: (a: number) => void;
|
|
|
11
13
|
export const wasmvisualiser_clear_isolation: (a: number) => void;
|
|
12
14
|
export const wasmvisualiser_clear_musical_time: (a: number) => void;
|
|
13
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;
|
|
14
18
|
export const wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
|
|
15
19
|
export const wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
|
|
16
20
|
export const wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
|
|
21
|
+
export const wasmvisualiser_get_camera_state_json: (a: number) => [number, number];
|
|
17
22
|
export const wasmvisualiser_get_current_vals: (a: number) => [number, number];
|
|
18
23
|
export const wasmvisualiser_get_entity_positions_json: (a: number) => [number, number];
|
|
19
24
|
export const wasmvisualiser_get_event_stream_count: (a: number, b: number, c: number) => number;
|
|
20
25
|
export const wasmvisualiser_get_frequency_band_count: (a: number) => number;
|
|
21
26
|
export const wasmvisualiser_get_script_error: (a: number) => [number, number];
|
|
27
|
+
export const wasmvisualiser_get_script_signals: (a: number) => [number, number];
|
|
22
28
|
export const wasmvisualiser_get_signal_names: (a: number) => [number, number];
|
|
29
|
+
export const wasmvisualiser_get_stem_signal_keys: (a: number) => [number, number];
|
|
23
30
|
export const wasmvisualiser_has_frequency_bands: (a: number) => number;
|
|
24
31
|
export const wasmvisualiser_has_script: (a: number) => number;
|
|
32
|
+
export const wasmvisualiser_has_signal: (a: number, b: number, c: number) => number;
|
|
25
33
|
export const wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
|
|
26
34
|
export const wasmvisualiser_list_mesh_assets: (a: number) => [number, number];
|
|
27
35
|
export const wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
|
|
28
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;
|
|
29
38
|
export const wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
30
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;
|
|
31
40
|
export const wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
|
|
32
41
|
export const wasmvisualiser_push_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
33
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;
|
|
34
44
|
export const wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
|
|
35
45
|
export const wasmvisualiser_register_mesh_asset: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
36
46
|
export const wasmvisualiser_render: (a: number, b: number) => void;
|
|
@@ -38,6 +48,7 @@ export const wasmvisualiser_render_with_budget: (a: number, b: number, c: number
|
|
|
38
48
|
export const wasmvisualiser_resize: (a: number, b: number, c: number) => void;
|
|
39
49
|
export const wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
40
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;
|
|
41
52
|
export const wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
|
|
42
53
|
export const wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
|
|
43
54
|
export const wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
|
|
@@ -45,12 +56,12 @@ export const wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
|
|
|
45
56
|
export const wasmvisualiser_set_time: (a: number, b: number) => void;
|
|
46
57
|
export const wasmvisualiser_take_script_diagnostics_json: (a: number) => [number, number];
|
|
47
58
|
export const wasmvisualiser_unregister_mesh_asset: (a: number, b: number, c: number) => number;
|
|
48
|
-
export const init_panic_hook: () => void;
|
|
49
59
|
export const wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
|
|
50
|
-
export const
|
|
51
|
-
export const wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
|
|
60
|
+
export const init_panic_hook: () => void;
|
|
52
61
|
export const wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
|
|
53
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;
|
|
54
65
|
export const wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
|
|
55
66
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
56
67
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|