@octoseq/visualiser 0.1.0-main.e2ea119 → 0.1.0-main.ef9b77a
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/package.json +15 -0
- package/pkg/visualiser.d.ts +320 -0
- package/pkg/visualiser.js +1798 -0
- package/pkg/visualiser_bg.wasm +0 -0
- package/pkg/visualiser_bg.wasm.d.ts +61 -0
package/package.json
CHANGED
package/pkg/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "visualiser",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"files": [
|
|
6
|
+
"visualiser_bg.wasm",
|
|
7
|
+
"visualiser.js",
|
|
8
|
+
"visualiser.d.ts"
|
|
9
|
+
],
|
|
10
|
+
"main": "visualiser.js",
|
|
11
|
+
"types": "visualiser.d.ts",
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"./snippets/*"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class WasmVisualiser {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
/**
|
|
8
|
+
* Check if a script is currently loaded.
|
|
9
|
+
*/
|
|
10
|
+
has_script(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Load a Rhai script for controlling the visualiser.
|
|
13
|
+
* Returns true if the script was loaded successfully.
|
|
14
|
+
*/
|
|
15
|
+
load_script(script: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Push a named signal for use in scripts.
|
|
18
|
+
* The signal will be available as `inputs.<name>` in Rhai scripts.
|
|
19
|
+
*/
|
|
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;
|
|
30
|
+
/**
|
|
31
|
+
* Clear all named signals.
|
|
32
|
+
*/
|
|
33
|
+
clear_signals(): void;
|
|
34
|
+
set_sigmoid_k(k: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Isolate a single entity for rendering (useful for debugging).
|
|
37
|
+
* Only this entity will be rendered.
|
|
38
|
+
*/
|
|
39
|
+
isolate_entity(entity_id: bigint): void;
|
|
40
|
+
push_zoom_data(samples: Float32Array, sample_rate: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* Clear entity isolation, resume normal rendering.
|
|
43
|
+
*/
|
|
44
|
+
clear_isolation(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get current state values for debugging.
|
|
47
|
+
* Returns [time, scene_entity_count, mesh_count, line_count]
|
|
48
|
+
*/
|
|
49
|
+
get_current_vals(): Float32Array;
|
|
50
|
+
/**
|
|
51
|
+
* Get the last script error message, if any.
|
|
52
|
+
*/
|
|
53
|
+
get_script_error(): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Get the list of available signal names.
|
|
56
|
+
* Returns a JSON array of signal names.
|
|
57
|
+
*/
|
|
58
|
+
get_signal_names(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Get a list of all registered mesh asset IDs.
|
|
61
|
+
* Returns a JSON array of asset IDs.
|
|
62
|
+
*/
|
|
63
|
+
list_mesh_assets(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Push pre-extracted events for a band.
|
|
66
|
+
*
|
|
67
|
+
* Events are extracted by the TypeScript layer using the existing peak picker,
|
|
68
|
+
* then pushed here for script access via `inputs.bands[id].events`.
|
|
69
|
+
*
|
|
70
|
+
* The JSON format should be an array of event objects with:
|
|
71
|
+
* - time: f32
|
|
72
|
+
* - weight: f32
|
|
73
|
+
* - beat_position: Option<f32>
|
|
74
|
+
* - beat_phase: Option<f32>
|
|
75
|
+
* - cluster_id: Option<u32>
|
|
76
|
+
*
|
|
77
|
+
* Returns true if successful, false if parsing failed.
|
|
78
|
+
*/
|
|
79
|
+
push_band_events(band_id: string, events_json: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Push a band-scoped signal for use in scripts.
|
|
82
|
+
* The signal will be available as `inputs.bands[band_id].{feature}` in Rhai scripts.
|
|
83
|
+
* Stores under both band_id and band_label for dual-access support.
|
|
84
|
+
*
|
|
85
|
+
* - `band_id`: The unique ID of the frequency band.
|
|
86
|
+
* - `band_label`: The user-visible label of the band.
|
|
87
|
+
* - `feature`: Signal type ("energy", "onset", "flux").
|
|
88
|
+
* - `samples`: Signal data.
|
|
89
|
+
* - `sample_rate`: Sample rate of the signal.
|
|
90
|
+
*/
|
|
91
|
+
push_band_signal(band_id: string, band_label: string, feature: string, samples: Float32Array, sample_rate: number): void;
|
|
92
|
+
/**
|
|
93
|
+
* Set the musical time structure for beat-aware signal processing.
|
|
94
|
+
* The JSON format matches the TypeScript MusicalTimeStructure type.
|
|
95
|
+
* Returns true if successful, false if parsing failed.
|
|
96
|
+
*/
|
|
97
|
+
set_musical_time(json: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Clear all band event streams.
|
|
100
|
+
*/
|
|
101
|
+
clear_band_events(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Push a named event stream (e.g., "beatCandidates") for script access.
|
|
104
|
+
*
|
|
105
|
+
* The event stream will be available as `inputs.<name>` in Rhai scripts.
|
|
106
|
+
* This is used for MIR-derived events like beat candidates, onset peaks, etc.
|
|
107
|
+
*
|
|
108
|
+
* The JSON format should be an array of event objects with:
|
|
109
|
+
* - time: f32
|
|
110
|
+
* - weight: f32
|
|
111
|
+
* - beat_position: Option<f32>
|
|
112
|
+
* - beat_phase: Option<f32>
|
|
113
|
+
* - cluster_id: Option<u32>
|
|
114
|
+
*
|
|
115
|
+
* Returns true if successful, false if parsing failed.
|
|
116
|
+
*/
|
|
117
|
+
push_event_stream(name: string, events_json: string): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Set debug visualization options.
|
|
120
|
+
*/
|
|
121
|
+
set_debug_options(wireframe: boolean, bounding_boxes: boolean): void;
|
|
122
|
+
/**
|
|
123
|
+
* Clear all band signals.
|
|
124
|
+
*/
|
|
125
|
+
clear_band_signals(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Clear the musical time structure.
|
|
128
|
+
* Beat-aware operations will fall back to 120 BPM default.
|
|
129
|
+
*/
|
|
130
|
+
clear_musical_time(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Get frequency bounds for all active bands at a given time.
|
|
133
|
+
* Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
|
|
134
|
+
*/
|
|
135
|
+
get_band_bounds_at(time: number): string;
|
|
136
|
+
push_rotation_data(samples: Float32Array, sample_rate: number): void;
|
|
137
|
+
/**
|
|
138
|
+
* Render with a frame budget timeout.
|
|
139
|
+
*
|
|
140
|
+
* If the frame takes longer than `budget_ms` to process, it will be dropped
|
|
141
|
+
* and a warning logged. This prevents expensive scripts from freezing the browser.
|
|
142
|
+
*
|
|
143
|
+
* Returns true if the frame completed, false if it was dropped due to budget.
|
|
144
|
+
*/
|
|
145
|
+
render_with_budget(dt: number, budget_ms: number): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Clear all named event streams.
|
|
148
|
+
*/
|
|
149
|
+
clear_event_streams(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Check if frequency bands are currently set.
|
|
152
|
+
*/
|
|
153
|
+
has_frequency_bands(): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Register a mesh asset from OBJ content.
|
|
156
|
+
* The asset will be available as `mesh.load(asset_id)` in scripts.
|
|
157
|
+
* Returns true if successful, false if parsing failed.
|
|
158
|
+
*/
|
|
159
|
+
register_mesh_asset(asset_id: string, obj_content: string): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Set the frequency band structure for band-aware processing.
|
|
162
|
+
* The JSON format matches the TypeScript FrequencyBandStructure type.
|
|
163
|
+
* Returns true if successful, false if parsing failed.
|
|
164
|
+
*/
|
|
165
|
+
set_frequency_bands(json: string): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Get the number of events for a specific band.
|
|
168
|
+
* Returns 0 if no events are stored for this band.
|
|
169
|
+
*/
|
|
170
|
+
get_band_event_count(band_id: string): number;
|
|
171
|
+
/**
|
|
172
|
+
* Get list of band keys (IDs and labels) that have signals.
|
|
173
|
+
* Returns a JSON array of strings.
|
|
174
|
+
*/
|
|
175
|
+
get_band_signal_keys(): string;
|
|
176
|
+
/**
|
|
177
|
+
* Clear the frequency band structure.
|
|
178
|
+
*/
|
|
179
|
+
clear_frequency_bands(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Unregister a mesh asset.
|
|
182
|
+
* Returns true if the asset was unregistered, false if it didn't exist.
|
|
183
|
+
*/
|
|
184
|
+
unregister_mesh_asset(asset_id: string): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Get the number of events in a named event stream.
|
|
187
|
+
* Returns 0 if no events are stored for this name.
|
|
188
|
+
*/
|
|
189
|
+
get_event_stream_count(name: string): number;
|
|
190
|
+
/**
|
|
191
|
+
* Get the number of frequency bands.
|
|
192
|
+
*/
|
|
193
|
+
get_frequency_band_count(): number;
|
|
194
|
+
/**
|
|
195
|
+
* Run script in analysis mode with event extraction support.
|
|
196
|
+
*
|
|
197
|
+
* This runs the script headlessly across the full track duration,
|
|
198
|
+
* collecting all debug.emit() calls AND extracting events from
|
|
199
|
+
* any signal.pick.events() calls.
|
|
200
|
+
*
|
|
201
|
+
* Returns a JSON-serialized ExtendedAnalysisResultJson.
|
|
202
|
+
*/
|
|
203
|
+
run_analysis_with_events(script: string, duration: number, time_step: number): string;
|
|
204
|
+
/**
|
|
205
|
+
* Get entity positions as JSON for debugging.
|
|
206
|
+
* Returns a JSON array of objects with id, type, and position fields.
|
|
207
|
+
*/
|
|
208
|
+
get_entity_positions_json(): string;
|
|
209
|
+
/**
|
|
210
|
+
* Drain and return any pending structured script diagnostics as JSON.
|
|
211
|
+
*
|
|
212
|
+
* Intended for UI consumption. Calling this clears the pending diagnostics
|
|
213
|
+
* queue so repeated polling does not duplicate messages.
|
|
214
|
+
*/
|
|
215
|
+
take_script_diagnostics_json(): string;
|
|
216
|
+
constructor();
|
|
217
|
+
render(dt: number): void;
|
|
218
|
+
resize(width: number, height: number): void;
|
|
219
|
+
set_time(time: number): void;
|
|
220
|
+
push_data(samples: Float32Array, sample_rate: number): void;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function create_visualiser(canvas: HTMLCanvasElement): Promise<WasmVisualiser>;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Get the host-defined Script API metadata as a JSON string.
|
|
227
|
+
*
|
|
228
|
+
* This is a stable, versioned description of the scripting API surface and is
|
|
229
|
+
* intended to drive editor UX (autocomplete/hover/docs) and future language
|
|
230
|
+
* bindings.
|
|
231
|
+
*/
|
|
232
|
+
export function get_script_api_metadata_json(): string;
|
|
233
|
+
|
|
234
|
+
export function init_panic_hook(): void;
|
|
235
|
+
|
|
236
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
237
|
+
|
|
238
|
+
export interface InitOutput {
|
|
239
|
+
readonly memory: WebAssembly.Memory;
|
|
240
|
+
readonly __wbg_wasmvisualiser_free: (a: number, b: number) => void;
|
|
241
|
+
readonly create_visualiser: (a: any) => any;
|
|
242
|
+
readonly get_script_api_metadata_json: () => [number, number];
|
|
243
|
+
readonly wasmvisualiser_clear_band_events: (a: number) => void;
|
|
244
|
+
readonly wasmvisualiser_clear_band_signals: (a: number) => void;
|
|
245
|
+
readonly wasmvisualiser_clear_event_streams: (a: number) => void;
|
|
246
|
+
readonly wasmvisualiser_clear_frequency_bands: (a: number) => void;
|
|
247
|
+
readonly wasmvisualiser_clear_isolation: (a: number) => void;
|
|
248
|
+
readonly wasmvisualiser_clear_musical_time: (a: number) => void;
|
|
249
|
+
readonly wasmvisualiser_clear_signals: (a: number) => void;
|
|
250
|
+
readonly wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
|
|
251
|
+
readonly wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
|
|
252
|
+
readonly wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
|
|
253
|
+
readonly wasmvisualiser_get_current_vals: (a: number) => [number, number];
|
|
254
|
+
readonly wasmvisualiser_get_entity_positions_json: (a: number) => [number, number];
|
|
255
|
+
readonly wasmvisualiser_get_event_stream_count: (a: number, b: number, c: number) => number;
|
|
256
|
+
readonly wasmvisualiser_get_frequency_band_count: (a: number) => number;
|
|
257
|
+
readonly wasmvisualiser_get_script_error: (a: number) => [number, number];
|
|
258
|
+
readonly wasmvisualiser_get_signal_names: (a: number) => [number, number];
|
|
259
|
+
readonly wasmvisualiser_has_frequency_bands: (a: number) => number;
|
|
260
|
+
readonly wasmvisualiser_has_script: (a: number) => number;
|
|
261
|
+
readonly wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
|
|
262
|
+
readonly wasmvisualiser_list_mesh_assets: (a: number) => [number, number];
|
|
263
|
+
readonly wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
|
|
264
|
+
readonly wasmvisualiser_new: () => number;
|
|
265
|
+
readonly wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
266
|
+
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
|
+
readonly wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
|
|
268
|
+
readonly wasmvisualiser_push_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
269
|
+
readonly wasmvisualiser_push_signal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
270
|
+
readonly wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
|
|
271
|
+
readonly wasmvisualiser_register_mesh_asset: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
272
|
+
readonly wasmvisualiser_render: (a: number, b: number) => void;
|
|
273
|
+
readonly wasmvisualiser_render_with_budget: (a: number, b: number, c: number) => number;
|
|
274
|
+
readonly wasmvisualiser_resize: (a: number, b: number, c: number) => void;
|
|
275
|
+
readonly wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
276
|
+
readonly wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
277
|
+
readonly wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
|
|
278
|
+
readonly wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
|
|
279
|
+
readonly wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
|
|
280
|
+
readonly wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
|
|
281
|
+
readonly wasmvisualiser_set_time: (a: number, b: number) => void;
|
|
282
|
+
readonly wasmvisualiser_take_script_diagnostics_json: (a: number) => [number, number];
|
|
283
|
+
readonly wasmvisualiser_unregister_mesh_asset: (a: number, b: number, c: number) => number;
|
|
284
|
+
readonly init_panic_hook: () => void;
|
|
285
|
+
readonly wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
|
|
286
|
+
readonly wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
|
|
287
|
+
readonly wasm_bindgen__closure__destroy__heb49a8f426ac2d2e: (a: number, b: number) => void;
|
|
288
|
+
readonly wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
|
|
289
|
+
readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
|
|
290
|
+
readonly wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
|
|
291
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
292
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
293
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
294
|
+
readonly __externref_table_alloc: () => number;
|
|
295
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
296
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
297
|
+
readonly __wbindgen_start: () => void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
304
|
+
* a precompiled `WebAssembly.Module`.
|
|
305
|
+
*
|
|
306
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
307
|
+
*
|
|
308
|
+
* @returns {InitOutput}
|
|
309
|
+
*/
|
|
310
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
314
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
315
|
+
*
|
|
316
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
317
|
+
*
|
|
318
|
+
* @returns {Promise<InitOutput>}
|
|
319
|
+
*/
|
|
320
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|