@grame/faustwasm 0.4.4 → 0.4.6

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.
Files changed (38) hide show
  1. package/COPYING.txt +520 -0
  2. package/README.md +3 -0
  3. package/assets/standalone/faust-ui/index.css +8 -0
  4. package/assets/standalone/faust-ui/index.css.map +1 -1
  5. package/assets/standalone/faust-ui/index.js +56 -30
  6. package/assets/standalone/faust-ui/index.js.map +1 -1
  7. package/assets/standalone/faustwasm/index.d.ts +18 -10
  8. package/assets/standalone/faustwasm/index.js +69 -24
  9. package/assets/standalone/faustwasm/index.js.map +2 -2
  10. package/dist/cjs/index.d.ts +18 -10
  11. package/dist/cjs/index.js +69 -24
  12. package/dist/cjs/index.js.map +2 -2
  13. package/dist/cjs-bundle/index.d.ts +18 -10
  14. package/dist/cjs-bundle/index.js +72 -27
  15. package/dist/cjs-bundle/index.js.map +2 -2
  16. package/dist/esm/index.d.ts +18 -10
  17. package/dist/esm/index.js +69 -24
  18. package/dist/esm/index.js.map +2 -2
  19. package/dist/esm-bundle/index.d.ts +18 -10
  20. package/dist/esm-bundle/index.js +72 -27
  21. package/dist/esm-bundle/index.js.map +2 -2
  22. package/libfaust-wasm/libfaust-wasm.data +0 -0
  23. package/libfaust-wasm/libfaust-wasm.js +1 -1
  24. package/libfaust-wasm/libfaust-wasm.wasm +0 -0
  25. package/node +0 -0
  26. package/package.json +4 -2
  27. package/src/FaustAudioWorkletNode.ts +13 -24
  28. package/src/FaustAudioWorkletProcessor.ts +28 -1
  29. package/src/FaustDspGenerator.ts +18 -9
  30. package/src/FaustFFTAudioWorkletProcessor.ts +27 -0
  31. package/src/instantiateFaustModule.js +82 -0
  32. package/test/faustlive-wasm/faust-ui/index.css +8 -0
  33. package/test/faustlive-wasm/faust-ui/index.css.map +1 -1
  34. package/test/faustlive-wasm/faust-ui/index.js +56 -30
  35. package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
  36. package/test/faustlive-wasm/faustwasm/index.d.ts +18 -10
  37. package/test/faustlive-wasm/faustwasm/index.js +69 -24
  38. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
@@ -894,6 +894,8 @@ export interface FaustPolyAudioWorkletNodeOptions extends AudioWorkletNodeOption
894
894
  export interface FaustAudioWorkletProcessorOptions {
895
895
  name: string;
896
896
  sampleSize: number;
897
+ moduleId?: string;
898
+ instanceId?: string;
897
899
  }
