@grame/faustwasm 0.0.53 → 0.0.55
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/assets/standalone/faustwasm/index.d.ts +1 -1
- package/assets/standalone/faustwasm/index.js +16 -6
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +16 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +1 -1
- package/dist/cjs-bundle/index.js +18 -8
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +16 -6
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +1 -1
- package/dist/esm-bundle/index.js +18 -8
- package/dist/esm-bundle/index.js.map +2 -2
- package/libfaust-wasm/libfaust-wasm.js +1 -1
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/package.json +1 -1
- package/src/FaustDspGenerator.ts +22 -7
- package/test/bug.dsp +18 -0
- package/test/faustlive-wasm/faustwasm/index.d.ts +1 -1
- package/test/faustlive-wasm/faustwasm/index.js +16 -6
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
Binary file
|
package/package.json
CHANGED
package/src/FaustDspGenerator.ts
CHANGED
|
@@ -395,19 +395,34 @@ export class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
395
395
|
async compile(
|
|
396
396
|
compiler: IFaustCompiler,
|
|
397
397
|
name: string,
|
|
398
|
-
|
|
398
|
+
dspCodeAux: string,
|
|
399
399
|
args: string,
|
|
400
|
+
// The ${dspCodeAux} string has to be added with wrapping new lines to make it properly formatted and ready to compile
|
|
400
401
|
effectCode = `
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
process =
|
|
402
|
+
dsp_code = environment{
|
|
403
|
+
${dspCodeAux}
|
|
404
|
+
};
|
|
405
|
+
process = dsp_code.effect;`
|
|
405
406
|
) {
|
|
407
|
+
// Since the effect is going to process the voice outputs "in-place",
|
|
408
|
+
// the voice output number has to be the same as the effect input number
|
|
409
|
+
const dspCode = `
|
|
410
|
+
adapt(1,1) = _;
|
|
411
|
+
adapt(2,2) = _,_;
|
|
412
|
+
adapt(1,2) = _ <: _,_;
|
|
413
|
+
adapt(2,1) = _,_ :> _;
|
|
414
|
+
adaptor(F,G) = adapt(outputs(F),inputs(G));
|
|
415
|
+
dsp_code = environment{
|
|
416
|
+
${dspCodeAux}
|
|
417
|
+
};
|
|
418
|
+
process = dsp_code.process : adaptor(dsp_code.process, dsp_code.effect);`;
|
|
419
|
+
|
|
406
420
|
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
|
|
407
421
|
if (!this.voiceFactory) return null;
|
|
408
|
-
// Compile effect, possibly failing
|
|
422
|
+
// Compile effect, possibly failing
|
|
409
423
|
try {
|
|
410
|
-
|
|
424
|
+
// Effect is processing same buffers for input and output, so has to use -inpl option
|
|
425
|
+
this.effectFactory = await compiler.createPolyDSPFactory(name, effectCode, args + " -inpl");
|
|
411
426
|
} catch (e) {
|
|
412
427
|
console.warn(e);
|
|
413
428
|
}
|
package/test/bug.dsp
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare options "[midi:on][nvoices:12]";
|
|
2
|
+
import("stdfaust.lib");
|
|
3
|
+
freq = hslider("freq",200,50,1000,0.01);
|
|
4
|
+
gain = hslider("gain",0.5,0,1,0.01);
|
|
5
|
+
gate = button("gate");
|
|
6
|
+
envelope = en.adsr(0.01,0.01,0.8,0.1,gate)*gain;
|
|
7
|
+
|
|
8
|
+
process = os.sawtooth(freq)*envelope, os.sawtooth(freq*1.5)*envelope;
|
|
9
|
+
|
|
10
|
+
//process = os.sawtooth(freq)*envelope;
|
|
11
|
+
|
|
12
|
+
cross = _,_ <: !,_,_,! :> _,_;
|
|
13
|
+
|
|
14
|
+
//effect = _*0.01,_ : cross;
|
|
15
|
+
|
|
16
|
+
effect = _;
|
|
17
|
+
|
|
18
|
+
//effect = cross;
|
|
@@ -1278,7 +1278,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
1278
1278
|
mixerBuffer: Uint8Array;
|
|
1279
1279
|
mixerModule: WebAssembly.Module;
|
|
1280
1280
|
constructor();
|
|
1281
|
-
compile(compiler: IFaustCompiler, name: string,
|
|
1281
|
+
compile(compiler: IFaustCompiler, name: string, dspCodeAux: string, args: string, effectCode?: string): Promise<this | null>;
|
|
1282
1282
|
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>;
|
|
1283
1283
|
createAudioWorkletProcessor(name?: string, voiceFactory?: LooseFaustDspFactory, effectFactory?: LooseFaustDspFactory | null, processorName?: string): Promise<{
|
|
1284
1284
|
new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
|
|
@@ -3636,16 +3636,26 @@ var _FaustPolyDspGenerator = class {
|
|
|
3636
3636
|
this.voiceFactory = null;
|
|
3637
3637
|
this.effectFactory = null;
|
|
3638
3638
|
}
|
|
3639
|
-
async compile(compiler, name,
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
process =
|
|
3639
|
+
async compile(compiler, name, dspCodeAux, args, effectCode = `
|
|
3640
|
+
dsp_code = environment{
|
|
3641
|
+
${dspCodeAux}
|
|
3642
|
+
};
|
|
3643
|
+
process = dsp_code.effect;`) {
|
|
3644
|
+
const dspCode = `
|
|
3645
|
+
adapt(1,1) = _;
|
|
3646
|
+
adapt(2,2) = _,_;
|
|
3647
|
+
adapt(1,2) = _ <: _,_;
|
|
3648
|
+
adapt(2,1) = _,_ :> _;
|
|
3649
|
+
adaptor(F,G) = adapt(outputs(F),inputs(G));
|
|
3650
|
+
dsp_code = environment{
|
|
3651
|
+
${dspCodeAux}
|
|
3652
|
+
};
|
|
3653
|
+
process = dsp_code.process : adaptor(dsp_code.process, dsp_code.effect);`;
|
|
3644
3654
|
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
|
|
3645
3655
|
if (!this.voiceFactory)
|
|
3646
3656
|
return null;
|
|
3647
3657
|
try {
|
|
3648
|
-
this.effectFactory = await compiler.createPolyDSPFactory(name, effectCode, args);
|
|
3658
|
+
this.effectFactory = await compiler.createPolyDSPFactory(name, effectCode, args + " -inpl");
|
|
3649
3659
|
} catch (e) {
|
|
3650
3660
|
console.warn(e);
|
|
3651
3661
|
}
|