@grame/faustwasm 0.12.2 → 0.13.0
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/.prettierrc +5 -0
- package/README.md +21 -3
- package/assets/standalone/faustwasm/index.d.ts +38 -16
- package/assets/standalone/faustwasm/index.js +1574 -404
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +38 -16
- package/dist/cjs/index.js +1573 -404
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +38 -16
- package/dist/cjs-bundle/index.js +1576 -406
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +38 -16
- package/dist/esm/index.js +1574 -404
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +38 -16
- package/dist/esm-bundle/index.js +1576 -406
- package/dist/esm-bundle/index.js.map +2 -2
- package/eslint.config.js +11 -0
- package/package.json +57 -51
- package/sound.cpp +163 -0
- package/sound.dsp +4 -0
- package/sound.json +1 -0
- package/sound.wasm +0 -0
- package/src/FaustAudioWorkletCommunicator.ts +150 -143
- package/src/FaustAudioWorkletNode.ts +173 -75
- package/src/FaustAudioWorkletProcessor.ts +218 -90
- package/src/FaustCmajor.ts +9 -3
- package/src/FaustCompiler.ts +112 -35
- package/src/FaustDspGenerator.ts +561 -117
- package/src/FaustDspInstance.ts +58 -24
- package/src/FaustFFTAudioWorkletProcessor.ts +822 -612
- package/src/FaustOfflineProcessor.ts +187 -56
- package/src/FaustScriptProcessorNode.ts +156 -49
- package/src/FaustSensors.ts +426 -96
- package/src/FaustSvgDiagrams.ts +18 -5
- package/src/FaustWasmInstantiator.ts +224 -70
- package/src/FaustWebAudioDsp.ts +1060 -349
- package/src/LibFaust.ts +13 -4
- package/src/SoundfileReader.ts +175 -131
- package/src/WavDecoder.ts +42 -20
- package/src/WavEncoder.ts +35 -21
- package/src/copyWebStandaloneAssets.d.ts +20 -5
- package/src/copyWebStandaloneAssets.js +203 -75
- package/src/exports-bundle.ts +5 -5
- package/src/exports.ts +24 -24
- package/src/faust2CmajorFiles.d.ts +7 -3
- package/src/faust2cmajorFiles.js +10 -8
- package/src/faust2svgFiles.d.ts +7 -3
- package/src/faust2svgFiles.js +9 -7
- package/src/faust2wasmFiles.d.ts +10 -5
- package/src/faust2wasmFiles.js +34 -17
- package/src/faust2wavFiles.d.ts +12 -3
- package/src/faust2wavFiles.js +25 -12
- package/src/index-bundle-iife.ts +2 -2
- package/src/index-bundle.ts +1 -1
- package/src/index.ts +1 -1
- package/src/instantiateFaustModule.ts +43 -36
- package/src/instantiateFaustModuleFromFile.ts +30 -14
- package/src/types.ts +101 -25
- package/test/faustlive-wasm/faustwasm/index.d.ts +38 -16
- package/test/faustlive-wasm/faustwasm/index.js +1574 -404
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/web/create-faust-node.html +53 -0
- package/test/web/create-faust-node.js +186 -0
- package/test/organ/create-node.js +0 -252
- package/test/organ/dsp-meta.json +0 -131
- package/test/organ/dsp-module.wasm +0 -0
- package/test/organ/faust-pwa.js +0 -344
- package/test/organ/faust-ui/index.css +0 -442
- package/test/organ/faust-ui/index.css.map +0 -1
- package/test/organ/faust-ui/index.d.ts +0 -1
- package/test/organ/faust-ui/index.js +0 -3756
- package/test/organ/faust-ui/index.js.map +0 -1
- package/test/organ/faustwasm/index.d.ts +0 -1705
- package/test/organ/faustwasm/index.js +0 -4773
- package/test/organ/faustwasm/index.js.map +0 -7
- package/test/organ/icon.png +0 -0
- package/test/organ/index.html +0 -76
- package/test/organ/index.js +0 -69
- package/test/organ/manifest.json +0 -17
- package/test/organ/service-worker.js +0 -165
|
@@ -91,8 +91,7 @@ export interface LibFaustWasm {
|
|
|
91
91
|
*/
|
|
92
92
|
getInfos(what: FaustInfoType): string;
|
|
93
93
|
}
|
|
94
|
-
export
|
|
95
|
-
}
|
|
94
|
+
export type FaustDspFactory = Required<LooseFaustDspFactory>;
|
|
96
95
|
/**
|
|
97
96
|
* The Factory structure.
|
|
98
97
|
*/
|
|
@@ -411,7 +410,7 @@ export declare class FaustWasmInstantiator {
|
|
|
411
410
|
private static createMemoryMono;
|
|
412
411
|
private static createMemoryPoly;
|
|
413
412
|
private static createMixerAux;
|
|
414
|
-
static loadDSPFactory(wasmPath: string, jsonPath: string): Promise<
|
|
413
|
+
static loadDSPFactory(wasmPath: string, jsonPath: string): Promise<Required<LooseFaustDspFactory>>;
|
|
415
414
|
static loadDSPMixer(mixerPath: string, fs?: typeof FS): Promise<WebAssembly.Module>;
|
|
416
415
|
static createAsyncMonoDSPInstance(factory: LooseFaustDspFactory): Promise<FaustMonoDspInstance>;
|
|
417
416
|
static createSyncMonoDSPInstance(factory: LooseFaustDspFactory): FaustMonoDspInstance;
|
|
@@ -680,10 +679,10 @@ export interface IFaustBaseWebAudioDsp {
|
|
|
680
679
|
*/
|
|
681
680
|
getUI(): FaustUIDescriptor;
|
|
682
681
|
/**
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
682
|
+
* Get DSP UI items description.
|
|
683
|
+
*
|
|
684
|
+
* @return the DSP UI items description
|
|
685
|
+
*/
|
|
687
686
|
getDescriptors(): FaustUIInputItem[];
|
|
688
687
|
/**
|
|
689
688
|
* Get DSP JSON description with its UI and metadata.
|
|
@@ -692,8 +691,8 @@ export interface IFaustBaseWebAudioDsp {
|
|
|
692
691
|
*/
|
|
693
692
|
getJSON(): string;
|
|
694
693
|
/**
|
|
695
|
-
|
|
696
|
-
|
|
694
|
+
* Start accelerometer and gyroscope handlers.
|
|
695
|
+
*/
|
|
697
696
|
startSensors(): void;
|
|
698
697
|
/**
|
|
699
698
|
* Stop accelerometer and gyroscope handlers.
|
|
@@ -727,8 +726,7 @@ export interface IFaustBaseWebAudioDsp {
|
|
|
727
726
|
*/
|
|
728
727
|
destroy(): void;
|
|
729
728
|
}
|
|
730
|
-
export
|
|
731
|
-
}
|
|
729
|
+
export type IFaustMonoWebAudioDsp = IFaustBaseWebAudioDsp;
|
|
732
730
|
export interface IFaustMonoWebAudioNode extends IFaustMonoWebAudioDsp, AudioNode {
|
|
733
731
|
}
|
|
734
732
|
export interface IFaustPolyWebAudioDsp extends IFaustBaseWebAudioDsp {
|
|
@@ -856,7 +854,7 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
856
854
|
*
|
|
857
855
|
* @param allocator : the wasm memory allocator
|
|
858
856
|
* @param baseDSP : the DSP struct (either a monophonic DSP of polyphonic voice) base DSP in the wasm memory
|
|
859
|
-
|
|
857
|
+
*/
|
|
860
858
|
protected initSoundfileMemory(allocator: WasmAllocator, baseDSP: number): void;
|
|
861
859
|
protected updateOutputs(): void;
|
|
862
860
|
metadata(handler: MetadataHandler): void;
|
|
@@ -1171,18 +1169,18 @@ export declare class FaustCompiler implements IFaustCompiler {
|
|
|
1171
1169
|
code: string;
|
|
1172
1170
|
json: any;
|
|
1173
1171
|
poly: boolean;
|
|
1174
|
-
}>): Promise<Map<string,
|
|
1172
|
+
}>): Promise<Map<string, Required<LooseFaustDspFactory>>[]>;
|
|
1175
1173
|
/**
|
|
1176
1174
|
* Import a stringified DSP factories table
|
|
1177
1175
|
*/
|
|
1178
|
-
static importDSPFactories(tableStr: string): Promise<Map<string,
|
|
1176
|
+
static importDSPFactories(tableStr: string): Promise<Map<string, Required<LooseFaustDspFactory>>[]>;
|
|
1179
1177
|
constructor(libFaust: ILibFaust);
|
|
1180
1178
|
private intVec2intArray;
|
|
1181
1179
|
private createDSPFactory;
|
|
1182
1180
|
version(): string;
|
|
1183
1181
|
getErrorMessage(): string;
|
|
1184
|
-
createMonoDSPFactory(name: string, code: string, args: string): Promise<
|
|
1185
|
-
createPolyDSPFactory(name: string, code: string, args: string): Promise<
|
|
1182
|
+
createMonoDSPFactory(name: string, code: string, args: string): Promise<Required<LooseFaustDspFactory> | null>;
|
|
1183
|
+
createPolyDSPFactory(name: string, code: string, args: string): Promise<Required<LooseFaustDspFactory> | null>;
|
|
1186
1184
|
deleteDSPFactory(factory: FaustDspFactory): void;
|
|
1187
1185
|
expandDSP(code: string, args: string): string;
|
|
1188
1186
|
generateAuxFiles(name: string, code: string, args: string): boolean;
|
|
@@ -1531,6 +1529,20 @@ export interface GeneratorSupportingSoundfiles {
|
|
|
1531
1529
|
*/
|
|
1532
1530
|
getSoundfileList(): string[];
|
|
1533
1531
|
}
|
|
1532
|
+
export interface IFaustDspGenerator {
|
|
1533
|
+
/**
|
|
1534
|
+
* Create a monophonic or polyphonic WebAudio node (either ScriptProcessorNode or AudioWorkletNode).
|
|
1535
|
+
* Analyze the code to decide whether to create a monophonic or polyphonic node.
|
|
1536
|
+
*
|
|
1537
|
+
* @param context - the WebAudio context
|
|
1538
|
+
* @param name - DSP name, can be used for processorName
|
|
1539
|
+
* @param code - the DSP code
|
|
1540
|
+
* @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
|
|
1541
|
+
* @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
|
|
1542
|
+
* @returns the compiled monophonic or polyphonic WebAudio node or 'null' if failure
|
|
1543
|
+
*/
|
|
1544
|
+
createFaustNode(context: BaseAudioContext, name: string, code: string, sp?: boolean, bufferSize?: number): Promise<IFaustMonoWebAudioNode | IFaustPolyWebAudioNode | null>;
|
|
1545
|
+
}
|
|
1534
1546
|
export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
|
|
1535
1547
|
/**
|
|
1536
1548
|
* Compile a monophonic DSP factory from given code.
|
|
@@ -1704,6 +1716,16 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
1704
1716
|
getJSON(): string;
|
|
1705
1717
|
getUI(): FaustUIDescriptor;
|
|
1706
1718
|
}
|
|
1719
|
+
export declare class FaustDspGenerator implements IFaustDspGenerator {
|
|
1720
|
+
private static compilerPromise;
|
|
1721
|
+
private extractMidiAndNvoices;
|
|
1722
|
+
/**
|
|
1723
|
+
* Compile DSP code, inspect metadata for [nvoices:] (and optionally [midi:on]), and build either a mono
|
|
1724
|
+
* or poly WebAudio node (ScriptProcessor or AudioWorklet depending on `sp`). Compilation uses a shared,
|
|
1725
|
+
* lazily-created libfaust instance to avoid repeatedly instantiating the WASM compiler.
|
|
1726
|
+
*/
|
|
1727
|
+
createFaustNode(context: BaseAudioContext, name: string, code: string, sp?: boolean, bufferSize?: number): Promise<IFaustMonoWebAudioNode | IFaustPolyWebAudioNode | null>;
|
|
1728
|
+
}
|
|
1707
1729
|
|
|
1708
1730
|
export {
|
|
1709
1731
|
AudioData$1 as AudioData,
|