grame-cncm / faustwasm

Faust for WebAudio written in TypeScript
Other
22 stars 10 forks source link

Compiler error (Win10) #3

Closed crystalthoughts closed 1 year ago

crystalthoughts commented 1 year ago
Faust Compiler version: 2.60.6
Reading file dsps/soundmachine/soundmachine.dsp
Aborted(native code called abort())
file:///Y:/Projects/Audio/FaustFiles/faustwasm/libfaust-wasm/libfaust-wasm.mjs:18
var Module=typeof FaustModule!="undefined"?FaustModule:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});["_main","___getTyp
eName","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach(prop=>{if(!Object.getOwnPropertyDescriptor(Module["ready"],prop)){Object.defineProperty(Module["ready"],prop,{get:()=>abort("You are getting "+prop+"
 on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>abort("You are setting "+prop+" on the Promise object, instead of the instanc
e. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})}});if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){if(Mod
ule["ENVIRONMENT_IS_PTHREAD"])return;var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pa
thname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))
+"/")}var PACK 
...
Error: emsc◄
    at _FaustCompiler.createDSPFactory (file:///Y:/Projects/Audio/FaustFiles/faustwasm/dist/esm/index.js:1614:36)
    at async _FaustPolyDspGenerator.compile (file:///Y:/Projects/Audio/FaustFiles/faustwasm/dist/esm/index.js:3635:25)
    at async faust2wasmFiles (file:///Y:/Projects/Audio/FaustFiles/faustwasm/src/faust2wasmFiles.js:50:21)
    at async file:///Y:/Projects/Audio/FaustFiles/faustwasm/scripts/faust2wasm.js:27:5

Hello, I get that error trying to compile:

import("stdfaust.lib");

gain = hslider("gain",.41,0,1,0.01) : si.smoo;
oct = hslider("oct",.5,0,1,0.01) : si.smoo;
noteLength = hslider("noteLen",.5,0,1,0.01):si.smoo;
timbre = hslider("timbre",.5,0,1,0.01):si.smoo;
filterAmt = hslider("filter",.5,0,1,0.001):si.smoo;
freq = hslider("freq [unit:Hz][scale:log]", 110, 20, 24000, 1): si.smooth(ba.tau2pole(.30));
verbAmt= hslider("reverb",.5,0,1,0.01):si.smoo;
// verb = hslider("reverb",0,0,1,0.01):si.smooth;
gate = button("note on/off"); // Add this button

//oscillators
nOscs = 8;
offset = hslider("offset",.25,0,0.25,0.001):si.smoo * timbre;
// offset = 0.05;
saws = par(
    i, 
    nOscs, 
    os.saw2f4(
        freq/4 * ((i+1)) 
        + offset*i*(-1*i%2)*timbre
    )
):> /(nOscs);

sinOsc = (os.osc(freq)+os.osc(freq*4-offset*2))/4;

sound = sinOsc,saws:si.interpolate(timbre):ve.oberheimLPF(filterAmt,2);
// ADSR envelope
envelope = gate : en.adsr(0.01, 0.1, 0.9, 0.5)*.75;

dry = sound * envelope * gain;
reverbApplied = 
    dry <: re.jpverb(
        1, //decay s
        0.45, //damp
        1, //size
        0.8, //early
        0.15, //modulation depth
        .01,      //mod freq
        .8,      //low
        .6,      //mid
        1, //high
        3000, //lowcut
        7000 //highcut
    )<:
        dry*(1-verbAmt)+_*verbAmt,
        dry*(1-verbAmt)+_*verbAmt;

//mixer
process =  reverbApplied;

with command: node scripts/faust2wasm.js dsps/soundmachine.dsp out/sm -poly

What might be the issue?

ijc8 commented 1 year ago

Thanks for the report, this was helpful in tracking down a memory issue. (See grame-cncm/faust#928 and #4.) This issue should be resolved as of faustwasm 0.0.30.