@grame/faustwasm 0.7.3 → 0.7.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.
@@ -0,0 +1,1585 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ /// <reference types="emscripten" />
4
+
5
+ export type FaustModuleFactory = EmscriptenModuleFactory<FaustModule>;
6
+ export interface FaustModule extends EmscriptenModule {
7
+ ccall: typeof ccall;
8
+ cwrap: typeof cwrap;
9
+ UTF8ArrayToString(u8Array: number[], ptr: number, maxBytesToRead?: number): string;
10
+ stringToUTF8Array(str: string, outU8Array: number[], outIdx: number, maxBytesToWrite: number): number;
11
+ UTF8ToString: typeof UTF8ToString;
12
+ UTF16ToString: typeof UTF16ToString;
13
+ UTF32ToString: typeof UTF32ToString;
14
+ stringToUTF8: typeof stringToUTF8;
15
+ stringToUTF16: typeof stringToUTF16;
16
+ stringToUTF32: typeof stringToUTF32;
17
+ allocateUTF8: typeof allocateUTF8;
18
+ lengthBytesUTF8: typeof lengthBytesUTF8;
19
+ lengthBytesUTF16: typeof lengthBytesUTF16;
20
+ lengthBytesUTF32: typeof lengthBytesUTF32;
21
+ FS: typeof FS;
22
+ libFaustWasm: new () => LibFaustWasm;
23
+ }
24
+ export type FaustInfoType = "help" | "version" | "libdir" | "includedir" | "archdir" | "dspdir" | "pathslist";
25
+ export interface IntVector {
26
+ size(): number;
27
+ get(i: number): number;
28
+ delete(): void;
29
+ }
30
+ export interface FaustDspWasm {
31
+ cfactory: number;
32
+ data: IntVector;
33
+ json: string;
34
+ }
35
+ export interface LibFaustWasm {
36
+ /**
37
+ * Return the Faust compiler version.
38
+ *
39
+ * @returns the version
40
+ */
41
+ version(): string;
42
+ /**
43
+ * Create a dsp factory from Faust code.
44
+ *
45
+ * @param name - an arbitrary name for the Faust module
46
+ * @param code - Faust dsp code
47
+ * @param args - the compiler options
48
+ * @param useInternalMemory - tell the compiler to generate static embedded memory or not
49
+ * @returns an opaque reference to the factory
50
+ */
51
+ createDSPFactory(name: string, code: string, args: string, useInternalMemory: boolean): FaustDspWasm;
52
+ /**
53
+ * Delete a dsp factory.
54
+ *
55
+ * @param cFactory - the factory C++ internal pointer as a number
56
+ */
57
+ deleteDSPFactory(cFactory: number): void;
58
+ /**
59
+ * Expand Faust code i.e. linearize included libraries.
60
+ *
61
+ * @param name - an arbitrary name for the Faust module
62
+ * @param code - Faust dsp code
63
+ * @param args - the compiler options
64
+ * @returns return the expanded dsp code
65
+ */
66
+ expandDSP(name: string, code: string, args: string): string;
67
+ /**
68
+ * Generates auxiliary files from Faust code. The output depends on the compiler options.
69
+ *
70
+ * @param name - an arbitrary name for the faust module
71
+ * @param code - Faust dsp code
72
+ * @param args - the compiler options
73
+ */
74
+ generateAuxFiles(name: string, code: string, args: string): boolean;
75
+ /**
76
+ * Delete all existing dsp factories.
77
+ */
78
+ deleteAllDSPFactories(): void;
79
+ /**
80
+ * Exception management: gives an error string
81
+ */
82
+ getErrorAfterException(): string;
83
+ /**
84
+ * Exception management: cleanup
85
+ * Should be called after each exception generated by the LibFaust methods.
86
+ */
87
+ cleanupAfterException(): void;
88
+ /**
89
+ * Get info about the embedded Faust engine
90
+ * @param what - the requested info
91
+ */
92
+ getInfos(what: FaustInfoType): string;
93
+ }
94
+ export interface FaustDspFactory extends Required<LooseFaustDspFactory> {
95
+ }
96
+ /**
97
+ * The Factory structure.
98
+ */
99
+ export interface LooseFaustDspFactory {
100
+ /** a "pointer" (as an integer) on the internal C++ factory */
101
+ cfactory?: number;
102
+ /** the WASM code as a binary array */
103
+ code?: Uint8Array;
104
+ /** the compule WASM module */
105
+ module: WebAssembly.Module;
106
+ /** the compiled DSP JSON description */
107
+ json: string;
108
+ /** whether the factory is a polyphonic one or not */
109
+ poly?: boolean;
110
+ /** a unique identifier */
111
+ shaKey?: string;
112
+ /** a map of transferable audio buffers for the `soundfile` function */
113
+ soundfiles: Record<string, (AudioData | null)>;
114
+ }
115
+ export interface FaustDspMeta {
116
+ name: string;
117
+ filename: string;
118
+ compile_options: string;
119
+ include_pathnames: string[];
120
+ inputs: number;
121
+ outputs: number;
122
+ size: number;
123
+ version: string;
124
+ library_list: string[];
125
+ meta: {
126
+ [key: string]: string;
127
+ }[];
128
+ ui: FaustUIDescriptor;
129
+ }
130
+ export type FaustUIDescriptor = FaustUIGroup[];
131
+ export type FaustUIItem = FaustUIInputItem | FaustUIOutputItem | FaustUIGroup;
132
+ export interface FaustUIInputItem {
133
+ type: FaustUIInputType;
134
+ label: string;
135
+ address: string;
136
+ url: string;
137
+ index: number;
138
+ init?: number;
139
+ min?: number;
140
+ max?: number;
141
+ step?: number;
142
+ meta?: FaustUIMeta[];
143
+ }
144
+ export interface FaustUIOutputItem {
145
+ type: FaustUIOutputType;
146
+ label: string;
147
+ address: string;
148
+ index: number;
149
+ min?: number;
150
+ max?: number;
151
+ meta?: FaustUIMeta[];
152
+ }
153
+ export interface FaustUIMeta {
154
+ [order: number]: string;
155
+ style?: string;
156
+ unit?: string;
157
+ scale?: "linear" | "exp" | "log";
158
+ tooltip?: string;
159
+ hidden?: string;
160
+ [key: string]: string | undefined;
161
+ }
162
+ export type FaustUIGroupType = "vgroup" | "hgroup" | "tgroup";
163
+ export type FaustUIOutputType = "hbargraph" | "vbargraph";
164
+ export type FaustUIInputType = "vslider" | "hslider" | "button" | "checkbox" | "nentry" | "soundfile";
165
+ export interface FaustUIGroup {
166
+ type: FaustUIGroupType;
167
+ label: string;
168
+ items: FaustUIItem[];
169
+ }
170
+ export type FaustUIType = FaustUIGroupType | FaustUIOutputType | FaustUIInputType;
171
+ export interface AudioParamDescriptor {
172
+ automationRate?: AutomationRate;
173
+ defaultValue?: number;
174
+ maxValue?: number;
175
+ minValue?: number;
176
+ name: string;
177
+ }
178
+ export interface AudioWorkletProcessor {
179
+ port: MessagePort;
180
+ process(inputs: Float32Array[][], outputs: Float32Array[][], parameters: Record<string, Float32Array>): boolean;
181
+ }
182
+ export declare const AudioWorkletProcessor: {
183
+ prototype: AudioWorkletProcessor;
184
+ parameterDescriptors: AudioParamDescriptor[];
185
+ new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
186
+ };
187
+ export interface AudioWorkletGlobalScope {
188
+ AudioWorkletGlobalScope: any;
189
+ globalThis: AudioWorkletGlobalScope;
190
+ registerProcessor: (name: string, constructor: new (options: any) => AudioWorkletProcessor) => void;
191
+ currentFrame: number;
192
+ currentTime: number;
193
+ sampleRate: number;
194
+ AudioWorkletProcessor: typeof AudioWorkletProcessor;
195
+ }
196
+ export interface InterfaceFFT {
197
+ forward(arr: ArrayLike<number> | ((arr: Float32Array) => any)): Float32Array;
198
+ inverse(arr: ArrayLike<number> | ((arr: Float32Array) => any)): Float32Array;
199
+ dispose(): void;
200
+ }
201
+ export declare const InterfaceFFT: {
202
+ new (size: number): InterfaceFFT;
203
+ };
204
+ export type TWindowFunction = (index: number, length: number, ...args: any[]) => number;
205
+ export type Writeable<T> = {
206
+ -readonly [P in keyof T]: T[P];
207
+ };
208
+ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
209
+ export type TypedArrayConstructor = typeof Int8Array | typeof Uint8Array | typeof Int16Array | typeof Uint16Array | typeof Int32Array | typeof Uint32Array | typeof Uint8ClampedArray | typeof Float32Array | typeof Float64Array;
210
+ export declare const FFTUtils: {
211
+ /** Inject window functions as array, no need to add rectangular (no windowing) */
212
+ windowFunctions?: TWindowFunction[];
213
+ /** Get a FFT interface constructor */
214
+ getFFT: () => Promise<typeof InterfaceFFT>;
215
+ /** Convert from FFTed (spectral) signal to three arrays for Faust processor's input, fft is readonly, real/imag/index length = *fftSize* / 2 + 1; fft length depends on the FFT implementation */
216
+ fftToSignal: (fft: Float32Array | Float64Array, real: Float32Array | Float64Array, imag?: Float32Array | Float64Array, index?: Float32Array | Float64Array) => any;
217
+ /** Convert from Faust processor's output to spectral data for Inversed FFT, real/imag are readonly, real/imag length = *fftSize* / 2 + 1; fft length depends on the FFT implementation */
218
+ signalToFFT: (real: Float32Array | Float64Array, imag: Float32Array | Float64Array, fft: Float32Array | Float64Array) => any;
219
+ /** Convert from Faust processor's output to direct audio output, real/imag are readonly, fft length = fftSize = (real/imag length - 1) * 2 */
220
+ signalToNoFFT: (real: Float32Array | Float64Array, imag: Float32Array | Float64Array, fft: Float32Array | Float64Array) => any;
221
+ };
222
+ export interface AudioData {
223
+ sampleRate: number;
224
+ audioBuffer: Float32Array[];
225
+ }
226
+ /**
227
+ * Load libfaust-wasm files, than instantiate libFaust
228
+ * @param jsFile path to `libfaust-wasm.js`
229
+ * @param dataFile path to `libfaust-wasm.data`
230
+ * @param wasmFile path to `libfaust-wasm.wasm`
231
+ */
232
+ export declare const instantiateFaustModuleFromFile: (jsFile: string, dataFile?: string, wasmFile?: string) => Promise<FaustModule>;
233
+ /**
234
+ * The Faust wasm instance interface.
235
+ */
236
+ export interface IFaustDspInstance {
237
+ /**
238
+ * The dsp computation, to be called with successive input/output audio buffers.
239
+ *
240
+ * @param $dsp - the DSP pointer
241
+ * @param count - the audio buffer size in frames
242
+ * @param $inputs - the input audio buffer as in index in wasm memory
243
+ * @param $output - the output audio buffer as in index in wasm memory
244
+ */
245
+ compute($dsp: number, count: number, $inputs: number, $output: number): void;
246
+ /**
247
+ * Give the number of inputs of a Faust wasm instance.
248
+ *
249
+ * @param $dsp - the DSP pointer
250
+ */
251
+ getNumInputs($dsp: number): number;
252
+ /**
253
+ * Give the number of outputs of a Faust wasm instance.
254
+ *
255
+ * @param $dsp - the DSP pointer
256
+ */
257
+ getNumOutputs($dsp: number): number;
258
+ /**
259
+ * Give a parameter current value.
260
+ *
261
+ * @param $dsp - the DSP pointer
262
+ * @param index - the parameter index
263
+ * @return the parameter value
264
+ */
265
+ getParamValue($dsp: number, index: number): number;
266
+ /**
267
+ * Give the Faust wasm instance sample rate.
268
+ *
269
+ * @param $dsp - the DSP pointer
270
+ * @return the sample rate
271
+ */
272
+ getSampleRate($dsp: number): number;
273
+ /**
274
+ * Global init, calls the following methods:
275
+ * - static class 'classInit': static tables initialization
276
+ * - 'instanceInit': constants and instance state initialization
277
+ *
278
+ * @param $dsp - the DSP pointer
279
+ * @param sampleRate - the sampling rate in Hertz
280
+ */
281
+ init($dsp: number, sampleRate: number): void;
282
+ /** Init instance state (delay lines...).
283
+ *
284
+ * @param $dsp - the DSP pointer
285
+ */
286
+ instanceClear($dsp: number): void;
287
+ /** Init instance constant state.
288
+ *
289
+ * @param $dsp - the DSP pointer
290
+ * @param sampleRate - the sampling rate in Hertz
291
+ */
292
+ instanceConstants($dsp: number, sampleRate: number): void;
293
+ /** Init instance state.
294
+ *
295
+ * @param $dsp - the DSP pointer
296
+ * @param sampleRate - the sampling rate in Hertz
297
+ */
298
+ instanceInit($dsp: number, sampleRate: number): void;
299
+ /** Init default control parameters values.
300
+ *
301
+ * @param $dsp - the DSP pointer
302
+ */
303
+ instanceResetUserInterface($dsp: number): void;
304
+ /**
305
+ * Set a parameter current value.
306
+ *
307
+ * @param $dsp - the DSP pointer
308
+ * @param index - the parameter index
309
+ * @param value - the parameter value
310
+ */
311
+ setParamValue($dsp: number, index: number, value: number): void;
312
+ }
313
+ /**
314
+ * Mixer used in polyphonic mode.
315
+ */
316
+ export interface IFaustMixerInstance {
317
+ clearOutput(bufferSize: number, chans: number, $outputs: number): void;
318
+ mixCheckVoice(bufferSize: number, chans: number, $inputs: number, $outputs: number): number;
319
+ fadeOut(bufferSize: number, chans: number, $outputs: number): void;
320
+ }
321
+ /**
322
+ * Monophonic instance.
323
+ */
324
+ export interface FaustMonoDspInstance {
325
+ memory: WebAssembly.Memory;
326
+ api: IFaustDspInstance;
327
+ json: string;
328
+ }
329
+ /**
330
+ * Polyphonic instance.
331
+ */
332
+ export interface FaustPolyDspInstance {
333
+ memory: WebAssembly.Memory;
334
+ voices: number;
335
+ voiceAPI: IFaustDspInstance;
336
+ effectAPI?: IFaustDspInstance;
337
+ mixerAPI: IFaustMixerInstance;
338
+ voiceJSON: string;
339
+ effectJSON?: string;
340
+ }
341
+ export declare class FaustDspInstance implements IFaustDspInstance {
342
+ private readonly fExports;
343
+ constructor(exports: IFaustDspInstance);
344
+ compute($dsp: number, count: number, $input: number, $output: number): void;
345
+ getNumInputs($dsp: number): number;
346
+ getNumOutputs($dsp: number): number;
347
+ getParamValue($dsp: number, index: number): number;
348
+ getSampleRate($dsp: number): number;
349
+ init($dsp: number, sampleRate: number): void;
350
+ instanceClear($dsp: number): void;
351
+ instanceConstants($dsp: number, sampleRate: number): void;
352
+ instanceInit($dsp: number, sampleRate: number): void;
353
+ instanceResetUserInterface($dsp: number): void;
354
+ setParamValue($dsp: number, index: number, value: number): void;
355
+ }
356
+ export declare class FaustWasmInstantiator {
357
+ private static createWasmImport;
358
+ private static createWasmMemoryPoly;
359
+ private static createWasmMemoryMono;
360
+ private static createMonoDSPInstanceAux;
361
+ private static createMemoryMono;
362
+ private static createMemoryPoly;
363
+ private static createMixerAux;
364
+ static loadDSPFactory(wasmPath: string, jsonPath: string): Promise<FaustDspFactory>;
365
+ static loadDSPMixer(mixerPath: string, fs?: typeof FS): Promise<WebAssembly.Module>;
366
+ static createAsyncMonoDSPInstance(factory: LooseFaustDspFactory): Promise<FaustMonoDspInstance>;
367
+ static createSyncMonoDSPInstance(factory: LooseFaustDspFactory): FaustMonoDspInstance;
368
+ static createAsyncPolyDSPInstance(voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, effectFactory?: LooseFaustDspFactory): Promise<FaustPolyDspInstance>;
369
+ static createSyncPolyDSPInstance(voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, effectFactory?: LooseFaustDspFactory): FaustPolyDspInstance;
370
+ }
371
+ export type OutputParamHandler = (path: string, value: number) => void;
372
+ export type ComputeHandler = (buffer_size: number) => void;
373
+ export type PlotHandler = (plotted: Float32Array[] | Float64Array[], index: number, events?: {
374
+ type: string;
375
+ data: any;
376
+ }[]) => void;
377
+ export type MetadataHandler = (key: string, value: string) => void;
378
+ export type UIHandler = (item: FaustUIItem) => void;
379
+ export type SensorEventHandler = (val: number) => void;
380
+ export type SensorEventHandlers = {
381
+ x: SensorEventHandler[];
382
+ y: SensorEventHandler[];
383
+ z: SensorEventHandler[];
384
+ };
385
+ /** Definition of the AudioBufferItem type */
386
+ export interface AudioBufferItem {
387
+ pathName: string;
388
+ audioBuffer: AudioBuffer;
389
+ }
390
+ /** Definition of the SoundfileItem type */
391
+ export interface SoundfileItem {
392
+ /** Name of the soundfile */
393
+ name: string;
394
+ /** URL of the soundfile */
395
+ url: string;
396
+ /** Index in the DSP struct */
397
+ index: number;
398
+ /** Base pointer in wasm memory */
399
+ basePtr: number;
400
+ }
401
+ /**
402
+ * WasmAllocator is a basic memory management class designed to allocate
403
+ * blocks of memory within a WebAssembly.Memory object. It provides a simple
404
+ * alloc method to allocate a contiguous block of memory of a specified size.
405
+ *
406
+ * The allocator operates by keeping a linear progression through the memory,
407
+ * always allocating the next block at the end of the last. This approach does not
408
+ * handle freeing of memory or reuse of memory spaces.
409
+ */
410
+ export declare class WasmAllocator {
411
+ private readonly memory;
412
+ private allocatedBytes;
413
+ constructor(memory: WebAssembly.Memory, offset: number);
414
+ /**
415
+ * Allocates a block of memory of the specified size, returning the pointer to the
416
+ * beginning of the block. The block is allocated at the current offset and the
417
+ * offset is incremented by the size of the block.
418
+ *
419
+ * @param sizeInBytes The size of the block to allocate in bytes.
420
+ * @returns The offset (pointer) to the beginning of the allocated block.
421
+ */
422
+ alloc(sizeInBytes: number): number;
423
+ /**
424
+ * Returns the underlying buffer object.
425
+ *
426
+ * @returns The buffer object.
427
+ */
428
+ getBuffer(): ArrayBuffer;
429
+ /**
430
+ * Returns the Int32 view of the underlying buffer object.
431
+ *
432
+ * @returns The view of the memory buffer as Int32Array.
433
+ */
434
+ getInt32Array(): Int32Array;
435
+ /**
436
+ * Returns the Int64 view of the underlying buffer object.
437
+ *
438
+ * @returns The view of the memory buffer as BigInt64Array.
439
+ */
440
+ getInt64Array(): BigInt64Array;
441
+ /**
442
+ * Returns the Float32 view of the underlying buffer object.
443
+ *
444
+ * @returns The view of the memory buffer as Float32Array.
445
+ */
446
+ getFloat32Array(): Float32Array;
447
+ /**
448
+ * Returns the Float64 view of the underlying buffer object..
449
+ *
450
+ * @returns The view of the memory buffer as Float64Array.
451
+ */
452
+ getFloat64Array(): Float64Array;
453
+ }
454
+ /**
455
+ * Soundfile class to handle soundfile data in wasm memory.
456
+ */
457
+ export declare class Soundfile {
458
+ /** Maximum number of soundfile parts. */
459
+ static get MAX_SOUNDFILE_PARTS(): number;
460
+ /** Maximum number of channels. */
461
+ static get MAX_CHAN(): number;
462
+ /** Maximum buffer size in frames. */
463
+ static get BUFFER_SIZE(): number;
464
+ /** Default sample rate. */
465
+ static get SAMPLE_RATE(): number;
466
+ /** Pointer to the soundfile structure in wasm memory */
467
+ private readonly fPtr;
468
+ private readonly fBuffers;
469
+ private readonly fLength;
470
+ private readonly fSR;
471
+ private readonly fOffset;
472
+ private readonly fSampleSize;
473
+ private readonly fPtrSize;
474
+ private readonly fIntSize;
475
+ private readonly fAllocator;
476
+ constructor(allocator: WasmAllocator, sampleSize: number, curChan: number, length: number, maxChan: number, totalParts: number);
477
+ private allocBuffers;
478
+ shareBuffers(curChan: number, maxChan: number): void;
479
+ copyToOut(part: number, maxChannels: number, offset: number, audioData: AudioData): void;
480
+ copyToOutReal32(maxChannels: number, offset: number, audioData: AudioData): void;
481
+ copyToOutReal64(maxChannels: number, offset: number, audioData: AudioData): void;
482
+ emptyFile(part: number, offset: number): number;
483
+ displayMemory(where?: string, mem?: boolean): void;
484
+ getPtr(): number;
485
+ getHEAP32(): Int32Array;
486
+ getHEAPFloat32(): Float32Array;
487
+ getHEAPFloat64(): Float64Array;
488
+ }
489
+ /**
490
+ * DSP implementation that mimic the C++ 'dsp' class:
491
+ * - adding MIDI control: metadata are decoded and incoming MIDI messages will control the associated controllers
492
+ * - an output handler can be set to treat produced output controllers (like 'bargraph')
493
+ * - regular controllers are handled using setParamValue/getParamValue and getParams methods
494
+ */
495
+ export interface IFaustBaseWebAudioDsp {
496
+ /**
497
+ * Set the parameter output handler, to be called in the 'compute' method with output parameters (like bargraph).
498
+ *
499
+ * @param handler - the output handler
500
+ */
501
+ setOutputParamHandler(handler: OutputParamHandler | null): void;
502
+ /**
503
+ * Get the parameter output handler.
504
+ *
505
+ * @return the current output handler
506
+ */
507
+ getOutputParamHandler(): OutputParamHandler | null;
508
+ /**
509
+ * Set the compute handler, to be called in the 'compute' method with buffer size.
510
+ *
511
+ * @param handler - the compute handler
512
+ */
513
+ setComputeHandler(handler: ComputeHandler | null): void;
514
+ /**
515
+ * Get the compute handler.
516
+ *
517
+ * @return the current output handler
518
+ */
519
+ getComputeHandler(): ComputeHandler | null;
520
+ /**
521
+ * Set the plot handler, to be called in the 'compute' method with various info (see PlotHandler type).
522
+ *
523
+ * @param handler - the plot handler
524
+ */
525
+ setPlotHandler(handler: PlotHandler | null): void;
526
+ /**
527
+ * Get the plot handler.
528
+ *
529
+ * @return the current plot handler
530
+ */
531
+ getPlotHandler(): PlotHandler | null;
532
+ /**
533
+ * Return instance number of audio inputs.
534
+ *
535
+ * @return the instance number of audio inputs
536
+ */
537
+ getNumInputs(): number;
538
+ /**
539
+ * Return instance number of audio outputs.
540
+ *
541
+ * @return the instance number of audio outputs
542
+ */
543
+ getNumOutputs(): number;
544
+ /**
545
+ * DSP instance computation, to be called with successive input/output audio buffers, using their size.
546
+ *
547
+ * @param inputs - the input audio buffers
548
+ * @param outputs - the output audio buffers
549
+ */
550
+ compute(inputs: Float32Array[], outputs: Float32Array[]): boolean;
551
+ /**
552
+ * Give a handler to be called on 'declare key value' kind of metadata.
553
+ *
554
+ * @param handler - the handler to be used
555
+ */
556
+ metadata(handler: MetadataHandler): void;
557
+ /**
558
+ * Handle untyped MIDI messages.
559
+ *
560
+ * @param data - and arry of MIDI bytes
561
+ */
562
+ midiMessage(data: number[] | Uint8Array): void;
563
+ /**
564
+ * Handle MIDI ctrlChange messages.
565
+ *
566
+ * @param channel - the MIDI channel (0..15, not used for now)
567
+ * @param ctrl - the MIDI controller number (0..127)
568
+ * @param value - the MIDI controller value (0..127)
569
+ */
570
+ ctrlChange(chan: number, ctrl: number, value: number): void;
571
+ /**
572
+ * Handle MIDI pitchWheel messages.
573
+ *
574
+ * @param channel - the MIDI channel (0..15, not used for now)
575
+ * @param value - the MIDI controller value (0..16383)
576
+ */
577
+ pitchWheel(chan: number, value: number): void;
578
+ /**
579
+ * Set parameter value.
580
+ *
581
+ * @param path - the path to the wanted parameter (retrieved using 'getParams' method)
582
+ * @param val - the float value for the wanted control
583
+ */
584
+ setParamValue(path: string, value: number): void;
585
+ /**
586
+ * Get parameter value.
587
+ *
588
+ * @param path - the path to the wanted parameter (retrieved using 'getParams' method)
589
+ *
590
+ * @return the float value
591
+ */
592
+ getParamValue(path: string): number;
593
+ /**
594
+ * Get the table of all input parameters paths.
595
+ *
596
+ * @return the table of all input parameters paths
597
+ */
598
+ getParams(): string[];
599
+ /**
600
+ * Get DSP JSON description with its UI and metadata as object.
601
+ *
602
+ * @return the DSP JSON description as object
603
+ */
604
+ getMeta(): FaustDspMeta;
605
+ /**
606
+ * Get DSP UI description.
607
+ *
608
+ * @return the DSP UI description
609
+ */
610
+ getUI(): FaustUIDescriptor;
611
+ /**
612
+ * Get DSP UI items description.
613
+ *
614
+ * @return the DSP UI items description
615
+ */
616
+ getDescriptors(): FaustUIInputItem[];
617
+ /**
618
+ * Get DSP JSON description with its UI and metadata.
619
+ *
620
+ * @return the DSP JSON description
621
+ */
622
+ getJSON(): string;
623
+ /**
624
+ * Start the DSP audio processing.
625
+ */
626
+ start(): void;
627
+ /**
628
+ * Stop the DSP audio processing.
629
+ */
630
+ stop(): void;
631
+ /**
632
+ * Destroy the DSP.
633
+ */
634
+ destroy(): void;
635
+ /** Indicating if the DSP handles the accelerometer */
636
+ readonly hasAccInput: boolean;
637
+ /** Accelerometer handling */
638
+ propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>, invert: boolean): void;
639
+ /** Indicating if the DSP handles the gyroscope */
640
+ readonly hasGyrInput: boolean;
641
+ /** Gyroscope handling */
642
+ propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
643
+ }
644
+ export interface IFaustMonoWebAudioDsp extends IFaustBaseWebAudioDsp {
645
+ }
646
+ export interface IFaustMonoWebAudioNode extends IFaustMonoWebAudioDsp, AudioNode {
647
+ }
648
+ export interface IFaustPolyWebAudioDsp extends IFaustBaseWebAudioDsp {
649
+ /**
650
+ * Handle MIDI keyOn messages.
651
+ *
652
+ * @param channel - the MIDI channel (0..15, not used for now)
653
+ * @param pitch - the MIDI pitch value (0..127)
654
+ * @param velocity - the MIDI velocity value (0..127)
655
+ */
656
+ keyOn(channel: number, pitch: number, velocity: number): void;
657
+ /**
658
+ * Handle MIDI keyOff messages.
659
+ *
660
+ * @param channel - the MIDI channel (0..15, not used for now)
661
+ * @param pitch - the MIDI pitch value (0..127)
662
+ * @param velocity - the MIDI velocity value (0..127)
663
+ */
664
+ keyOff(channel: number, pitch: number, velocity: number): void;
665
+ /**
666
+ * Stop all playing notes.
667
+ *
668
+ * @param hard - whether to immediately stop notes or put them in release mode
669
+ */
670
+ allNotesOff(hard: boolean): void;
671
+ }
672
+ export interface IFaustPolyWebAudioNode extends IFaustPolyWebAudioDsp, AudioNode {
673
+ }
674
+ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
675
+ protected fOutputHandler: OutputParamHandler | null;
676
+ protected fComputeHandler: ComputeHandler | null;
677
+ protected fPlotHandler: PlotHandler | null;
678
+ protected fCachedEvents: {
679
+ type: string;
680
+ data: any;
681
+ }[];
682
+ protected fBufferNum: number;
683
+ protected fInChannels: Float32Array[] | Float64Array[];
684
+ protected fOutChannels: Float32Array[] | Float64Array[];
685
+ protected fOutputsTimer: number;
686
+ protected fInputsItems: string[];
687
+ protected fOutputsItems: string[];
688
+ protected fDescriptor: FaustUIInputItem[];
689
+ protected fSoundfiles: SoundfileItem[];
690
+ protected fSoundfileBuffers: LooseFaustDspFactory["soundfiles"];
691
+ /** Keep the end of memory offset before soundfiles */
692
+ protected fEndMemory: number;
693
+ protected fAcc: SensorEventHandlers;
694
+ protected fGyr: SensorEventHandlers;
695
+ protected fAudioInputs: number;
696
+ protected fAudioOutputs: number;
697
+ protected fBufferSize: number;
698
+ protected fPtrSize: number;
699
+ protected fSampleSize: number;
700
+ protected fPitchwheelLabel: {
701
+ path: string;
702
+ chan: number;
703
+ min: number;
704
+ max: number;
705
+ }[];
706
+ protected fCtrlLabel: {
707
+ path: string;
708
+ chan: number;
709
+ min: number;
710
+ max: number;
711
+ }[][];
712
+ protected fPathTable: {
713
+ [address: string]: number;
714
+ };
715
+ protected fUICallback: UIHandler;
716
+ protected fProcessing: boolean;
717
+ protected fDestroyed: boolean;
718
+ protected fFirstCall: boolean;
719
+ protected fJSONDsp: FaustDspMeta;
720
+ constructor(sampleSize: number, bufferSize: number, soundfiles: LooseFaustDspFactory["soundfiles"]);
721
+ static remap(v: number, mn0: number, mx0: number, mn1: number, mx1: number): number;
722
+ static parseUI(ui: FaustUIDescriptor, callback: (item: FaustUIItem) => any): void;
723
+ static parseGroup(group: FaustUIGroup, callback: (item: FaustUIItem) => any): void;
724
+ static parseItems(items: FaustUIItem[], callback: (item: FaustUIItem) => any): void;
725
+ static parseItem(item: FaustUIItem, callback: (item: FaustUIItem) => any): void;
726
+ /** Split the soundfile names and return an array of names */
727
+ static splitSoundfileNames(input: string): string[];
728
+ get hasAccInput(): boolean;
729
+ propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>, invert?: boolean): void;
730
+ get hasGyrInput(): boolean;
731
+ propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
732
+ /** Build the accelerometer handler */
733
+ private setupAccHandler;
734
+ /** Build the gyroscope handler */
735
+ private setupGyrHandler;
736
+ static extractUrlsFromMeta(dspMeta: FaustDspMeta): string[];
737
+ /**
738
+ * Load a soundfile possibly containing several parts in the DSP struct.
739
+ * Soundfile pointers are located at 'index' offset, to be read in the JSON file.
740
+ * The DSP struct is located at baseDSP in the wasm memory,
741
+ * either a monophonic DSP, or a voice in a polyphonic context.
742
+ *
743
+ * @param allocator : the wasm memory allocator
744
+ * @param baseDSP : the base DSP in the wasm memory
745
+ * @param name : the name of the soundfile
746
+ * @param url : the url of the soundfile
747
+ */
748
+ private loadSoundfile;
749
+ createSoundfile(allocator: WasmAllocator, soundfileIdList: string[], soundfiles: LooseFaustDspFactory["soundfiles"], maxChan?: number): Soundfile;
750
+ /**
751
+ * Init soundfiles memory.
752
+ *
753
+ * @param allocator : the wasm memory allocator
754
+ * @param sfReader : the soundfile reader
755
+ * @param baseDSP : the DSP struct (either a monophonic DSP of polyphonic voice) base DSP in the wasm memory
756
+ */
757
+ protected initSoundfileMemory(allocator: WasmAllocator, baseDSP: number): void;
758
+ protected updateOutputs(): void;
759
+ metadata(handler: MetadataHandler): void;
760
+ compute(input: Float32Array[], output: Float32Array[]): boolean;
761
+ setOutputParamHandler(handler: OutputParamHandler | null): void;
762
+ getOutputParamHandler(): OutputParamHandler | null;
763
+ setComputeHandler(handler: ComputeHandler | null): void;
764
+ getComputeHandler(): ComputeHandler | null;
765
+ setPlotHandler(handler: PlotHandler | null): void;
766
+ getPlotHandler(): PlotHandler | null;
767
+ getNumInputs(): number;
768
+ getNumOutputs(): number;
769
+ midiMessage(data: number[] | Uint8Array): void;
770
+ ctrlChange(channel: number, ctrl: number, value: number): void;
771
+ pitchWheel(channel: number, wheel: number): void;
772
+ setParamValue(path: string, value: number): void;
773
+ getParamValue(path: string): number;
774
+ getParams(): string[];
775
+ getMeta(): FaustDspMeta;
776
+ getJSON(): string;
777
+ getUI(): FaustUIDescriptor;
778
+ getDescriptors(): FaustUIInputItem[];
779
+ hasSoundfiles(): boolean;
780
+ start(): void;
781
+ stop(): void;
782
+ destroy(): void;
783
+ }
784
+ export declare class FaustMonoWebAudioDsp extends FaustBaseWebAudioDsp implements IFaustMonoWebAudioDsp {
785
+ private fInstance;
786
+ private fDSP;
787
+ constructor(instance: FaustMonoDspInstance, sampleRate: number, sampleSize: number, bufferSize: number, soundfiles: LooseFaustDspFactory["soundfiles"]);
788
+ private initMemory;
789
+ toString(): string;
790
+ compute(input: Float32Array[] | ((input: Float32Array[] | Float64Array[]) => any), output: Float32Array[] | ((output: Float32Array[] | Float64Array[]) => any)): boolean;
791
+ metadata(handler: MetadataHandler): void;
792
+ getNumInputs(): number;
793
+ getNumOutputs(): number;
794
+ setParamValue(path: string, value: number): void;
795
+ getParamValue(path: string): number;
796
+ getMeta(): FaustDspMeta;
797
+ getJSON(): string;
798
+ getDescriptors(): FaustUIInputItem[];
799
+ getUI(): FaustUIDescriptor;
800
+ }
801
+ export declare class FaustWebAudioDspVoice {
802
+ static get kActiveVoice(): number;
803
+ static get kFreeVoice(): number;
804
+ static get kReleaseVoice(): number;
805
+ static get kLegatoVoice(): number;
806
+ static get kNoVoice(): number;
807
+ static get VOICE_STOP_LEVEL(): number;
808
+ private fFreqLabel;
809
+ private fGateLabel;
810
+ private fGainLabel;
811
+ private fKeyLabel;
812
+ private fVelLabel;
813
+ private fDSP;
814
+ private fAPI;
815
+ fCurNote: number;
816
+ fNextNote: number;
817
+ fNextVel: number;
818
+ fDate: number;
819
+ fLevel: number;
820
+ fRelease: number;
821
+ constructor($dsp: number, api: IFaustDspInstance, inputItems: string[], pathTable: {
822
+ [address: string]: number;
823
+ }, sampleRate: number);
824
+ static midiToFreq(note: number): number;
825
+ static normalizeVelocity(velocity: number): number;
826
+ private extractPaths;
827
+ keyOn(pitch: number, velocity: number, legato?: boolean): void;
828
+ keyOff(hard?: boolean): void;
829
+ computeLegato(bufferSize: number, $inputs: number, $outputZero: number, $outputsHalf: number): void;
830
+ compute(bufferSize: number, $inputs: number, $outputs: number): void;
831
+ setParamValue(index: number, value: number): void;
832
+ getParamValue(index: number): number;
833
+ }
834
+ export declare class FaustPolyWebAudioDsp extends FaustBaseWebAudioDsp implements IFaustPolyWebAudioDsp {
835
+ private fInstance;
836
+ private fEffect;
837
+ private fJSONEffect;
838
+ private fAudioMixing;
839
+ private fAudioMixingHalf;
840
+ private fVoiceTable;
841
+ constructor(instance: FaustPolyDspInstance, sampleRate: number, sampleSize: number, bufferSize: number, soundfiles: LooseFaustDspFactory["soundfiles"]);
842
+ private initMemory;
843
+ toString(): string;
844
+ private allocVoice;
845
+ private getPlayingVoice;
846
+ private getFreeVoice;
847
+ compute(input: Float32Array[], output: Float32Array[]): boolean;
848
+ getNumInputs(): number;
849
+ getNumOutputs(): number;
850
+ private static findPath;
851
+ setParamValue(path: string, value: number): void;
852
+ getParamValue(path: string): number;
853
+ getMeta(): FaustDspMeta;
854
+ getJSON(): string;
855
+ getUI(): FaustUIDescriptor;
856
+ getDescriptors(): FaustUIInputItem[];
857
+ midiMessage(data: number[] | Uint8Array): void;
858
+ ctrlChange(channel: number, ctrl: number, value: number): void;
859
+ keyOn(channel: number, pitch: number, velocity: number): void;
860
+ keyOff(channel: number, pitch: number, velocity: number): void;
861
+ allNotesOff(hard?: boolean): void;
862
+ }
863
+ /**
864
+ * Injected in the string to be compiled on AudioWorkletProcessor side
865
+ */
866
+ export interface FaustData {
867
+ processorName: string;
868
+ dspName: string;
869
+ dspMeta: FaustDspMeta;
870
+ poly: boolean;
871
+ effectMeta?: FaustDspMeta;
872
+ }
873
+ export interface FaustAudioWorkletProcessorDependencies<Poly extends boolean = false> {
874
+ FaustBaseWebAudioDsp: typeof FaustBaseWebAudioDsp;
875
+ FaustMonoWebAudioDsp: Poly extends true ? undefined : typeof FaustMonoWebAudioDsp;
876
+ FaustPolyWebAudioDsp: Poly extends true ? typeof FaustPolyWebAudioDsp : undefined;
877
+ FaustWebAudioDspVoice: Poly extends true ? typeof FaustWebAudioDspVoice : undefined;
878
+ FaustWasmInstantiator: typeof FaustWasmInstantiator;
879
+ }
880
+ export interface FaustAudioWorkletNodeOptions<Poly extends boolean = false> extends AudioWorkletNodeOptions {
881
+ processorOptions: Poly extends true ? FaustPolyAudioWorkletProcessorOptions : FaustMonoAudioWorkletProcessorOptions;
882
+ }
883
+ export interface FaustMonoAudioWorkletNodeOptions extends AudioWorkletNodeOptions {
884
+ processorOptions: FaustMonoAudioWorkletProcessorOptions;
885
+ }
886
+ export interface FaustPolyAudioWorkletNodeOptions extends AudioWorkletNodeOptions {
887
+ processorOptions: FaustPolyAudioWorkletProcessorOptions;
888
+ }
889
+ export interface FaustAudioWorkletProcessorOptions {
890
+ name: string;
891
+ sampleSize: number;
892
+ moduleId?: string;
893
+ instanceId?: string;
894
+ }
895
+ export interface FaustMonoAudioWorkletProcessorOptions extends FaustAudioWorkletProcessorOptions {
896
+ factory: LooseFaustDspFactory;
897
+ }
898
+ export interface FaustPolyAudioWorkletProcessorOptions extends FaustAudioWorkletProcessorOptions {
899
+ voiceFactory: LooseFaustDspFactory;
900
+ mixerModule: WebAssembly.Module;
901
+ voices: number;
902
+ effectFactory?: LooseFaustDspFactory;
903
+ }
904
+ export declare const getFaustAudioWorkletProcessor: <Poly extends boolean = false>(dependencies: FaustAudioWorkletProcessorDependencies<Poly>, faustData: FaustData, register?: boolean) => {
905
+ new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
906
+ prototype: AudioWorkletProcessor;
907
+ parameterDescriptors: AudioParamDescriptor[];
908
+ };
909
+ export interface FaustFFTOptionsData {
910
+ fftSize: number;
911
+ fftOverlap: number;
912
+ noIFFT: boolean;
913
+ /** Index number of the default window function, leave undefined or -1 for rectangular (no windowing) */
914
+ defaultWindowFunction: number;
915
+ }
916
+ /**
917
+ * Injected in the string to be compiled on AudioWorkletProcessor side
918
+ */
919
+ export interface FaustFFTData {
920
+ processorName: string;
921
+ dspName: string;
922
+ dspMeta: FaustDspMeta;
923
+ fftOptions?: Partial<FaustFFTOptionsData>;
924
+ }
925
+ export interface FaustFFTAudioWorkletProcessorDependencies {
926
+ FaustBaseWebAudioDsp: typeof FaustBaseWebAudioDsp;
927
+ FaustMonoWebAudioDsp: typeof FaustMonoWebAudioDsp;
928
+ FaustWasmInstantiator: typeof FaustWasmInstantiator;
929
+ FFTUtils: typeof FFTUtils;
930
+ }
931
+ export interface FaustFFTAudioWorkletNodeOptions extends AudioWorkletNodeOptions {
932
+ processorOptions: FaustFFTAudioWorkletProcessorOptions;
933
+ }
934
+ export interface FaustFFTAudioWorkletProcessorOptions {
935
+ name: string;
936
+ sampleSize: number;
937
+ factory: LooseFaustDspFactory;
938
+ moduleId?: string;
939
+ instanceId?: string;
940
+ }
941
+ export declare const getFaustFFTAudioWorkletProcessor: (dependencies: FaustFFTAudioWorkletProcessorDependencies, faustData: FaustFFTData, register?: boolean) => {
942
+ new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
943
+ prototype: AudioWorkletProcessor;
944
+ parameterDescriptors: AudioParamDescriptor[];
945
+ };
946
+ export interface ILibFaust extends LibFaustWasm {
947
+ module(): FaustModule;
948
+ fs(): typeof FS;
949
+ }
950
+ export declare class LibFaust implements ILibFaust {
951
+ private fModule;
952
+ private fCompiler;
953
+ private fFileSystem;
954
+ constructor(module: FaustModule);
955
+ module(): FaustModule;
956
+ fs(): typeof FS;
957
+ version(): string;
958
+ createDSPFactory(name: string, code: string, args: string, useInternalMemory: boolean): FaustDspWasm;
959
+ deleteDSPFactory(cFactory: number): void;
960
+ expandDSP(name: string, code: string, args: string): string;
961
+ generateAuxFiles(name: string, code: string, args: string): boolean;
962
+ deleteAllDSPFactories(): void;
963
+ getErrorAfterException(): string;
964
+ cleanupAfterException(): void;
965
+ getInfos(what: FaustInfoType): string;
966
+ toString(): string;
967
+ }
968
+ export declare const ab2str: (buf: Uint8Array) => any;
969
+ export declare const str2ab: (str: string) => Uint8Array;
970
+ export interface IFaustCompiler {
971
+ /**
972
+ * Gives the Faust compiler version.
973
+ * @return a version string
974
+ */
975
+ version(): string;
976
+ /**
977
+ * Gives the last compilation error.
978
+ * @return an error string
979
+ */
980
+ getErrorMessage(): string;
981
+ /**
982
+ * Create a wasm factory from Faust code i.e. wasm compiled code, to be used to create monophonic instances.
983
+ * This function is running asynchronously.
984
+ *
985
+ * @param name - an arbitrary name for the Faust factory
986
+ * @param code - Faust dsp code
987
+ * @param args - the compiler options
988
+ * @returns returns the wasm factory
989
+ */
990
+ createMonoDSPFactory(name: string, code: string, args: string): Promise<FaustDspFactory | null>;
991
+ /**
992
+ * Create a wasm factory from Faust code i.e. wasm compiled code, to be used to create polyphonic instances.
993
+ * This function is running asynchronously.
994
+ *
995
+ * @param name - an arbitrary name for the Faust factory
996
+ * @param code - Faust dsp code
997
+ * @param args - the compiler options
998
+ * @returns returns the wasm factory
999
+ */
1000
+ createPolyDSPFactory(name: string, code: string, args: string): Promise<FaustDspFactory | null>;
1001
+ /**
1002
+ * Delete a dsp factory.
1003
+ *
1004
+ * @param factory - the factory to be deleted
1005
+ */
1006
+ deleteDSPFactory(factory: FaustDspFactory): void;
1007
+ /**
1008
+ * Expand Faust code i.e. linearize included libraries.
1009
+ *
1010
+ * @param code - Faust dsp code
1011
+ * @param args - the compiler options
1012
+ * @returns returns the expanded dsp code
1013
+ */
1014
+ expandDSP(code: string, args: string): string | null;
1015
+ /**
1016
+ * Generates auxiliary files from Faust code. The output depends on the compiler options.
1017
+ *
1018
+ * @param name - an arbitrary name for the Faust module
1019
+ * @param code - Faust dsp code
1020
+ * @param args - the compiler options
1021
+ * @returns whether the generation actually succeded
1022
+ */
1023
+ generateAuxFiles(name: string, code: string, args: string): boolean;
1024
+ /**
1025
+ * Delete all factories.
1026
+ */
1027
+ deleteAllDSPFactories(): void;
1028
+ fs(): typeof FS;
1029
+ getAsyncInternalMixerModule(isDouble?: boolean): Promise<{
1030
+ mixerBuffer: Uint8Array;
1031
+ mixerModule: WebAssembly.Module;
1032
+ }>;
1033
+ getSyncInternalMixerModule(isDouble?: boolean): {
1034
+ mixerBuffer: Uint8Array;
1035
+ mixerModule: WebAssembly.Module;
1036
+ };
1037
+ }
1038
+ export declare class FaustCompiler implements IFaustCompiler {
1039
+ private fLibFaust;
1040
+ private fErrorMessage;
1041
+ private static gFactories;
1042
+ private mixer32Buffer;
1043
+ private mixer64Buffer;
1044
+ private mixer32Module;
1045
+ private mixer64Module;
1046
+ /**
1047
+ * Get a stringified DSP factories table
1048
+ */
1049
+ static serializeDSPFactories(): Record<string, {
1050
+ code: string;
1051
+ json: any;
1052
+ poly: boolean;
1053
+ }>;
1054
+ /**
1055
+ * Get a stringified DSP factories table as string
1056
+ */
1057
+ static stringifyDSPFactories(): string;
1058
+ /**
1059
+ * Import a DSP factories table
1060
+ */
1061
+ static deserializeDSPFactories(table: Record<string, {
1062
+ code: string;
1063
+ json: any;
1064
+ poly: boolean;
1065
+ }>): Promise<Map<string, FaustDspFactory>[]>;
1066
+ /**
1067
+ * Import a stringified DSP factories table
1068
+ */
1069
+ static importDSPFactories(tableStr: string): Promise<Map<string, FaustDspFactory>[]>;
1070
+ constructor(libFaust: ILibFaust);
1071
+ private intVec2intArray;
1072
+ private createDSPFactory;
1073
+ version(): string;
1074
+ getErrorMessage(): string;
1075
+ createMonoDSPFactory(name: string, code: string, args: string): Promise<FaustDspFactory | null>;
1076
+ createPolyDSPFactory(name: string, code: string, args: string): Promise<FaustDspFactory | null>;
1077
+ deleteDSPFactory(factory: FaustDspFactory): void;
1078
+ expandDSP(code: string, args: string): string;
1079
+ generateAuxFiles(name: string, code: string, args: string): boolean;
1080
+ deleteAllDSPFactories(): void;
1081
+ fs(): typeof FS;
1082
+ getAsyncInternalMixerModule(isDouble?: boolean): Promise<{
1083
+ mixerBuffer: Uint8Array;
1084
+ mixerModule: WebAssembly.Module;
1085
+ }>;
1086
+ getSyncInternalMixerModule(isDouble?: boolean): {
1087
+ mixerBuffer: Uint8Array;
1088
+ mixerModule: WebAssembly.Module;
1089
+ };
1090
+ }
1091
+ /**
1092
+ * For offline rendering.
1093
+ */
1094
+ export interface IFaustOfflineProcessor extends IFaustBaseWebAudioDsp {
1095
+ render(inputs?: Float32Array[], length?: number, onUpdate?: (sample: number) => any): Float32Array[];
1096
+ }
1097
+ export interface IFaustMonoOfflineProcessor extends IFaustOfflineProcessor, IFaustMonoWebAudioDsp {
1098
+ }
1099
+ export interface IFaustPolyOfflineProcessor extends IFaustOfflineProcessor, IFaustPolyWebAudioDsp {
1100
+ }
1101
+ export declare class FaustOfflineProcessor<Poly extends boolean = false> {
1102
+ protected fDSPCode: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp;
1103
+ protected fBufferSize: number;
1104
+ protected fInputs: Float32Array[];
1105
+ protected fOutputs: Float32Array[];
1106
+ constructor(instance: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp, bufferSize: number);
1107
+ getParameterDescriptors(): AudioParamDescriptor[];
1108
+ compute(input: Float32Array[], output: Float32Array[]): boolean;
1109
+ setOutputParamHandler(handler: OutputParamHandler): void;
1110
+ getOutputParamHandler(): OutputParamHandler | null;
1111
+ setComputeHandler(handler: ComputeHandler): void;
1112
+ getComputeHandler(): ComputeHandler | null;
1113
+ setPlotHandler(handler: PlotHandler): void;
1114
+ getPlotHandler(): PlotHandler | null;
1115
+ getNumInputs(): number;
1116
+ getNumOutputs(): number;
1117
+ metadata(handler: MetadataHandler): void;
1118
+ midiMessage(data: number[] | Uint8Array): void;
1119
+ ctrlChange(chan: number, ctrl: number, value: number): void;
1120
+ pitchWheel(chan: number, value: number): void;
1121
+ setParamValue(path: string, value: number): void;
1122
+ getParamValue(path: string): number;
1123
+ getParams(): string[];
1124
+ getMeta(): FaustDspMeta;
1125
+ getJSON(): string;
1126
+ getDescriptors(): FaustUIInputItem[];
1127
+ getUI(): FaustUIDescriptor;
1128
+ start(): void;
1129
+ stop(): void;
1130
+ destroy(): void;
1131
+ get hasAccInput(): boolean;
1132
+ propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>, invert?: boolean): void;
1133
+ get hasGyrInput(): boolean;
1134
+ propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
1135
+ /**
1136
+ * Render frames in an array.
1137
+ *
1138
+ * @param inputs - input signal
1139
+ * @param length - the number of frames to render (default: bufferSize)
1140
+ * @param onUpdate - a callback after each buffer calculated, with an argument "current sample"
1141
+ * @return an array of Float32Array with the rendered frames
1142
+ */
1143
+ render(inputs?: Float32Array[], length?: number, onUpdate?: (sample: number) => any): Float32Array[];
1144
+ }
1145
+ export declare class FaustMonoOfflineProcessor extends FaustOfflineProcessor<false> implements IFaustMonoWebAudioDsp {
1146
+ }
1147
+ export declare class FaustPolyOfflineProcessor extends FaustOfflineProcessor<true> implements IFaustPolyWebAudioDsp {
1148
+ keyOn(channel: number, pitch: number, velocity: number): void;
1149
+ keyOff(channel: number, pitch: number, velocity: number): void;
1150
+ allNotesOff(hard: boolean): void;
1151
+ }
1152
+ export interface IFaustSvgDiagrams {
1153
+ /**
1154
+ * Generates auxiliary files from Faust code. The output depends on the compiler options.
1155
+ *
1156
+ * @param name - the DSP's name
1157
+ * @param code - Faust code
1158
+ * @param args - compilation args
1159
+ * @returns the svg diagrams as a filename - svg string map
1160
+ */
1161
+ from(name: string, code: string, args: string): Record<string, string>;
1162
+ }
1163
+ export declare class FaustSvgDiagrams implements IFaustSvgDiagrams {
1164
+ private compiler;
1165
+ constructor(compiler: FaustCompiler);
1166
+ from(name: string, code: string, args: string): Record<string, string>;
1167
+ }
1168
+ export interface IFaustCmajor {
1169
+ /**
1170
+ * Generates auxiliary files from Faust code. The output depends on the compiler options.
1171
+ *
1172
+ * @param name - the DSP's name
1173
+ * @param code - Faust code
1174
+ * @param args - compilation args
1175
+ * @returns the Cmajor compiled string
1176
+ */
1177
+ compile(name: string, code: string, args: string): string;
1178
+ }
1179
+ export declare class FaustCmajor implements IFaustCmajor {
1180
+ private fCompiler;
1181
+ constructor(compiler: FaustCompiler);
1182
+ compile(name: string, code: string, args: string): string;
1183
+ }
1184
+ export interface WavEncoderOptions {
1185
+ bitDepth: number;
1186
+ float?: boolean;
1187
+ symmetric?: boolean;
1188
+ shared?: boolean;
1189
+ sampleRate: number;
1190
+ }
1191
+ /**
1192
+ * Code from https://github.com/mohayonao/wav-encoder
1193
+ */
1194
+ export declare class WavEncoder {
1195
+ static encode(audioBuffer: Float32Array[], options: WavEncoderOptions): ArrayBuffer;
1196
+ private static writeHeader;
1197
+ private static writeData;
1198
+ }
1199
+ export interface WavDecoderOptions {
1200
+ symmetric?: boolean;
1201
+ shared?: boolean;
1202
+ }
1203
+ /**
1204
+ * Code from https://github.com/mohayonao/wav-decoder
1205
+ */
1206
+ export declare class WavDecoder {
1207
+ static decode(buffer: ArrayBuffer, options?: WavDecoderOptions): {
1208
+ numberOfChannels: number;
1209
+ length: number;
1210
+ sampleRate: number;
1211
+ channelData: Float32Array[];
1212
+ };
1213
+ private static decodeFormat;
1214
+ private static decodeData;
1215
+ private static readPCM;
1216
+ }
1217
+ /** Read metadata and fetch soundfiles */
1218
+ export declare class SoundfileReader {
1219
+ static get fallbackPaths(): string[];
1220
+ /**
1221
+ * Extract the parent URL from an URL.
1222
+ * @param url : the URL
1223
+ * @returns : the parent URL
1224
+ */
1225
+ private static getParentUrl;
1226
+ /**
1227
+ * Convert an audio buffer to audio data.
1228
+ *
1229
+ * @param audioBuffer : the audio buffer to convert
1230
+ * @returns : the audio data
1231
+ */
1232
+ private static toAudioData;
1233
+ /**
1234
+ * Extract the URLs from the metadata.
1235
+ *
1236
+ * @param dspMeta : the metadata
1237
+ * @returns : the URLs
1238
+ */
1239
+ static findSoundfilesFromMeta(dspMeta: FaustDspMeta): LooseFaustDspFactory["soundfiles"];
1240
+ /**
1241
+ * Check if the file exists.
1242
+ *
1243
+ * @param url : the url of the file to check
1244
+ * @returns : true if the file exists, otherwise false
1245
+ */
1246
+ private static checkFileExists;
1247
+ /**
1248
+ * Fetch the soundfile.
1249
+ *
1250
+ * @param url : the url of the soundfile
1251
+ * @param audioCtx : the audio context
1252
+ * @returns : the audio data
1253
+ */
1254
+ private static fetchSoundfile;
1255
+ /**
1256
+ * Load the soundfile.
1257
+ *
1258
+ * @param filename : the filename
1259
+ * @param metaUrls : the metadata URLs
1260
+ * @param soundfiles : the soundfiles
1261
+ * @param audioCtx : the audio context
1262
+ */
1263
+ private static loadSoundfile;
1264
+ /**
1265
+ * Load the soundfiles, public API.
1266
+ *
1267
+ * @param dspMeta : the metadata
1268
+ * @param soundfilesIn : the soundfiles
1269
+ * @param audioCtx : the audio context
1270
+ * @returns : the soundfiles
1271
+ */
1272
+ static loadSoundfiles(dspMeta: FaustDspMeta, soundfilesIn: LooseFaustDspFactory["soundfiles"], audioCtx: BaseAudioContext): Promise<LooseFaustDspFactory["soundfiles"]>;
1273
+ }
1274
+ declare const FaustAudioWorkletNode_base: {
1275
+ new (context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode;
1276
+ prototype: AudioWorkletNode;
1277
+ };
1278
+ /**
1279
+ * Base class for Monophonic and Polyphonic AudioWorkletNode
1280
+ */
1281
+ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends FaustAudioWorkletNode_base {
1282
+ #private;
1283
+ protected fJSONDsp: FaustDspMeta;
1284
+ protected fJSON: string;
1285
+ protected fInputsItems: string[];
1286
+ protected fOutputHandler: OutputParamHandler | null;
1287
+ protected fComputeHandler: ComputeHandler | null;
1288
+ protected fPlotHandler: PlotHandler | null;
1289
+ protected fUICallback: UIHandler;
1290
+ protected fDescriptor: FaustUIInputItem[];
1291
+ constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options?: Partial<FaustAudioWorkletNodeOptions<Poly>>);
1292
+ private handleDeviceMotion;
1293
+ private handleDeviceOrientation;
1294
+ /** Setup accelerometer and gyroscope handlers */
1295
+ startSensors(): Promise<void>;
1296
+ stopSensors(): void;
1297
+ setOutputParamHandler(handler: OutputParamHandler | null): void;
1298
+ getOutputParamHandler(): OutputParamHandler | null;
1299
+ setComputeHandler(handler: ComputeHandler | null): void;
1300
+ getComputeHandler(): ComputeHandler | null;
1301
+ setPlotHandler(handler: PlotHandler | null): void;
1302
+ getPlotHandler(): PlotHandler | null;
1303
+ setupWamEventHandler(): void;
1304
+ getNumInputs(): number;
1305
+ getNumOutputs(): number;
1306
+ compute(inputs: Float32Array[], outputs: Float32Array[]): boolean;
1307
+ metadata(handler: MetadataHandler): void;
1308
+ midiMessage(data: number[] | Uint8Array): void;
1309
+ ctrlChange(channel: number, ctrl: number, value: number): void;
1310
+ pitchWheel(channel: number, wheel: number): void;
1311
+ get hasAccInput(): boolean;
1312
+ propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>, invert?: boolean): void;
1313
+ get hasGyrInput(): boolean;
1314
+ propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
1315
+ setParamValue(path: string, value: number): void;
1316
+ getParamValue(path: string): number;
1317
+ getParams(): string[];
1318
+ getMeta(): FaustDspMeta;
1319
+ getJSON(): string;
1320
+ getUI(): FaustUIDescriptor;
1321
+ getDescriptors(): FaustUIInputItem[];
1322
+ start(): void;
1323
+ stop(): void;
1324
+ destroy(): void;
1325
+ }
1326
+ /**
1327
+ * Monophonic AudioWorkletNode
1328
+ */
1329
+ export declare class FaustMonoAudioWorkletNode extends FaustAudioWorkletNode<false> implements IFaustMonoWebAudioDsp {
1330
+ onprocessorerror: (e: Event) => never;
1331
+ constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<false>> & Pick<FaustAudioWorkletNodeOptions<false>, "processorOptions">);
1332
+ }
1333
+ /**
1334
+ * Polyphonic AudioWorkletNode
1335
+ */
1336
+ export declare class FaustPolyAudioWorkletNode extends FaustAudioWorkletNode<true> implements IFaustPolyWebAudioDsp {
1337
+ private fJSONEffect;
1338
+ onprocessorerror: (e: Event) => never;
1339
+ constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<true>> & Pick<FaustAudioWorkletNodeOptions<true>, "processorOptions">);
1340
+ keyOn(channel: number, pitch: number, velocity: number): void;
1341
+ keyOff(channel: number, pitch: number, velocity: number): void;
1342
+ allNotesOff(hard: boolean): void;
1343
+ getMeta(): FaustDspMeta;
1344
+ getJSON(): string;
1345
+ getUI(): FaustUIDescriptor;
1346
+ }
1347
+ declare const FaustScriptProcessorNode_base: {
1348
+ new (): ScriptProcessorNode;
1349
+ prototype: ScriptProcessorNode;
1350
+ };
1351
+ /**
1352
+ * Base class for Monophonic and Polyphonic ScriptProcessorNode
1353
+ */
1354
+ export declare class FaustScriptProcessorNode<Poly extends boolean = false> extends FaustScriptProcessorNode_base {
1355
+ protected fDSPCode: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp;
1356
+ protected fInputs: Float32Array[];
1357
+ protected fOutputs: Float32Array[];
1358
+ protected handleDeviceMotion: any;
1359
+ protected handleDeviceOrientation: any;
1360
+ init(instance: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp): void;
1361
+ /** Setup accelerometer and gyroscope handlers */
1362
+ startSensors(): Promise<void>;
1363
+ stopSensors(): void;
1364
+ compute(input: Float32Array[], output: Float32Array[]): boolean;
1365
+ setOutputParamHandler(handler: OutputParamHandler): void;
1366
+ getOutputParamHandler(): OutputParamHandler | null;
1367
+ setComputeHandler(handler: ComputeHandler): void;
1368
+ getComputeHandler(): ComputeHandler | null;
1369
+ setPlotHandler(handler: PlotHandler): void;
1370
+ getPlotHandler(): PlotHandler | null;
1371
+ getNumInputs(): number;
1372
+ getNumOutputs(): number;
1373
+ metadata(handler: MetadataHandler): void;
1374
+ midiMessage(data: number[] | Uint8Array): void;
1375
+ ctrlChange(chan: number, ctrl: number, value: number): void;
1376
+ pitchWheel(chan: number, value: number): void;
1377
+ setParamValue(path: string, value: number): void;
1378
+ getParamValue(path: string): number;
1379
+ getParams(): string[];
1380
+ getMeta(): FaustDspMeta;
1381
+ getJSON(): string;
1382
+ getDescriptors(): FaustUIInputItem[];
1383
+ getUI(): FaustUIDescriptor;
1384
+ start(): void;
1385
+ stop(): void;
1386
+ destroy(): void;
1387
+ get hasAccInput(): boolean;
1388
+ propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>, invert?: boolean): void;
1389
+ get hasGyrInput(): boolean;
1390
+ propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
1391
+ }
1392
+ export declare class FaustMonoScriptProcessorNode extends FaustScriptProcessorNode<false> implements IFaustMonoWebAudioDsp {
1393
+ }
1394
+ export declare class FaustPolyScriptProcessorNode extends FaustScriptProcessorNode<true> implements IFaustPolyWebAudioDsp {
1395
+ keyOn(channel: number, pitch: number, velocity: number): void;
1396
+ keyOff(channel: number, pitch: number, velocity: number): void;
1397
+ allNotesOff(hard: boolean): void;
1398
+ }
1399
+ export interface GeneratorSupportingSoundfiles {
1400
+ /**
1401
+ * Attach a map of id - audio data, call after `compile()` before `createNode()`
1402
+ *
1403
+ * @param soundfileMap a map of id - `AudioData` as an object where `AudioData` contains channel data as `audioBuffer: Float32Array[]` and `sampleRate: number`
1404
+ */
1405
+ addSoundfiles(soundfileMap: Record<string, AudioData>): void;
1406
+ /**
1407
+ * Get a list of soundfiles needed, call after `compile()`
1408
+ */
1409
+ getSoundfileList(): string[];
1410
+ }
1411
+ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
1412
+ /**
1413
+ * Compile a monophonic DSP factory from given code.
1414
+ *
1415
+ * @param compiler - the Faust compiler
1416
+ * @param name - the DSP name
1417
+ * @param code - the DSP code
1418
+ * @param args - the compilation parameters
1419
+ * @returns the compiled factory or 'null' if failure
1420
+ */
1421
+ compile(compiler: IFaustCompiler, name: string, code: string, args: string): Promise<{
1422
+ factory: FaustDspFactory | null;
1423
+ name?: string;
1424
+ meta?: FaustDspMeta;
1425
+ } | null>;
1426
+ /**
1427
+ * Create a monophonic WebAudio node (either ScriptProcessorNode or AudioWorkletNode).
1428
+ *
1429
+ * @param context - the WebAudio context
1430
+ * @param name - DSP name, can be used for processorName
1431
+ * @param factory - default is the compiled factory
1432
+ * @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
1433
+ * @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
1434
+ * @param processorName - AudioWorklet Processor name
1435
+ * @param processorOptions - Additional AudioWorklet Processor options
1436
+ * @returns the compiled WebAudio node or 'null' if failure
1437
+ */
1438
+ createNode(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: boolean, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<IFaustMonoWebAudioNode | null>;
1439
+ /**
1440
+ * Create a monophonic WebAudio node (either ScriptProcessorNode or AudioWorkletNode).
1441
+ *
1442
+ * @param context - the WebAudio context
1443
+ * @param fftUtils - should be an anonymous class with static methods, without any import from outside
1444
+ * @param name - DSP name, can be used for processorName
1445
+ * @param factory - default is the compiled factory
1446
+ * @param fftOptions - initial FFT options
1447
+ * @param processorName - AudioWorklet Processor name
1448
+ * @param processorOptions - Additional AudioWorklet Processor options
1449
+ * @returns the compiled WebAudio node or 'null' if failure
1450
+ */
1451
+ createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
1452
+ /**
1453
+ * Create a monophonic Offline processor.
1454
+ *
1455
+ * @param sampleRate - the sample rate in Hz
1456
+ * @param bufferSize - the buffer size in frames
1457
+ * @param factory - default is the compiled factory
1458
+ * @param context - if this exists, will be used to fetch soundfiles online
1459
+ * @returns the compiled processor or 'null' if failure
1460
+ */
1461
+ createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory, context?: BaseAudioContext): Promise<IFaustMonoOfflineProcessor | null>;
1462
+ /**
1463
+ * Get DSP JSON description with its UI and metadata as object.
1464
+ *
1465
+ * @return the DSP JSON description as object
1466
+ */
1467
+ getMeta(): FaustDspMeta;
1468
+ /**
1469
+ * Get DSP JSON description with its UI and metadata.
1470
+ *
1471
+ * @return the DSP JSON description
1472
+ */
1473
+ getJSON(): string;
1474
+ /**
1475
+ * Get DSP UI description.
1476
+ *
1477
+ * @return the DSP UI description
1478
+ */
1479
+ getUI(): FaustUIDescriptor;
1480
+ }
1481
+ export interface IFaustPolyDspGenerator extends GeneratorSupportingSoundfiles {
1482
+ /**
1483
+ * Compile a monophonic DSP factory from given code.
1484
+ *
1485
+ * @param compiler - the Faust compiler
1486
+ * @param name - the DSP name
1487
+ * @param dspCode - the DSP code ('dspCode' can possibly contain an integrated effect)
1488
+ * @param args - the compilation parameters
1489
+ * @param effectCode - optional effect DSP code
1490
+ * @returns the compiled factory or 'null' if failure
1491
+ */
1492
+ compile(compiler: IFaustCompiler, name: string, dspCode: string, args: string, effectCode?: string): Promise<{
1493
+ voiceFactory: FaustDspFactory | null;
1494
+ effectFactory?: FaustDspFactory | null;
1495
+ } | null>;
1496
+ /**
1497
+ * Create a polyphonic WebAudio node (either ScriptProcessorNode or AudioWorkletNode).
1498
+ *
1499
+ * @param context the WebAudio context
1500
+ * @param voices - the number of voices
1501
+ * @param name - AudioWorklet Processor name
1502
+ * @param voiceFactory - the Faust factory for voices, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
1503
+ * @param mixerModule - the wasm Mixer module (loaded from 'mixer32.wasm' or 'mixer64.wasm' files located in the 'faustwasm' package)
1504
+ * @param effectFactory - the Faust factory for the effect, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
1505
+ * @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
1506
+ * @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
1507
+ * @param processorOptions - Additional AudioWorklet Processor options
1508
+ * @returns the compiled WebAudio node or 'null' if failure
1509
+ */
1510
+ createNode(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: boolean, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<IFaustPolyWebAudioNode | null>;
1511
+ /**
1512
+ * Create a monophonic Offline processor.
1513
+ *
1514
+ * @param sampleRate - the sample rate in Hz
1515
+ * @param bufferSize - the buffer size in frames
1516
+ * @param voiceFactory - the Faust factory for voices, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
1517
+ * @param mixerModule - the wasm Mixer module (loaded from 'mixer32.wasm' or 'mixer64.wasm' files)
1518
+ * @param effectFactory - the Faust factory for the effect, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
1519
+ * @param context - if this exists, will be used to fetch soundfiles online
1520
+ * @returns the compiled processor or 'null' if failure
1521
+ */
1522
+ createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, context?: BaseAudioContext): Promise<IFaustPolyOfflineProcessor | null>;
1523
+ /**
1524
+ * Get DSP JSON description with its UI and metadata as object.
1525
+ *
1526
+ * @return the DSP JSON description as object
1527
+ */
1528
+ getMeta(): FaustDspMeta;
1529
+ /**
1530
+ * Get DSP JSON description with its UI and metadata.
1531
+ *
1532
+ * @return the DSP JSON description
1533
+ */
1534
+ getJSON(): string;
1535
+ /**
1536
+ * Get DSP UI description.
1537
+ *
1538
+ * @return the DSP UI description
1539
+ */
1540
+ getUI(): FaustUIDescriptor;
1541
+ }
1542
+ export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
1543
+ private static gWorkletProcessors;
1544
+ name: string;
1545
+ factory: FaustDspFactory | null;
1546
+ constructor();
1547
+ compile(compiler: IFaustCompiler, name: string, code: string, args: string): Promise<this | null>;
1548
+ addSoundfiles(soundfileMap: Record<string, AudioData>): void;
1549
+ getSoundfileList(): string[];
1550
+ createNode<SP extends boolean = false>(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: SP, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<SP extends true ? FaustMonoScriptProcessorNode | null : FaustMonoAudioWorkletNode | null>;
1551
+ createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
1552
+ createAudioWorkletProcessor(name?: string, factory?: LooseFaustDspFactory, processorName?: string): Promise<{
1553
+ new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
1554
+ prototype: AudioWorkletProcessor;
1555
+ parameterDescriptors: AudioParamDescriptor[];
1556
+ }>;
1557
+ createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory, context?: BaseAudioContext): Promise<FaustMonoOfflineProcessor>;
1558
+ getMeta(): any;
1559
+ getJSON(): string;
1560
+ getUI(): any;
1561
+ }
1562
+ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
1563
+ private static gWorkletProcessors;
1564
+ name: string;
1565
+ voiceFactory: FaustDspFactory | null;
1566
+ effectFactory: FaustDspFactory | null;
1567
+ mixerBuffer: Uint8Array;
1568
+ mixerModule: WebAssembly.Module;
1569
+ constructor();
1570
+ compile(compiler: IFaustCompiler, name: string, dspCodeAux: string, args: string, effectCodeAux?: string): Promise<this | null>;
1571
+ addSoundfiles(soundfileMap: Record<string, AudioData>): void;
1572
+ getSoundfileList(): string[];
1573
+ createNode<SP extends boolean = false>(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: SP, bufferSize?: number, processorName?: string, processorOptions?: {}): Promise<SP extends true ? FaustPolyScriptProcessorNode | null : FaustPolyAudioWorkletNode | null>;
1574
+ createAudioWorkletProcessor(name?: string, voiceFactory?: LooseFaustDspFactory, effectFactory?: LooseFaustDspFactory | null, processorName?: string): Promise<{
1575
+ new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
1576
+ prototype: AudioWorkletProcessor;
1577
+ parameterDescriptors: AudioParamDescriptor[];
1578
+ }>;
1579
+ createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, context?: BaseAudioContext): Promise<FaustPolyOfflineProcessor>;
1580
+ getMeta(): FaustDspMeta;
1581
+ getJSON(): string;
1582
+ getUI(): FaustUIDescriptor;
1583
+ }
1584
+
1585
+ export {};