898
900
  export interface FaustMonoAudioWorkletProcessorOptions extends FaustAudioWorkletProcessorOptions {
899
901
  factory: LooseFaustDspFactory;
@@ -938,6 +940,8 @@ export interface FaustFFTAudioWorkletProcessorOptions {
938
940
  name: string;
939
941
  sampleSize: number;
940
942
  factory: LooseFaustDspFactory;
943
+ moduleId?: string;
944
+ instanceId?: string;
941
945
  }
942
946
  export declare const getFaustFFTAudioWorkletProcessor: (dependencies: FaustFFTAudioWorkletProcessorDependencies, faustData: FaustFFTData, register?: boolean) => {
943
947
  new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
@@ -1273,7 +1277,7 @@ export declare class SoundfileReader {
1273
1277
  static loadSoundfiles(dspMeta: FaustDspMeta, soundfilesIn: LooseFaustDspFactory["soundfiles"], audioCtx: BaseAudioContext): Promise<LooseFaustDspFactory["soundfiles"]>;
1274
1278
  }
1275
1279
  declare const FaustAudioWorkletNode_base: {
1276
- new (context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions | undefined): AudioWorkletNode;
1280
+ new (context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode;
1277
1281
  prototype: AudioWorkletNode;
1278
1282
  };
1279
1283
  /**
@@ -1289,7 +1293,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1289
1293
  protected fPlotHandler: PlotHandler | null;
1290
1294
  protected fUICallback: UIHandler;
1291
1295
  protected fDescriptor: FaustUIInputItem[];
1292
- constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options: FaustAudioWorkletNodeOptions<Poly>["processorOptions"], nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
1296
+ constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options?: Partial<FaustAudioWorkletNodeOptions<Poly>>);
1293
1297
  /** Setup accelerometer and gyroscope handlers */
1294
1298
  listenSensors(): Promise<void>;
1295
1299
  setOutputParamHandler(handler: OutputParamHandler | null): void;
@@ -1298,6 +1302,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1298
1302
  getComputeHandler(): ComputeHandler | null;
1299
1303
  setPlotHandler(handler: PlotHandler | null): void;
1300
1304
  getPlotHandler(): PlotHandler | null;
1305
+ setupWamEventHandler(): void;
1301
1306
  getNumInputs(): number;
1302
1307
  getNumOutputs(): number;
1303
1308
  compute(inputs: Float32Array[], outputs: Float32Array[]): boolean;
@@ -1325,7 +1330,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1325
1330
  */
1326
1331
  export declare class FaustMonoAudioWorkletNode extends FaustAudioWorkletNode<false> implements IFaustMonoWebAudioDsp {
1327
1332
  onprocessorerror: (e: Event) => never;
1328
- constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, sampleSize: number, nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
1333
+ constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<false>> & Pick<FaustAudioWorkletNodeOptions<false>, "processorOptions">);
1329
1334
  }
1330
1335
  /**
1331
1336
  * Polyphonic AudioWorkletNode
@@ -1333,7 +1338,7 @@ export declare class FaustMonoAudioWorkletNode extends FaustAudioWorkletNode<fal
1333
1338
  export declare class FaustPolyAudioWorkletNode extends FaustAudioWorkletNode<true> implements IFaustPolyWebAudioDsp {
1334
1339
  private fJSONEffect;
1335
1340
  onprocessorerror: (e: Event) => never;
1336
- constructor(context: BaseAudioContext, name: string, voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, sampleSize: number, effectFactory?: LooseFaustDspFactory, nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
1341
+ constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<true>> & Pick<FaustAudioWorkletNodeOptions<true>, "processorOptions">);
1337
1342
  keyOn(channel: number, pitch: number, velocity: number): void;
1338
1343
  keyOff(channel: number, pitch: number, velocity: number): void;
1339
1344
  allNotesOff(hard: boolean): void;
@@ -1426,9 +1431,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
1426
1431
  * @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
1427
1432
  * @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
1428
1433
  * @param processorName - AudioWorklet Processor name
1434
+ * @param processorOptions - Additional AudioWorklet Processor options
1429
1435
  * @returns the compiled WebAudio node or 'null' if failure
1430
1436
  */
1431
- createNode(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: boolean, bufferSize?: number, processorName?: string): Promise<IFaustMonoWebAudioNode | null>;
1437
+ createNode(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: boolean, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<IFaustMonoWebAudioNode | null>;
1432
1438
  /**
1433
1439
  * Create a monophonic WebAudio node (either ScriptProcessorNode or AudioWorkletNode).
1434
1440
  *
@@ -1438,9 +1444,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
1438
1444
  * @param factory - default is the compiled factory
1439
1445
  * @param fftOptions - initial FFT options
1440
1446
  * @param processorName - AudioWorklet Processor name
1447
+ * @param processorOptions - Additional AudioWorklet Processor options
1441
1448
  * @returns the compiled WebAudio node or 'null' if failure
1442
1449
  */
1443
- createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string): Promise<FaustMonoAudioWorkletNode | null>;
1450
+ createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
1444
1451
  /**
1445
1452
  * Create a monophonic Offline processor.
1446
1453
  *
@@ -1496,9 +1503,10 @@ export interface IFaustPolyDspGenerator extends GeneratorSupportingSoundfiles {
1496
1503
  * @param effectFactory - the Faust factory for the effect, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
1497
1504
  * @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
1498
1505
  * @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
1506
+ * @param processorOptions - Additional AudioWorklet Processor options
1499
1507
  * @returns the compiled WebAudio node or 'null' if failure
1500
1508
  */
1501
- createNode(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: boolean, bufferSize?: number, processorName?: string): Promise<IFaustPolyWebAudioNode | null>;
1509
+ 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>;
1502
1510
  /**
1503
1511
  * Create a monophonic Offline processor.
1504
1512
  *
@@ -1538,8 +1546,8 @@ export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
1538
1546
  compile(compiler: IFaustCompiler, name: string, code: string, args: string): Promise<this | null>;
1539
1547
  addSoundfiles(soundfileMap: Record<string, AudioData>): void;
1540
1548
  getSoundfileList(): string[];
1541
- createNode<SP extends boolean = false>(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: SP, bufferSize?: number, processorName?: string): Promise<SP extends true ? FaustMonoScriptProcessorNode | null : FaustMonoAudioWorkletNode | null>;
1542
- createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string): Promise<FaustMonoAudioWorkletNode | null>;
1549
+ 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>;
1550
+ createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
1543
1551
  createAudioWorkletProcessor(name?: string, factory?: LooseFaustDspFactory, processorName?: string): Promise<{
1544
1552
  new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
1545
1553
  prototype: AudioWorkletProcessor;
@@ -1561,7 +1569,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
1561
1569
  compile(compiler: IFaustCompiler, name: string, dspCodeAux: string, args: string, effectCodeAux?: string): Promise<this | null>;
1562
1570
  addSoundfiles(soundfileMap: Record<string, AudioData>): void;
1563
1571
  getSoundfileList(): string[];
1564
- 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): Promise<SP extends true ? FaustPolyScriptProcessorNode | null : FaustPolyAudioWorkletNode | null>;
1572
+ 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>;
1565
1573
  createAudioWorkletProcessor(name?: string, voiceFactory?: LooseFaustDspFactory, effectFactory?: LooseFaustDspFactory | null, processorName?: string): Promise<{
1566
1574
  new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
1567
1575
  prototype: AudioWorkletProcessor;