@ilusiv/fyug-js 2026.11.3 → 2026.11.5
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/README.md +95 -1
- package/dist/FuguePlayer.d.ts +5 -1
- package/dist/FuguePlayer.d.ts.map +1 -1
- package/dist/FuguePlayer.js +46 -51
- package/dist/FuguePlayer.js.map +1 -1
- package/dist/fugue-audio-worklet.js +1 -1
- package/dist/generated/embedded-assets.d.ts +2 -2
- package/dist/generated/embedded-assets.d.ts.map +1 -1
- package/dist/generated/embedded-assets.js +2 -2
- package/dist/generated/embedded-assets.js.map +1 -1
- package/dist/generated/fugue.d.ts +29 -0
- package/dist/generated/fugue.js +149 -0
- package/dist/generated/fugue_bg.wasm +0 -0
- package/dist/generated/fugue_bg.wasm.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/note-preview.d.ts +33 -0
- package/dist/note-preview.d.ts.map +1 -0
- package/dist/note-preview.js +92 -0
- package/dist/note-preview.js.map +1 -0
- package/dist/runtime-assets.d.ts +14 -0
- package/dist/runtime-assets.d.ts.map +1 -0
- package/dist/runtime-assets.js +70 -0
- package/dist/runtime-assets.js.map +1 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/README.md +22 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/fugue.pkg.json +12 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/clap.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/cowbell.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/hat-closed.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/hat-open.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/kick.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/loop.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/snare.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples.json +52 -0
- package/dist/samples/index.json +47 -0
- package/dist/types.d.ts +98 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedded-assets.js","sourceRoot":"","sources":["../../src/generated/embedded-assets.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"embedded-assets.js","sourceRoot":"","sources":["../../src/generated/embedded-assets.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAW,0idAA0id,CAAC;AAExld,MAAM,CAAC,MAAM,kBAAkB,GAAW,8k/2HAA8k/2H,CAAC"}
|
|
@@ -63,6 +63,30 @@ export class FugueEngine {
|
|
|
63
63
|
* Creates a new engine for the given sample rate.
|
|
64
64
|
*/
|
|
65
65
|
constructor(sample_rate: number);
|
|
66
|
+
/**
|
|
67
|
+
* Lists the notes `json` (an invention document) plays over a range of
|
|
68
|
+
* bars, as `request` (JSON) asks, without playing it or touching the
|
|
69
|
+
* engine's own piece. Resolves to the answer as JSON, or rejects with
|
|
70
|
+
* a string (see `docs/preview-notes.md`). Works in slices that yield
|
|
71
|
+
* with `setTimeout(0)`: call it from a page or a worker, not an
|
|
72
|
+
* AudioWorklet.
|
|
73
|
+
*/
|
|
74
|
+
previewNotes(json: string, request: string): Promise<any>;
|
|
75
|
+
/**
|
|
76
|
+
* Hands the engine the bytes of one file of a package (a WAV sample),
|
|
77
|
+
* named by the package id, its version and the file's path in it, and
|
|
78
|
+
* decodes it at the engine's rate. A document's package ref
|
|
79
|
+
* (`id@requirement:file`) then plays the highest provided version that
|
|
80
|
+
* meets the requirement; one with no provided match fails to load,
|
|
81
|
+
* naming the ref. Provide samples before loading the piece that plays
|
|
82
|
+
* them. Returns the source the file resolves to (`id@=version:file`).
|
|
83
|
+
* Provided samples are shared by every engine in this WebAssembly
|
|
84
|
+
* instance (an AudioWorklet's engine has an instance of its own) and
|
|
85
|
+
* stay for its lifetime. Decoding runs here, on the calling thread: in
|
|
86
|
+
* an AudioWorklet that is the render thread, so provide samples before
|
|
87
|
+
* the piece that plays them starts, not while something plays.
|
|
88
|
+
*/
|
|
89
|
+
provideSample(_package: string, version: string, path: string, bytes: Uint8Array): string;
|
|
66
90
|
/**
|
|
67
91
|
* Removes a module from the loaded graph.
|
|
68
92
|
*/
|
|
@@ -130,6 +154,8 @@ export interface InitOutput {
|
|
|
130
154
|
readonly fugueengine_listModules: (a: number) => [number, number, number, number];
|
|
131
155
|
readonly fugueengine_loadInvention: (a: number, b: number, c: number) => [number, number];
|
|
132
156
|
readonly fugueengine_new: (a: number) => number;
|
|
157
|
+
readonly fugueengine_previewNotes: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
158
|
+
readonly fugueengine_provideSample: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
133
159
|
readonly fugueengine_removeModule: (a: number, b: number, c: number) => [number, number];
|
|
134
160
|
readonly fugueengine_renderInterleaved: (a: number, b: number) => [number, number, number, number];
|
|
135
161
|
readonly fugueengine_renderInterleavedInto: (a: number, b: any) => [number, number, number];
|
|
@@ -141,9 +167,12 @@ export interface InitOutput {
|
|
|
141
167
|
readonly fugueengine_setControlNumber: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
142
168
|
readonly fugueengine_setControlString: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
143
169
|
readonly fugueengine_status: (a: number) => [number, number, number, number];
|
|
170
|
+
readonly wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534: (a: number, b: number, c: any, d: any) => void;
|
|
171
|
+
readonly wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74: (a: number, b: number) => void;
|
|
144
172
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
145
173
|
readonly __externref_table_alloc: () => number;
|
|
146
174
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
175
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
147
176
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
148
177
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
149
178
|
readonly __externref_table_dealloc: (a: number) => void;
|
package/dist/generated/fugue.js
CHANGED
|
@@ -285,6 +285,70 @@ export class FugueEngine {
|
|
|
285
285
|
FugueEngineFinalization.register(this, this.__wbg_ptr, this);
|
|
286
286
|
return this;
|
|
287
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Lists the notes `json` (an invention document) plays over a range of
|
|
290
|
+
* bars, as `request` (JSON) asks, without playing it or touching the
|
|
291
|
+
* engine's own piece. Resolves to the answer as JSON, or rejects with
|
|
292
|
+
* a string (see `docs/preview-notes.md`). Works in slices that yield
|
|
293
|
+
* with `setTimeout(0)`: call it from a page or a worker, not an
|
|
294
|
+
* AudioWorklet.
|
|
295
|
+
* @param {string} json
|
|
296
|
+
* @param {string} request
|
|
297
|
+
* @returns {Promise<any>}
|
|
298
|
+
*/
|
|
299
|
+
previewNotes(json, request) {
|
|
300
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
301
|
+
const len0 = WASM_VECTOR_LEN;
|
|
302
|
+
const ptr1 = passStringToWasm0(request, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
303
|
+
const len1 = WASM_VECTOR_LEN;
|
|
304
|
+
const ret = wasm.fugueengine_previewNotes(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
305
|
+
return ret;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Hands the engine the bytes of one file of a package (a WAV sample),
|
|
309
|
+
* named by the package id, its version and the file's path in it, and
|
|
310
|
+
* decodes it at the engine's rate. A document's package ref
|
|
311
|
+
* (`id@requirement:file`) then plays the highest provided version that
|
|
312
|
+
* meets the requirement; one with no provided match fails to load,
|
|
313
|
+
* naming the ref. Provide samples before loading the piece that plays
|
|
314
|
+
* them. Returns the source the file resolves to (`id@=version:file`).
|
|
315
|
+
* Provided samples are shared by every engine in this WebAssembly
|
|
316
|
+
* instance (an AudioWorklet's engine has an instance of its own) and
|
|
317
|
+
* stay for its lifetime. Decoding runs here, on the calling thread: in
|
|
318
|
+
* an AudioWorklet that is the render thread, so provide samples before
|
|
319
|
+
* the piece that plays them starts, not while something plays.
|
|
320
|
+
* @param {string} _package
|
|
321
|
+
* @param {string} version
|
|
322
|
+
* @param {string} path
|
|
323
|
+
* @param {Uint8Array} bytes
|
|
324
|
+
* @returns {string}
|
|
325
|
+
*/
|
|
326
|
+
provideSample(_package, version, path, bytes) {
|
|
327
|
+
let deferred6_0;
|
|
328
|
+
let deferred6_1;
|
|
329
|
+
try {
|
|
330
|
+
const ptr0 = passStringToWasm0(_package, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
331
|
+
const len0 = WASM_VECTOR_LEN;
|
|
332
|
+
const ptr1 = passStringToWasm0(version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
333
|
+
const len1 = WASM_VECTOR_LEN;
|
|
334
|
+
const ptr2 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
335
|
+
const len2 = WASM_VECTOR_LEN;
|
|
336
|
+
const ptr3 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
337
|
+
const len3 = WASM_VECTOR_LEN;
|
|
338
|
+
const ret = wasm.fugueengine_provideSample(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
339
|
+
var ptr5 = ret[0];
|
|
340
|
+
var len5 = ret[1];
|
|
341
|
+
if (ret[3]) {
|
|
342
|
+
ptr5 = 0; len5 = 0;
|
|
343
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
344
|
+
}
|
|
345
|
+
deferred6_0 = ptr5;
|
|
346
|
+
deferred6_1 = len5;
|
|
347
|
+
return getStringFromWasm0(ptr5, len5);
|
|
348
|
+
} finally {
|
|
349
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
288
352
|
/**
|
|
289
353
|
* Removes a module from the loaded graph.
|
|
290
354
|
* @param {string} id
|
|
@@ -453,6 +517,13 @@ function __wbg_get_imports() {
|
|
|
453
517
|
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
454
518
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
455
519
|
},
|
|
520
|
+
__wbg__wbg_cb_unref_dcc1a90847f04c41: function(arg0) {
|
|
521
|
+
arg0._wbg_cb_unref();
|
|
522
|
+
},
|
|
523
|
+
__wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
|
|
524
|
+
const ret = arg0.call(arg1, arg2);
|
|
525
|
+
return ret;
|
|
526
|
+
}, arguments); },
|
|
456
527
|
__wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
|
|
457
528
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
458
529
|
}, arguments); },
|
|
@@ -460,10 +531,41 @@ function __wbg_get_imports() {
|
|
|
460
531
|
const ret = arg0.length;
|
|
461
532
|
return ret;
|
|
462
533
|
},
|
|
534
|
+
__wbg_new_5502aad30c185fc8: function(arg0, arg1) {
|
|
535
|
+
try {
|
|
536
|
+
var state0 = {a: arg0, b: arg1};
|
|
537
|
+
var cb0 = (arg0, arg1) => {
|
|
538
|
+
const a = state0.a;
|
|
539
|
+
state0.a = 0;
|
|
540
|
+
try {
|
|
541
|
+
return wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534(a, state0.b, arg0, arg1);
|
|
542
|
+
} finally {
|
|
543
|
+
state0.a = a;
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
const ret = new Promise(cb0);
|
|
547
|
+
return ret;
|
|
548
|
+
} finally {
|
|
549
|
+
state0.a = 0;
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
__wbg_now_aa4ccb83129e9e55: function() {
|
|
553
|
+
const ret = Date.now();
|
|
554
|
+
return ret;
|
|
555
|
+
},
|
|
556
|
+
__wbg_setTimeout_4bf75e1eaccfc9e2: function(arg0, arg1) {
|
|
557
|
+
const ret = setTimeout(arg0, arg1);
|
|
558
|
+
return ret;
|
|
559
|
+
},
|
|
463
560
|
__wbg_set_070bd465f1c195a4: function(arg0, arg1, arg2) {
|
|
464
561
|
arg0.set(getArrayF32FromWasm0(arg1, arg2));
|
|
465
562
|
},
|
|
466
563
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
564
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1588, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
565
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74);
|
|
566
|
+
return ret;
|
|
567
|
+
},
|
|
568
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
467
569
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
468
570
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
469
571
|
return ret;
|
|
@@ -484,6 +586,14 @@ function __wbg_get_imports() {
|
|
|
484
586
|
};
|
|
485
587
|
}
|
|
486
588
|
|
|
589
|
+
function wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74(arg0, arg1) {
|
|
590
|
+
wasm.wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74(arg0, arg1);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534(arg0, arg1, arg2, arg3) {
|
|
594
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534(arg0, arg1, arg2, arg3);
|
|
595
|
+
}
|
|
596
|
+
|
|
487
597
|
const FugueEngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
488
598
|
? { register: () => {}, unregister: () => {} }
|
|
489
599
|
: new FinalizationRegistry(ptr => wasm.__wbg_fugueengine_free(ptr, 1));
|
|
@@ -494,6 +604,10 @@ function addToExternrefTable0(obj) {
|
|
|
494
604
|
return idx;
|
|
495
605
|
}
|
|
496
606
|
|
|
607
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
608
|
+
? { register: () => {}, unregister: () => {} }
|
|
609
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
610
|
+
|
|
497
611
|
function getArrayF32FromWasm0(ptr, len) {
|
|
498
612
|
ptr = ptr >>> 0;
|
|
499
613
|
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
@@ -537,6 +651,41 @@ function isLikeNone(x) {
|
|
|
537
651
|
return x === undefined || x === null;
|
|
538
652
|
}
|
|
539
653
|
|
|
654
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
655
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
656
|
+
const real = (...args) => {
|
|
657
|
+
|
|
658
|
+
// First up with a closure we increment the internal reference
|
|
659
|
+
// count. This ensures that the Rust closure environment won't
|
|
660
|
+
// be deallocated while we're invoking it.
|
|
661
|
+
state.cnt++;
|
|
662
|
+
const a = state.a;
|
|
663
|
+
state.a = 0;
|
|
664
|
+
try {
|
|
665
|
+
return f(a, state.b, ...args);
|
|
666
|
+
} finally {
|
|
667
|
+
state.a = a;
|
|
668
|
+
real._wbg_cb_unref();
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
real._wbg_cb_unref = () => {
|
|
672
|
+
if (--state.cnt === 0) {
|
|
673
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
674
|
+
state.a = 0;
|
|
675
|
+
CLOSURE_DTORS.unregister(state);
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
679
|
+
return real;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
683
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
684
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
685
|
+
WASM_VECTOR_LEN = arg.length;
|
|
686
|
+
return ptr;
|
|
687
|
+
}
|
|
688
|
+
|
|
540
689
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
541
690
|
if (realloc === undefined) {
|
|
542
691
|
const buf = cachedTextEncoder.encode(arg);
|
|
Binary file
|
|
@@ -15,6 +15,8 @@ export const fugueengine_listControls: (a: number, b: number, c: number) => [num
|
|
|
15
15
|
export const fugueengine_listModules: (a: number) => [number, number, number, number];
|
|
16
16
|
export const fugueengine_loadInvention: (a: number, b: number, c: number) => [number, number];
|
|
17
17
|
export const fugueengine_new: (a: number) => number;
|
|
18
|
+
export const fugueengine_previewNotes: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
19
|
+
export const fugueengine_provideSample: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
18
20
|
export const fugueengine_removeModule: (a: number, b: number, c: number) => [number, number];
|
|
19
21
|
export const fugueengine_renderInterleaved: (a: number, b: number) => [number, number, number, number];
|
|
20
22
|
export const fugueengine_renderInterleavedInto: (a: number, b: any) => [number, number, number];
|
|
@@ -26,9 +28,12 @@ export const fugueengine_setControlBool: (a: number, b: number, c: number, d: nu
|
|
|
26
28
|
export const fugueengine_setControlNumber: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
27
29
|
export const fugueengine_setControlString: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
28
30
|
export const fugueengine_status: (a: number) => [number, number, number, number];
|
|
31
|
+
export const wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534: (a: number, b: number, c: any, d: any) => void;
|
|
32
|
+
export const wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74: (a: number, b: number) => void;
|
|
29
33
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
30
34
|
export const __externref_table_alloc: () => number;
|
|
31
35
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
36
|
+
export const __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
32
37
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
33
38
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
34
39
|
export const __externref_table_dealloc: (a: number) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { FuguePlayer } from "./FuguePlayer.js";
|
|
2
2
|
export { SUPPORTED_MODULES_SCHEMA, unsupportedModuleTypes, } from "./supported-modules.js";
|
|
3
3
|
export type { SupportedModule, SupportedModules } from "./supported-modules.js";
|
|
4
|
-
export type { ControlValue, FuguePlayerInstance, FuguePlayerOptions, FuguePlayerState, RuntimeConnection, RuntimeControlGroup, RuntimeModule, RuntimeStatus, } from "./types.js";
|
|
4
|
+
export type { ControlValue, FuguePlayerInstance, FuguePlayerOptions, FuguePlayerRenderer, FuguePlayerState, NotePreview, NotePreviewRequest, PackageSample, PreviewedNote, RuntimeConnection, RuntimeControlGroup, RuntimeModule, RuntimeStatus, } from "./types.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type InitOutput } from "./generated/fugue.js";
|
|
2
|
+
import type { NotePreview, NotePreviewRequest, PackageSample } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The engine a player lists notes on: its own instance on the page's main
|
|
5
|
+
* thread, made on the first call. The engine that plays is never asked, so a
|
|
6
|
+
* preview cannot reach the piece being heard. A worklet's engine could not
|
|
7
|
+
* run one anyway: the preview works in slices scheduled with `setTimeout`,
|
|
8
|
+
* which an AudioWorklet does not have.
|
|
9
|
+
*/
|
|
10
|
+
export declare class NotePreviewer {
|
|
11
|
+
private readonly load;
|
|
12
|
+
private readonly sampleRate;
|
|
13
|
+
private engine?;
|
|
14
|
+
private disposed;
|
|
15
|
+
/** Samples the player was given, not yet handed to this engine. */
|
|
16
|
+
private samples;
|
|
17
|
+
/**
|
|
18
|
+
* `load` makes the wasm module ready on this thread (the bytes the player
|
|
19
|
+
* already uses); `sampleRate` is the player's, so the engine's frame limit
|
|
20
|
+
* matches the piece's.
|
|
21
|
+
*/
|
|
22
|
+
constructor(load: () => Promise<InitOutput>, sampleRate: number);
|
|
23
|
+
preview(json: string, request: NotePreviewRequest): Promise<NotePreview>;
|
|
24
|
+
/** Gives `sample` to this engine before its next preview. */
|
|
25
|
+
provide(sample: PackageSample): void;
|
|
26
|
+
/**
|
|
27
|
+
* Frees the engine, without waiting for one still loading (it frees
|
|
28
|
+
* itself). A preview already running still settles.
|
|
29
|
+
*/
|
|
30
|
+
dispose(): void;
|
|
31
|
+
private ready;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=note-preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note-preview.d.ts","sourceRoot":"","sources":["../src/note-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,qBAAa,aAAa;IAYtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAZ7B,OAAO,CAAC,MAAM,CAAC,CAAuB;IACtC,OAAO,CAAC,QAAQ,CAAS;IACzB,mEAAmE;IACnE,OAAO,CAAC,OAAO,CAAuB;IAEtC;;;;OAIG;gBAEgB,IAAI,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,EAC/B,UAAU,EAAE,MAAM;IAG/B,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC;IAiCvB,6DAA6D;IAC7D,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAIpC;;;OAGG;IACH,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,KAAK;CAyBd"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { FugueEngine } from "./generated/fugue.js";
|
|
2
|
+
import { parseJson } from "./runtime-assets.js";
|
|
3
|
+
/**
|
|
4
|
+
* The engine a player lists notes on: its own instance on the page's main
|
|
5
|
+
* thread, made on the first call. The engine that plays is never asked, so a
|
|
6
|
+
* preview cannot reach the piece being heard. A worklet's engine could not
|
|
7
|
+
* run one anyway: the preview works in slices scheduled with `setTimeout`,
|
|
8
|
+
* which an AudioWorklet does not have.
|
|
9
|
+
*/
|
|
10
|
+
export class NotePreviewer {
|
|
11
|
+
load;
|
|
12
|
+
sampleRate;
|
|
13
|
+
engine;
|
|
14
|
+
disposed = false;
|
|
15
|
+
/** Samples the player was given, not yet handed to this engine. */
|
|
16
|
+
samples = [];
|
|
17
|
+
/**
|
|
18
|
+
* `load` makes the wasm module ready on this thread (the bytes the player
|
|
19
|
+
* already uses); `sampleRate` is the player's, so the engine's frame limit
|
|
20
|
+
* matches the piece's.
|
|
21
|
+
*/
|
|
22
|
+
constructor(load, sampleRate) {
|
|
23
|
+
this.load = load;
|
|
24
|
+
this.sampleRate = sampleRate;
|
|
25
|
+
}
|
|
26
|
+
async preview(json, request) {
|
|
27
|
+
const engine = await this.ready();
|
|
28
|
+
// Providing the same bytes again changes nothing, so a sample a
|
|
29
|
+
// main-thread player already gave this WebAssembly instance is fine.
|
|
30
|
+
// One at a time: a sample that fails is dropped and the rest stay queued.
|
|
31
|
+
while (this.samples.length > 0) {
|
|
32
|
+
const sample = this.samples.shift();
|
|
33
|
+
try {
|
|
34
|
+
engine.provideSample(sample.package, sample.version, sample.path, sample.bytes);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Fields left null or undefined are left out: the engine refuses a null
|
|
41
|
+
// cursor, which is what the last page's answer carries.
|
|
42
|
+
const fields = JSON.stringify(request, (_key, value) => value === null ? undefined : value);
|
|
43
|
+
let answer;
|
|
44
|
+
try {
|
|
45
|
+
answer = await engine.previewNotes(json, fields);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
// The engine rejects with its message as a string.
|
|
49
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
50
|
+
}
|
|
51
|
+
return parseJson("previewNotes", answer);
|
|
52
|
+
}
|
|
53
|
+
/** Gives `sample` to this engine before its next preview. */
|
|
54
|
+
provide(sample) {
|
|
55
|
+
this.samples.push(sample);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Frees the engine, without waiting for one still loading (it frees
|
|
59
|
+
* itself). A preview already running still settles.
|
|
60
|
+
*/
|
|
61
|
+
dispose() {
|
|
62
|
+
this.disposed = true;
|
|
63
|
+
void this.engine?.then((engine) => engine.free(), () => undefined);
|
|
64
|
+
this.engine = undefined;
|
|
65
|
+
}
|
|
66
|
+
ready() {
|
|
67
|
+
if (this.disposed) {
|
|
68
|
+
return Promise.reject(new Error("FuguePlayer has been disposed"));
|
|
69
|
+
}
|
|
70
|
+
if (!this.engine) {
|
|
71
|
+
const made = this.load().then((exports) => {
|
|
72
|
+
// An engine from `wasmUrl` may predate the preview.
|
|
73
|
+
if (!("fugueengine_previewNotes" in exports)) {
|
|
74
|
+
throw new Error("this engine build has no notes preview");
|
|
75
|
+
}
|
|
76
|
+
if (this.disposed) {
|
|
77
|
+
throw new Error("FuguePlayer has been disposed");
|
|
78
|
+
}
|
|
79
|
+
return new FugueEngine(this.sampleRate);
|
|
80
|
+
});
|
|
81
|
+
// A failed load is not kept: the next call tries again.
|
|
82
|
+
made.catch(() => {
|
|
83
|
+
if (this.engine === made) {
|
|
84
|
+
this.engine = undefined;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
this.engine = made;
|
|
88
|
+
}
|
|
89
|
+
return this.engine;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=note-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note-preview.js","sourceRoot":"","sources":["../src/note-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,sB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CAAC;gBACD,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YACH,wDAAwD;YACxD,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;oBACzB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;gBAC1B,CAAC;YACH,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type InitOutput } from "./generated/fugue.js";
|
|
2
|
+
import type { FuguePlayerOptions } from "./types.js";
|
|
3
|
+
export type RuntimeAssetOptions = Pick<FuguePlayerOptions, "wasmUrl" | "workletUrl">;
|
|
4
|
+
export declare function parseJson<T>(method: string, value: unknown): T;
|
|
5
|
+
export declare function loadWasmBytes(options: RuntimeAssetOptions): Promise<ArrayBuffer>;
|
|
6
|
+
export declare function addWorkletModule(context: AudioContext, options: RuntimeAssetOptions): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Initializes the wasm module on this thread once per page, for every player
|
|
9
|
+
* here. wasm-bindgen keeps one module per page and two inits in flight would
|
|
10
|
+
* each make one, the second replacing the first under engines already made
|
|
11
|
+
* on it. A failed load is not kept, so the next call tries again.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadWasmHere(options: RuntimeAssetOptions): Promise<InitOutput>;
|
|
14
|
+
//# sourceMappingURL=runtime-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-assets.d.ts","sourceRoot":"","sources":["../src/runtime-assets.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,kBAAkB,EAClB,SAAS,GAAG,YAAY,CACzB,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAS9D;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,CAKtB;AAmBD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAef;AAID;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,UAAU,CAAC,CAarB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import init, {} from "./generated/fugue.js";
|
|
2
|
+
import { embeddedWasmBase64, embeddedWorkletSource, } from "./generated/embedded-assets.js";
|
|
3
|
+
export function parseJson(method, value) {
|
|
4
|
+
if (typeof value !== "string") {
|
|
5
|
+
throw new Error(`${method} returned a non-string JSON payload`);
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(value);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
throw new Error(`${method} returned invalid JSON: ${String(error)}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function loadWasmBytes(options) {
|
|
15
|
+
if (options.wasmUrl) {
|
|
16
|
+
return fetchWasmBytes(options.wasmUrl);
|
|
17
|
+
}
|
|
18
|
+
return decodeBase64Bytes(embeddedWasmBase64);
|
|
19
|
+
}
|
|
20
|
+
async function fetchWasmBytes(wasmUrl) {
|
|
21
|
+
const response = await fetch(wasmUrl);
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`Unable to load Fugue wasm from ${wasmUrl.toString()}`);
|
|
24
|
+
}
|
|
25
|
+
return response.arrayBuffer();
|
|
26
|
+
}
|
|
27
|
+
function decodeBase64Bytes(base64) {
|
|
28
|
+
const binary = globalThis.atob(base64);
|
|
29
|
+
const bytes = new Uint8Array(binary.length);
|
|
30
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
31
|
+
bytes[index] = binary.charCodeAt(index);
|
|
32
|
+
}
|
|
33
|
+
return bytes.buffer;
|
|
34
|
+
}
|
|
35
|
+
export async function addWorkletModule(context, options) {
|
|
36
|
+
if (options.workletUrl) {
|
|
37
|
+
await context.audioWorklet.addModule(options.workletUrl);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const blob = new Blob([embeddedWorkletSource], {
|
|
41
|
+
type: "application/javascript",
|
|
42
|
+
});
|
|
43
|
+
const workletUrl = URL.createObjectURL(blob);
|
|
44
|
+
try {
|
|
45
|
+
await context.audioWorklet.addModule(workletUrl);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
URL.revokeObjectURL(workletUrl);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let wasmHere;
|
|
52
|
+
/**
|
|
53
|
+
* Initializes the wasm module on this thread once per page, for every player
|
|
54
|
+
* here. wasm-bindgen keeps one module per page and two inits in flight would
|
|
55
|
+
* each make one, the second replacing the first under engines already made
|
|
56
|
+
* on it. A failed load is not kept, so the next call tries again.
|
|
57
|
+
*/
|
|
58
|
+
export function loadWasmHere(options) {
|
|
59
|
+
if (!wasmHere) {
|
|
60
|
+
const loading = loadWasmBytes(options).then((bytes) => init({ module_or_path: bytes }));
|
|
61
|
+
loading.catch(() => {
|
|
62
|
+
if (wasmHere === loading) {
|
|
63
|
+
wasmHere = undefined;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
wasmHere = loading;
|
|
67
|
+
}
|
|
68
|
+
return wasmHere;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=runtime-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-assets.js","sourceRo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AC,CAAC,CAAC;QACH,QAAQ,GAAG,OAAO,CAAC;IACrB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# fugue.demo.808-kit
|
|
2
|
+
|
|
3
|
+
A synthesized 808-style drum kit — the reference `sample-pack` for the
|
|
4
|
+
`samples.json` entry schema (see `src/pkg/SAMPLE_PACK.md` in the `fugue`
|
|
5
|
+
repository).
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
Six one-shots (`kick`, `snare`, `clap`, `hat-closed`, `hat-open`,
|
|
10
|
+
`cowbell`) and a one-bar 120 BPM loop assembled from them. The loop
|
|
11
|
+
declares eighth-note slice points (`beat-1` … `and-4`) for slicing
|
|
12
|
+
modules.
|
|
13
|
+
|
|
14
|
+
All audio is 48 kHz, 16-bit mono WAV, peak-normalized to −1 dBFS with
|
|
15
|
+
faded tails.
|
|
16
|
+
|
|
17
|
+
## Provenance and licensing
|
|
18
|
+
|
|
19
|
+
Every sample is synthesized from scratch using classic analog drum-machine
|
|
20
|
+
recipes (sine-sweep kick, tone-plus-noise snare, square-bank metals,
|
|
21
|
+
noise-burst clap). No third-party recordings are included. Released under
|
|
22
|
+
CC0-1.0, per the manifest.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "fugue.demo.808-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"kind": "sample-pack",
|
|
5
|
+
"license": "CC0-1.0",
|
|
6
|
+
"authors": [{ "name": "Grant Damron", "url": "https://github.com/gdamron" }],
|
|
7
|
+
"description": "A synthesized 808-style drum kit: six one-shots and a sliced one-bar loop.",
|
|
8
|
+
"homepage": "https://github.com/gdamron/fugue-packs",
|
|
9
|
+
"targets": ["external-agent", "in-graph-agent"],
|
|
10
|
+
"requires": { "capabilities": ["fs:read:samples/"] },
|
|
11
|
+
"entry": { "samples": "samples.json" }
|
|
12
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"license": "CC0-1.0",
|
|
3
|
+
"attribution": [
|
|
4
|
+
{ "name": "Grant Damron", "url": "https://github.com/gdamron" }
|
|
5
|
+
],
|
|
6
|
+
"sample_rate": [48000],
|
|
7
|
+
"tags": {
|
|
8
|
+
"genre": "electronic",
|
|
9
|
+
"instrument": "drum kit",
|
|
10
|
+
"character": "808-style synthesized"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "samples/kick.wav",
|
|
15
|
+
"tags": { "instrument": "kick drum" }
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "samples/snare.wav",
|
|
19
|
+
"tags": { "instrument": "snare drum" }
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "samples/clap.wav",
|
|
23
|
+
"tags": { "instrument": "hand clap" }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"path": "samples/hat-closed.wav",
|
|
27
|
+
"tags": { "instrument": "closed hi-hat" }
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "samples/hat-open.wav",
|
|
31
|
+
"tags": { "instrument": "open hi-hat" }
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "samples/cowbell.wav",
|
|
35
|
+
"tags": { "instrument": "cowbell" }
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"path": "samples/loop.wav",
|
|
39
|
+
"tags": { "instrument": "drum loop", "bpm": "120", "meter": "4/4" },
|
|
40
|
+
"slices": [
|
|
41
|
+
{ "start_frames": 0, "end_frames": 12000, "name": "beat-1" },
|
|
42
|
+
{ "start_frames": 12000, "end_frames": 24000, "name": "and-1" },
|
|
43
|
+
{ "start_frames": 24000, "end_frames": 36000, "name": "beat-2" },
|
|
44
|
+
{ "start_frames": 36000, "end_frames": 48000, "name": "and-2" },
|
|
45
|
+
{ "start_frames": 48000, "end_frames": 60000, "name": "beat-3" },
|
|
46
|
+
{ "start_frames": 60000, "end_frames": 72000, "name": "and-3" },
|
|
47
|
+
{ "start_frames": 72000, "end_frames": 84000, "name": "beat-4" },
|
|
48
|
+
{ "start_frames": 84000, "end_frames": 96000, "name": "and-4" }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|