@ilusiv/fyug-js 2026.11.3 → 2026.11.4

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 CHANGED
@@ -65,6 +65,58 @@ wasm's match `fyug-player-worklet.js` and `fyug-player.wasm` in the engine relea
65
65
  `SHA256SUMS.txt`. npm never changes a published version, so the bytes at a
66
66
  version's URL never change.
67
67
 
68
+ ## Previewing Notes
69
+
70
+ `previewNotes(json, request)` lists the notes a document will play over a
71
+ range of bars, without playing it, and resolves to the engine's answer:
72
+
73
+ ```ts
74
+ const answer = await player.previewNotes(invention, { start_bar: 0, bars: 8 });
75
+ for (const note of answer.notes) {
76
+ console.log(note.module_id, note.pitch, note.start_beats);
77
+ }
78
+ if (answer.truncated) {
79
+ const next = await player.previewNotes(invention, {
80
+ start_bar: 0,
81
+ bars: 8,
82
+ cursor: answer.cursor!,
83
+ });
84
+ }
85
+ ```
86
+
87
+ `json` is a complete invention document, as `loadInvention` takes it; it need
88
+ not be the loaded piece. The request takes `bars` (1 to 64), and optionally
89
+ `start_bar`, `module_id`, `seed` and `cursor`. An answer holds at most 256
90
+ notes and 48 KiB, says whether chance is involved (`chance`), and names the
91
+ `code` and `agent` modules it did not run (`not_run`). A request that needs
92
+ more than 300 seconds of audio, counted from the start of the piece to one bar
93
+ past the range, or a document the engine cannot load, is refused: the promise
94
+ rejects with an `Error` whose message is the engine's. The fields, limits and
95
+ note order are those of core's `docs/preview-notes.md`.
96
+
97
+ The preview runs on an engine of its own on the page's main thread, made on
98
+ the first call, never on the engine that plays: the loaded piece's position,
99
+ controls and output stay as they were, and it can be asked before `play()`.
100
+ It works in slices of about 8 ms that yield to the page between them.
101
+
102
+ `player.renderer` says where the player renders audio: `"audio-worklet"`, on
103
+ the audio thread, or `"main-thread"`, in a ScriptProcessorNode
104
+ (`preferMainThread`, or a browser without AudioWorklet). With the worklet a
105
+ preview cannot reach the audio. On the main thread its slices take turns with
106
+ the audio callbacks. In our measurements in desktop Chromium no callback ran
107
+ late during a 64-bar preview at any `bufferSize` from 256 to 2048, but a
108
+ slower device may drop out, so a caller that must not risk that can wait until
109
+ the player is stopped. On the worklet path the main-thread engine's wasm
110
+ memory stays with the page after `dispose()`. The page's main thread holds one
111
+ wasm module for every player on it, loaded from the first player's `wasmUrl`
112
+ (or the embedded bytes).
113
+
114
+ Pages that load the engine files themselves can call
115
+ `FugueEngine.previewNotes(json, requestJson)` from `dist/generated/fugue.js`
116
+ on an engine they made on the main thread or in a Worker; it resolves to the
117
+ answer as a JSON string and rejects with a string. Never call it in an
118
+ AudioWorklet, which has no `setTimeout`.
119
+
68
120
  ## Single-File Player
69
121
 
70
122
  Each engine release also carries `fyug-player.html`, one self-contained page for
@@ -1,10 +1,12 @@
1
- import type { ControlValue, FuguePlayerInstance, FuguePlayerOptions, RuntimeConnection, RuntimeControlGroup, RuntimeModule, RuntimeStatus } from "./types.js";
1
+ import type { ControlValue, FuguePlayerInstance, FuguePlayerOptions, FuguePlayerRenderer, NotePreview, NotePreviewRequest, RuntimeConnection, RuntimeControlGroup, RuntimeModule, RuntimeStatus } from "./types.js";
2
2
  export declare class FuguePlayer implements FuguePlayerInstance {
3
+ readonly renderer: FuguePlayerRenderer;
3
4
  private readonly context;
4
5
  private readonly node;
5
6
  private readonly destination;
6
7
  private readonly options;
7
8
  private readonly requests;
9
+ private readonly previewer;
8
10
  private nextRequestId;
9
11
  private connected;
10
12
  private disposed;
@@ -25,6 +27,7 @@ export declare class FuguePlayer implements FuguePlayerInstance {
25
27
  listControls(moduleId?: string): Promise<RuntimeControlGroup[]>;
26
28
  getControl(moduleId: string, key: string): Promise<unknown>;
27
29
  setControl(moduleId: string, key: string, value: ControlValue): Promise<void>;
30
+ previewNotes(json: string, request: NotePreviewRequest): Promise<NotePreview>;
28
31
  dispose(): Promise<void>;
29
32
  private request;
30
33
  private handleMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"FuguePlayer.d.ts","sourceRoot":"","sources":["../src/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;IAuC/B,OAAO,CAAC,cAAc;IAQhB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,IAAI,IAAI,IAAI;IAMN,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC;IAIhC,WAAW,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAIvC,eAAe,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAI/C,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAO/D,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO3D,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,IAAI,CAAC;IAIV,YAAY,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC;IAKjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB9B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,YAAY;CAKrB"}
@@ -1,65 +1,20 @@
1
- import init, { FugueEngine } from "./generated/fugue.js";
2
- import { embeddedWasmBase64, embeddedWorkletSource, } from "./generated/embedded-assets.js";
3
- 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
- }
1
+ import { FugueEngine } from "./generated/fugue.js";
2
+ import { NotePreviewer } from "./note-preview.js";
3
+ import { addWorkletModule, loadWasmBytes, loadWasmHere, parseJson, } from "./runtime-assets.js";
14
4
  function createAudioContext(options) {
15
5
  return (options.audioContext ??
16
6
  new AudioContext(options.sampleRate === undefined
17
7
  ? undefined
18
8
  : { sampleRate: options.sampleRate }));
19
9
  }
20
- async function loadWasmBytes(options) {
21
- if (options.wasmUrl) {
22
- return fetchWasmBytes(options.wasmUrl);
23
- }
24
- return decodeBase64Bytes(embeddedWasmBase64);
25
- }
26
- async function fetchWasmBytes(wasmUrl) {
27
- const response = await fetch(wasmUrl);
28
- if (!response.ok) {
29
- throw new Error(`Unable to load Fugue wasm from ${wasmUrl.toString()}`);
30
- }
31
- return response.arrayBuffer();
32
- }
33
- function decodeBase64Bytes(base64) {
34
- const binary = globalThis.atob(base64);
35
- const bytes = new Uint8Array(binary.length);
36
- for (let index = 0; index < binary.length; index += 1) {
37
- bytes[index] = binary.charCodeAt(index);
38
- }
39
- return bytes.buffer;
40
- }
41
- async function addWorkletModule(context, options) {
42
- if (options.workletUrl) {
43
- await context.audioWorklet.addModule(options.workletUrl);
44
- return;
45
- }
46
- const blob = new Blob([embeddedWorkletSource], {
47
- type: "application/javascript",
48
- });
49
- const workletUrl = URL.createObjectURL(blob);
50
- try {
51
- await context.audioWorklet.addModule(workletUrl);
52
- }
53
- finally {
54
- URL.revokeObjectURL(workletUrl);
55
- }
56
- }
57
10
  export class FuguePlayer {
11
+ renderer = "audio-worklet";
58
12
  context;
59
13
  node;
60
14
  destination;
61
15
  options;
62
16
  requests = new Map();
17
+ previewer;
63
18
  nextRequestId = 1;
64
19
  connected = false;
65
20
  disposed = false;
@@ -72,6 +27,10 @@ export class FuguePlayer {
72
27
  this.node = node;
73
28
  this.destination = options.destination ?? context.destination;
74
29
  this.options = options;
30
+ // The worklet's engine has no timers to work in slices with, and must
31
+ // not be held up: notes are listed on the main thread, on wasm loaded
32
+ // there on the first call.
33
+ this.previewer = new NotePreviewer(() => loadWasmHere(options), context.sampleRate);
75
34
  this.node.port.onmessage = (event) => {
76
35
  this.handleMessage(event.data);
77
36
  };
@@ -156,11 +115,16 @@ export class FuguePlayer {
156
115
  async setControl(moduleId, key, value) {
157
116
  await this.request("setControl", [moduleId, key, value]);
158
117
  }
118
+ async previewNotes(json, request) {
119
+ this.assertActive();
120
+ return this.previewer.preview(json, request);
121
+ }
159
122
  async dispose() {
160
123
  if (this.disposed) {
161
124
  return;
162
125
  }
163
126
  this.stop();
127
+ this.previewer.dispose();
164
128
  this.node.port.close();
165
129
  if (this.connected) {
166
130
  this.node.disconnect();
@@ -221,8 +185,12 @@ export class FuguePlayer {
221
185
  }
222
186
  }
223
187
  class MainThreadFuguePlayer {
188
+ renderer = "main-thread";
224
189
  context;
225
190
  engine;
191
+ // Its own engine, beside the one that plays: wasm is already loaded here.
192
+ // Its slices share this thread with the audio callbacks.
193
+ previewer;
226
194
  node;
227
195
  destination;
228
196
  options;
@@ -236,12 +204,13 @@ class MainThreadFuguePlayer {
236
204
  this.node = node;
237
205
  this.destination = options.destination ?? context.destination;
238
206
  this.options = options;
207
+ this.previewer = new NotePreviewer(() => loadWasmHere(options), context.sampleRate);
239
208
  this.node.onaudioprocess = (event) => {
240
209
  this.process(event);
241
210
  };
242
211
  }
243
212
  static async create(context, options = {}) {
244
- await init({ module_or_path: await loadWasmBytes(options) });
213
+ await loadWasmHere(options);
245
214
  const engine = new FugueEngine(context.sampleRate);
246
215
  const node = context.createScriptProcessor(options.bufferSize ?? 1024, 0, 2);
247
216
  return new MainThreadFuguePlayer(context, engine, node, options);
@@ -295,11 +264,16 @@ class MainThreadFuguePlayer {
295
264
  return;
296
265
  }
297
266
  }
267
+ async previewNotes(json, request) {
268
+ this.assertActive();
269
+ return this.previewer.preview(json, request);
270
+ }
298
271
  async dispose() {
299
272
  if (this.disposed) {
300
273
  return;
301
274
  }
302
275
  this.stop();
276
+ this.previewer.dispose();
303
277
  this.node.onaudioprocess = null;
304
278
  if (this.connected) {
305
279
  this.node.disconnect();
@@ -1 +1 @@
1
- {"version":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?t+"":t,e);typeof globalThis.TextEncoder>"u"&&(globalThis.TextEncoder=class{encode(t=""){let e=[];for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<t.length){let s=t.charCodeAt(n+1);s>=56320&&s<=57343&&(r=65536+(r-55296<<10)+(s-56320),n+=1)}r<=127?e.push(r):r<=2047?e.push(192|r>>6,128|r&63):r<=65535?e.push(224|r>>12,128|r>>6&63,128|r&63):e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return new Uint8Array(e)}encodeInto(t,e){let n=this.encode(t),r=Math.min(n.length,e.length);return e.set(n.subarray(0,r)),{read:t.length,written:r}}});typeof globalThis.TextDecoder>"u"&&(globalThis.TextDecoder=class{decode(t=new Uint8Array){let e=t instanceof Uint8Array?t:new Uint8Array(t),n="";for(let r=0;r<e.length;r+=1){let s=e[r]??0;if(s<128)n+=String.fromCharCode(s);else if((s&224)===192&&r+1<e.length){let l=(s&31)<<6|(e[++r]??0)&63;n+=String.fromCharCode(l)}else if((s&240)===224&&r+2<e.length){let l=(s&15)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;n+=String.fromCharCode(l)}else if((s&248)===240&&r+3<e.length){let l=(s&7)<<18|((e[++r]??0)&63)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;l-=65536,n+=String.fromCharCode(55296+(l>>10),56320+(l&1023))}else n+="\uFFFD"}return n}});if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function"){let i=(Date.now()&4294967295^(typeof currentTime=="number"?currentTime*4294967295:0)>>>0)>>>0,t=()=>(i^=i<<13,i^=i>>>17,i^=i<<5,i&255),e={getRandomValues(n){if(!n||!ArrayBuffer.isView(n))throw new TypeError("Expected an integer typed array");let r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);for(let s=0;s<r.length;s+=1)r[s]=t();return n}};typeof globalThis.crypto>"u"?Object.defineProperty(globalThis,"crypto",{configurable:!0,value:e}):Object.defineProperty(globalThis.crypto,"getRandomValues",{configurable:!0,value:e.getRandomValues})}var $={},h=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,R.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_fugueengine_free(t,0)}addModule(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c;var a=S(n)?0:f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=c;let u=o.fugueengine_addModule(this.__wbg_ptr,r,s,l,_,a,g);if(u[1])throw d(u[0])}connect(t,e,n,r){let s=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,b=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),M=c,p=o.fugueengine_connect(this.__wbg_ptr,s,l,_,a,g,u,b,M);if(p[1])throw d(p[0])}disconnect(t,e,n,r){let s=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,b=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),M=c,p=o.fugueengine_disconnect(this.__wbg_ptr,s,l,_,a,g,u,b,M);if(p[1])throw d(p[0])}finishAudioFileSink(t){let e,n;try{let l=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_finishAudioFileSink(this.__wbg_ptr,l,_);var r=a[0],s=a[1];if(a[3])throw r=0,s=0,d(a[2]);return e=r,n=s,w(r,s)}finally{o.__wbindgen_free(e,n,1)}}getAudioFileSinkWav(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_getAudioFileSinkWav(this.__wbg_ptr,e,n);if(r[3])throw d(r[2]);var s=B(r[0],r[1]).slice();return o.__wbindgen_free(r[0],r[1]*1,1),s}getCodeModuleConfig(t){let e,n;try{let l=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_getCodeModuleConfig(this.__wbg_ptr,l,_);var r=a[0],s=a[1];if(a[3])throw r=0,s=0,d(a[2]);return e=r,n=s,w(r,s)}finally{o.__wbindgen_free(e,n,1)}}getControl(t,e){let n,r;try{let _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,b=o.fugueengine_getControl(this.__wbg_ptr,_,a,g,u);var s=b[0],l=b[1];if(b[3])throw s=0,l=0,d(b[2]);return n=s,r=l,w(s,l)}finally{o.__wbindgen_free(n,r,1)}}listCodeModules(){let t,e;try{let s=o.fugueengine_listCodeModules(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}listConnections(){let t,e;try{let s=o.fugueengine_listConnections(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}listControls(t){let e,n;try{var r=S(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c;let a=o.fugueengine_listControls(this.__wbg_ptr,r,s);var l=a[0],_=a[1];if(a[3])throw l=0,_=0,d(a[2]);return e=l,n=_,w(l,_)}finally{o.__wbindgen_free(e,n,1)}}listModules(){let t,e;try{let s=o.fugueengine_listModules(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}loadInvention(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_loadInvention(this.__wbg_ptr,e,n);if(r[1])throw d(r[0])}constructor(t){let e=o.fugueengine_new(t);return this.__wbg_ptr=e,R.register(this,this.__wbg_ptr,this),this}removeModule(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_removeModule(this.__wbg_ptr,e,n);if(r[1])throw d(r[0])}renderInterleavedInto(t){let e=o.fugueengine_renderInterleavedInto(this.__wbg_ptr,t);if(e[2])throw d(e[1]);return e[0]>>>0}renderInterleaved(t){let e=o.fugueengine_renderInterleaved(this.__wbg_ptr,t);if(e[3])throw d(e[2]);var n=F(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),n}reset(){let t=o.fugueengine_reset(this.__wbg_ptr);if(t[1])throw d(t[0])}sampleRate(){return o.fugueengine_sampleRate(this.__wbg_ptr)>>>0}setCodeModuleError(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=o.fugueengine_setCodeModuleError(this.__wbg_ptr,n,r,s,l);if(_[1])throw d(_[0])}setCodeModuleStatus(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=o.fugueengine_setCodeModuleStatus(this.__wbg_ptr,n,r,s,l);if(_[1])throw d(_[0])}setControlBool(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_setControlBool(this.__wbg_ptr,r,s,l,_,n);if(a[1])throw d(a[0])}setControlNumber(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_setControlNumber(this.__wbg_ptr,r,s,l,_,n);if(a[1])throw d(a[0])}setControlString(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=c,u=o.fugueengine_setControlString(this.__wbg_ptr,r,s,l,_,a,g);if(u[1])throw d(u[0])}status(){let t,e;try{let s=o.fugueengine_status(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}};Symbol.dispose&&(h.prototype[Symbol.dispose]=h.prototype.free);function k(){return{__proto__:null,"./fugue_bg.js":{__proto__:null,__wbg___wbindgen_throw_41e9ee4f547fc59a:function(t,e){throw new Error(w(t,e))},__wbg_getRandomValues_436a51d0629d84e1:function(){return D(function(t,e){globalThis.crypto.getRandomValues(B(t,e))},arguments)},__wbg_length_58572db4c38f3c3e:function(t){return t.length},__wbg_set_070bd465f1c195a4:function(t,e,n){t.set(F(e,n))},__wbindgen_generic_0000000000000001:function(t,e){return w(t,e)},__wbindgen_init_externref_table:function(){let t=o.__wbindgen_externrefs,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)}}}}var R=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>o.__wbg_fugueengine_free(i,1));function U(i){let t=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(t,i),t}function F(i,t){return i=i>>>0,V().subarray(i/4,i/4+t)}function B(i,t){return i=i>>>0,v().subarray(i/1,i/1+t)}var m=null;function V(){return(m===null||m.byteLength===0)&&(m=new Float32Array(o.memory.buffer)),m}function w(i,t){return j(i>>>0,t)}var x=null;function v(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function D(i,t){try{return i.apply(this,t)}catch(e){let n=U(e);o.__wbindgen_exn_store(n)}}function S(i){return i==null}function f(i,t,e){if(e===void 0){let _=C.encode(i),a=t(_.length,1)>>>0;return v().subarray(a,a+_.length).set(_),c=_.length,a}let n=i.length,r=t(n,1)>>>0,s=v(),l=0;for(;l<n;l++){let _=i.charCodeAt(l);if(_>127)break;s[r+l]=_}if(l!==n){l!==0&&(i=i.slice(l)),r=e(r,n,n=l+i.length*3,1)>>>0;let _=v().subarray(r+l,r+n),a=C.encodeInto(i,_);l+=a.written,r=e(r,n,l,1)>>>0}return c=l,r}function d(i){let t=o.__wbindgen_externrefs.get(i);return o.__externref_table_dealloc(i),t}var A=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});A.decode();var P=2146435072,T=0;function j(i,t){return T+=t,T>=P&&(A=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),A.decode(),T=t),A.decode(v().subarray(i,i+t))}var C=new TextEncoder;"encodeInto"in C||(C.encodeInto=function(i,t){let e=C.encode(i);return t.set(e),{read:i.length,written:e.length}});var c=0,q,L,o;function z(i,t){return L=i,o=i.exports,q=t,m=null,x=null,o.__wbindgen_start(),o}async function N(i,t){if(typeof Response=="function"&&i instanceof Response){if(!i.ok)throw new Error(`failed to fetch Wasm: ${i.status} ${i.statusText} fetching '${i.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(i,t)}catch(r){if(e(i.type)&&i.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let n=await i.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(i,t);return n instanceof WebAssembly.Instance?{instance:n,module:i}:n}function e(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}async function I(i){if(o!==void 0)return o;i!==void 0&&(Object.getPrototypeOf(i)===Object.prototype?{module_or_path:i}=i:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),i===void 0&&(i=new URL("fugue_bg.wasm",$.url));let t=k();(typeof i=="string"||typeof Request=="function"&&i instanceof Request||typeof URL=="function"&&i instanceof URL)&&(i=fetch(i));let{instance:e,module:n}=await N(await i,t);return z(e,n)}var E=class extends AudioWorkletProcessor{constructor(e){super();y(this,"engine",null);y(this,"ready",!1);y(this,"playing",!1);y(this,"renderBuffer",new Float32Array(0));this.port.onmessage=n=>{this.handleMessage(n.data)},this.initialize(e?.processorOptions??{})}async initialize(e){try{await I({module_or_path:e.wasmBytes}),this.engine=new h(e.sampleRate??sampleRate),this.ready=!0,this.port.postMessage({type:"ready"})}catch(n){this.postError(n)}}handleMessage(e){if(!(!e||typeof e!="object")){if(e.type==="play"){this.playing=!0,this.port.postMessage({type:"state",state:"playing"});return}if(e.type==="stop"){this.playing=!1,this.port.postMessage({type:"state",state:"stopped"});return}if(e.type==="request")try{let n=this.handleRequest(e.method,e.args??[]);this.port.postMessage({type:"response",id:e.id,result:n})}catch(n){this.port.postMessage({type:"response",id:e.id,error:n instanceof Error?n.message:String(n)})}}}handleRequest(e,n){if(!this.ready||!this.engine)throw new Error("Fugue engine is not ready");switch(e){case"loadInvention":return this.engine.loadInvention(n[0]),null;case"reset":return this.engine.reset(),null;case"status":return this.engine.status();case"listModules":return this.engine.listModules();case"listConnections":return this.engine.listConnections();case"listControls":return this.engine.listControls(n[0]);case"getControl":return this.engine.getControl(n[0],n[1]);case"setControl":return this.setControl(n[0],n[1],n[2]),null;default:throw new Error(`Unknown Fugue player method: ${e}`)}}setControl(e,n,r){switch(typeof r){case"number":this.engine?.setControlNumber(e,n,r);return;case"boolean":this.engine?.setControlBool(e,n,r);return;case"string":this.engine?.setControlString(e,n,r);return}}process(e,n){let r=n[0],s=r?.[0],l=r?.[1];if(!s||!l)return!0;if(!this.playing||!this.ready||!this.engine)return s.fill(0),l.fill(0),!0;let _=s.length,a=_*2;this.renderBuffer.length!==a&&(this.renderBuffer=new Float32Array(a));try{this.engine.renderInterleavedInto(this.renderBuffer);for(let g=0,u=0;g<_;g+=1,u+=2)s[g]=this.renderBuffer[u]??0,l[g]=this.renderBuffer[u+1]??0}catch(g){this.playing=!1,s.fill(0),l.fill(0),this.postError(g)}return!0}postError(e){this.port.postMessage({type:"error",error:e instanceof Error?e.message:String(e)})}};registerProcessor("fugue-audio-worklet",E);})();
1
+ "use strict";(()=>{var O=Object.defineProperty;var U=(i,t,e)=>t in i?O(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var y=(i,t,e)=>U(i,typeof t!="symbol"?t+"":t,e);typeof globalThis.TextEncoder>"u"&&(globalThis.TextEncoder=class{encode(t=""){let e=[];for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<t.length){let s=t.charCodeAt(n+1);s>=56320&&s<=57343&&(r=65536+(r-55296<<10)+(s-56320),n+=1)}r<=127?e.push(r):r<=2047?e.push(192|r>>6,128|r&63):r<=65535?e.push(224|r>>12,128|r>>6&63,128|r&63):e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return new Uint8Array(e)}encodeInto(t,e){let n=this.encode(t),r=Math.min(n.length,e.length);return e.set(n.subarray(0,r)),{read:t.length,written:r}}});typeof globalThis.TextDecoder>"u"&&(globalThis.TextDecoder=class{decode(t=new Uint8Array){let e=t instanceof Uint8Array?t:new Uint8Array(t),n="";for(let r=0;r<e.length;r+=1){let s=e[r]??0;if(s<128)n+=String.fromCharCode(s);else if((s&224)===192&&r+1<e.length){let _=(s&31)<<6|(e[++r]??0)&63;n+=String.fromCharCode(_)}else if((s&240)===224&&r+2<e.length){let _=(s&15)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;n+=String.fromCharCode(_)}else if((s&248)===240&&r+3<e.length){let _=(s&7)<<18|((e[++r]??0)&63)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;_-=65536,n+=String.fromCharCode(55296+(_>>10),56320+(_&1023))}else n+="\uFFFD"}return n}});if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function"){let i=(Date.now()&4294967295^(typeof currentTime=="number"?currentTime*4294967295:0)>>>0)>>>0,t=()=>(i^=i<<13,i^=i>>>17,i^=i<<5,i&255),e={getRandomValues(n){if(!n||!ArrayBuffer.isView(n))throw new TypeError("Expected an integer typed array");let r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);for(let s=0;s<r.length;s+=1)r[s]=t();return n}};typeof globalThis.crypto>"u"?Object.defineProperty(globalThis,"crypto",{configurable:!0,value:e}):Object.defineProperty(globalThis.crypto,"getRandomValues",{configurable:!0,value:e.getRandomValues})}var H={},h=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,E.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_fugueengine_free(t,0)}addModule(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c;var a=B(n)?0:f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c;let g=o.fugueengine_addModule(this.__wbg_ptr,r,s,_,l,a,u);if(g[1])throw d(g[0])}connect(t,e,n,r){let s=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,u=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=c,w=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),M=c,p=o.fugueengine_connect(this.__wbg_ptr,s,_,l,a,u,g,w,M);if(p[1])throw d(p[0])}disconnect(t,e,n,r){let s=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,u=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=c,w=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),M=c,p=o.fugueengine_disconnect(this.__wbg_ptr,s,_,l,a,u,g,w,M);if(p[1])throw d(p[0])}finishAudioFileSink(t){let e,n;try{let _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,a=o.fugueengine_finishAudioFileSink(this.__wbg_ptr,_,l);var r=a[0],s=a[1];if(a[3])throw r=0,s=0,d(a[2]);return e=r,n=s,b(r,s)}finally{o.__wbindgen_free(e,n,1)}}getAudioFileSinkWav(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_getAudioFileSinkWav(this.__wbg_ptr,e,n);if(r[3])throw d(r[2]);var s=I(r[0],r[1]).slice();return o.__wbindgen_free(r[0],r[1]*1,1),s}getCodeModuleConfig(t){let e,n;try{let _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,a=o.fugueengine_getCodeModuleConfig(this.__wbg_ptr,_,l);var r=a[0],s=a[1];if(a[3])throw r=0,s=0,d(a[2]);return e=r,n=s,b(r,s)}finally{o.__wbindgen_free(e,n,1)}}getControl(t,e){let n,r;try{let l=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,u=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),g=c,w=o.fugueengine_getControl(this.__wbg_ptr,l,a,u,g);var s=w[0],_=w[1];if(w[3])throw s=0,_=0,d(w[2]);return n=s,r=_,b(s,_)}finally{o.__wbindgen_free(n,r,1)}}listCodeModules(){let t,e;try{let s=o.fugueengine_listCodeModules(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,b(n,r)}finally{o.__wbindgen_free(t,e,1)}}listConnections(){let t,e;try{let s=o.fugueengine_listConnections(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,b(n,r)}finally{o.__wbindgen_free(t,e,1)}}listControls(t){let e,n;try{var r=B(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c;let a=o.fugueengine_listControls(this.__wbg_ptr,r,s);var _=a[0],l=a[1];if(a[3])throw _=0,l=0,d(a[2]);return e=_,n=l,b(_,l)}finally{o.__wbindgen_free(e,n,1)}}listModules(){let t,e;try{let s=o.fugueengine_listModules(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,b(n,r)}finally{o.__wbindgen_free(t,e,1)}}loadInvention(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_loadInvention(this.__wbg_ptr,e,n);if(r[1])throw d(r[0])}constructor(t){let e=o.fugueengine_new(t);return this.__wbg_ptr=e,E.register(this,this.__wbg_ptr,this),this}previewNotes(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c;return o.fugueengine_previewNotes(this.__wbg_ptr,n,r,s,_)}removeModule(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_removeModule(this.__wbg_ptr,e,n);if(r[1])throw d(r[0])}renderInterleavedInto(t){let e=o.fugueengine_renderInterleavedInto(this.__wbg_ptr,t);if(e[2])throw d(e[1]);return e[0]>>>0}renderInterleaved(t){let e=o.fugueengine_renderInterleaved(this.__wbg_ptr,t);if(e[3])throw d(e[2]);var n=k(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),n}reset(){let t=o.fugueengine_reset(this.__wbg_ptr);if(t[1])throw d(t[0])}sampleRate(){return o.fugueengine_sampleRate(this.__wbg_ptr)>>>0}setCodeModuleError(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,l=o.fugueengine_setCodeModuleError(this.__wbg_ptr,n,r,s,_);if(l[1])throw d(l[0])}setCodeModuleStatus(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,l=o.fugueengine_setCodeModuleStatus(this.__wbg_ptr,n,r,s,_);if(l[1])throw d(l[0])}setControlBool(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,a=o.fugueengine_setControlBool(this.__wbg_ptr,r,s,_,l,n);if(a[1])throw d(a[0])}setControlNumber(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,a=o.fugueengine_setControlNumber(this.__wbg_ptr,r,s,_,l,n);if(a[1])throw d(a[0])}setControlString(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,a=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,g=o.fugueengine_setControlString(this.__wbg_ptr,r,s,_,l,a,u);if(g[1])throw d(g[0])}status(){let t,e;try{let s=o.fugueengine_status(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,b(n,r)}finally{o.__wbindgen_free(t,e,1)}}};Symbol.dispose&&(h.prototype[Symbol.dispose]=h.prototype.free);function D(){return{__proto__:null,"./fugue_bg.js":{__proto__:null,__wbg___wbindgen_throw_41e9ee4f547fc59a:function(t,e){throw new Error(b(t,e))},__wbg__wbg_cb_unref_dcc1a90847f04c41:function(t){t._wbg_cb_unref()},__wbg_call_187d372bd5fdd4aa:function(){return F(function(t,e,n){return t.call(e,n)},arguments)},__wbg_getRandomValues_436a51d0629d84e1:function(){return F(function(t,e){globalThis.crypto.getRandomValues(I(t,e))},arguments)},__wbg_length_58572db4c38f3c3e:function(t){return t.length},__wbg_new_5502aad30c185fc8:function(t,e){try{var n={a:t,b:e},r=(_,l)=>{let a=n.a;n.a=0;try{return P(a,n.b,_,l)}finally{n.a=a}};return new Promise(r)}finally{n.a=0}},__wbg_now_aa4ccb83129e9e55:function(){return Date.now()},__wbg_setTimeout_4bf75e1eaccfc9e2:function(t,e){return setTimeout(t,e)},__wbg_set_070bd465f1c195a4:function(t,e,n){t.set(k(e,n))},__wbindgen_generic_0000000000000001:function(t,e){return z(t,e,V)},__wbindgen_generic_0000000000000002:function(t,e){return b(t,e)},__wbindgen_init_externref_table:function(){let t=o.__wbindgen_externrefs,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)}}}}function V(i,t){o.wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74(i,t)}function P(i,t,e,n){o.wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534(i,t,e,n)}var E=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>o.__wbg_fugueengine_free(i,1));function j(i){let t=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(t,i),t}var S=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>o.__wbindgen_destroy_closure(i.a,i.b));function k(i,t){return i=i>>>0,q().subarray(i/4,i/4+t)}function I(i,t){return i=i>>>0,v().subarray(i/1,i/1+t)}var m=null;function q(){return(m===null||m.byteLength===0)&&(m=new Float32Array(o.memory.buffer)),m}function b(i,t){return N(i>>>0,t)}var x=null;function v(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function F(i,t){try{return i.apply(this,t)}catch(e){let n=j(e);o.__wbindgen_exn_store(n)}}function B(i){return i==null}function z(i,t,e){let n={a:i,b:t,cnt:1},r=(...s)=>{n.cnt++;let _=n.a;n.a=0;try{return e(_,n.b,...s)}finally{n.a=_,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,S.unregister(n))},S.register(r,n,n),r}function f(i,t,e){if(e===void 0){let l=C.encode(i),a=t(l.length,1)>>>0;return v().subarray(a,a+l.length).set(l),c=l.length,a}let n=i.length,r=t(n,1)>>>0,s=v(),_=0;for(;_<n;_++){let l=i.charCodeAt(_);if(l>127)break;s[r+_]=l}if(_!==n){_!==0&&(i=i.slice(_)),r=e(r,n,n=_+i.length*3,1)>>>0;let l=v().subarray(r+_,r+n),a=C.encodeInto(i,l);_+=a.written,r=e(r,n,_,1)>>>0}return c=_,r}function d(i){let t=o.__wbindgen_externrefs.get(i);return o.__externref_table_dealloc(i),t}var A=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});A.decode();var L=2146435072,T=0;function N(i,t){return T+=t,T>=L&&(A=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),A.decode(),T=t),A.decode(v().subarray(i,i+t))}var C=new TextEncoder;"encodeInto"in C||(C.encodeInto=function(i,t){let e=C.encode(i);return t.set(e),{read:i.length,written:e.length}});var c=0,$,X,o;function Y(i,t){return X=i,o=i.exports,$=t,m=null,x=null,o.__wbindgen_start(),o}async function G(i,t){if(typeof Response=="function"&&i instanceof Response){if(!i.ok)throw new Error(`failed to fetch Wasm: ${i.status} ${i.statusText} fetching '${i.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(i,t)}catch(r){if(e(i.type)&&i.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let n=await i.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(i,t);return n instanceof WebAssembly.Instance?{instance:n,module:i}:n}function e(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}async function W(i){if(o!==void 0)return o;i!==void 0&&(Object.getPrototypeOf(i)===Object.prototype?{module_or_path:i}=i:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),i===void 0&&(i=new URL("fugue_bg.wasm",H.url));let t=D();(typeof i=="string"||typeof Request=="function"&&i instanceof Request||typeof URL=="function"&&i instanceof URL)&&(i=fetch(i));let{instance:e,module:n}=await G(await i,t);return Y(e,n)}var R=class extends AudioWorkletProcessor{constructor(e){super();y(this,"engine",null);y(this,"ready",!1);y(this,"playing",!1);y(this,"renderBuffer",new Float32Array(0));this.port.onmessage=n=>{this.handleMessage(n.data)},this.initialize(e?.processorOptions??{})}async initialize(e){try{await W({module_or_path:e.wasmBytes}),this.engine=new h(e.sampleRate??sampleRate),this.ready=!0,this.port.postMessage({type:"ready"})}catch(n){this.postError(n)}}handleMessage(e){if(!(!e||typeof e!="object")){if(e.type==="play"){this.playing=!0,this.port.postMessage({type:"state",state:"playing"});return}if(e.type==="stop"){this.playing=!1,this.port.postMessage({type:"state",state:"stopped"});return}if(e.type==="request")try{let n=this.handleRequest(e.method,e.args??[]);this.port.postMessage({type:"response",id:e.id,result:n})}catch(n){this.port.postMessage({type:"response",id:e.id,error:n instanceof Error?n.message:String(n)})}}}handleRequest(e,n){if(!this.ready||!this.engine)throw new Error("Fugue engine is not ready");switch(e){case"loadInvention":return this.engine.loadInvention(n[0]),null;case"reset":return this.engine.reset(),null;case"status":return this.engine.status();case"listModules":return this.engine.listModules();case"listConnections":return this.engine.listConnections();case"listControls":return this.engine.listControls(n[0]);case"getControl":return this.engine.getControl(n[0],n[1]);case"setControl":return this.setControl(n[0],n[1],n[2]),null;default:throw new Error(`Unknown Fugue player method: ${e}`)}}setControl(e,n,r){switch(typeof r){case"number":this.engine?.setControlNumber(e,n,r);return;case"boolean":this.engine?.setControlBool(e,n,r);return;case"string":this.engine?.setControlString(e,n,r);return}}process(e,n){let r=n[0],s=r?.[0],_=r?.[1];if(!s||!_)return!0;if(!this.playing||!this.ready||!this.engine)return s.fill(0),_.fill(0),!0;let l=s.length,a=l*2;this.renderBuffer.length!==a&&(this.renderBuffer=new Float32Array(a));try{this.engine.renderInterleavedInto(this.renderBuffer);for(let u=0,g=0;u<l;u+=1,g+=2)s[u]=this.renderBuffer[g]??0,_[u]=this.renderBuffer[g+1]??0}catch(u){this.playing=!1,s.fill(0),_.fill(0),this.postError(u)}return!0}postError(e){this.port.postMessage({type:"error",error:e instanceof Error?e.message:String(e)})}};registerProcessor("fugue-audio-worklet",R);})();