Hi Alessandro,

I’m not sure to follows all the details of your code, but compiling it in C++, 
it generates a DSP with 1344 inputs (!!), 1 output, and 11884 lines of code. So 
something is probably wrong. 

Can you possibly explain it more, and/or comment the code in details ?

Thanks.

Stéphane


> Le 12 janv. 2021 à 20:01, Alessandro Anatrini <al.anatr...@gmail.com> a écrit 
> :
> 
> Hi all,
> 
> I’m quite new to faust and I’m facing some issues implementing a wavetable 
> oscillator. 
> The table I’m using is made of 127 morphing waves of 1 cycle each, with each 
> cycle of 256 samples. 
> An instance of the oscillator sounds quite fine. When I try to run 2 
> instances, it still compiles on FaustLive, but it doesn’t run anymore. By 
> this I mean that it really doesn’t run because the CPU drops around 2%, while 
> it should be much higher. Using par primitive in order to run 2 instances of 
> the same osc still gives me the same issue.
> I paste here below the code I' working on.
> 
> Any ideas what I might be doing wrong? 
> Thanks for your suggestions,
> Alessandro
> 
> 
> 
> import("stdfaust.lib");
> 
> os_freq_a = hslider("Freq_A [style:knob]",20,20,2000,0.01) : si.smoo;
> os_wav_a = hslider("Sel_A [style:knob]",0,0,127,1) : si.smoo;
> 
> os_freq_b = hslider("Freq_B [style:knob]",20,20,2000,0.01) : si.smoo;
> os_wav_b = hslider("Sel_B [style:knob]",0,0,127,1) : si.smoo;
> 
> volume = hslider("Volume [style:knob]",0,0,1,0.01) : si.smoo;
> 
> tab1 = soundfile("Set_1[url:{'/Users/alan/wavesets/sin_doubler1.wav'}]", 1) : 
> !,!,_;
> tab2 = soundfile("Set_2[url:{'/Users/alan/wavesets/sin_doubler2.wav'}]", 1) : 
> !,!,_; 
> 
> wrap(val,lo,hi) = ba.if(val<lo, fmod(hi-(lo-val),(hi-lo)), 
> fmod(lo+(val-lo),(hi-lo)));
> sah(trg,x) = (*(1 - trg) + x * trg) ~ _;
> 
> os_wt(freq,wav,len,sr,steps,tab) = 0.5*((2.0*v1) + (-v0+v2)*dv + (2.0*v0 - 
> 5.0*v1 + 4.0*v2 - v3)*pow(dv,2) + (-v0 + 3.0*v1 - 3.0*v2 + v3)*pow(dv,3)) // 
> Catmull-Rom spline interpolation
> with {
>     counter = %(*:max(len))~+(freq*(len/sr)); // create a phasor with 
> increment as function of freq
>     trig = ma.diffn(counter)<0; // 0 when phaze wraps at len else 1
>     phaze = @(counter,1); // 1s delay so it's in sync with trig
> 
>     dv = ma.decimal(phaze); 
>     wsel = sah(trig,rint(wav));
>     bas = rint(wsel)*len; 
> 
>     blend_b = ma.decimal(wsel);
>     blend_a = 1-blend_b;
>     b_next = bas+len;
> 
>     idx1 = wrap(phaze-1.0,0.0,len);
>     idx2 = idx1 <: _+1-(len*(_>=255.0)); 
>     idx3 = idx2 <: _+1-(len*(_>=255.0)); 
>     idx4 = idx3 <: _+1-(len*(_>=255.0));
> 
>     v0 = 0,(blend_a*(idx1+bas)) + (blend_b*(idx1+b_next)) : tab;
>     v1 = 0,(blend_a*(idx2+bas)) + (blend_b*(idx2+b_next)) : tab;
>     v2 = 0,(blend_a*(idx3+bas)) + (blend_b*(idx3+b_next)) : tab;
>     v3 = 0,(blend_a*(idx4+bas)) + (blend_b*(idx4+b_next)) : tab;
> };
> 
> os_wt_a = os_wt(os_freq_a,os_wav_a,256,ma.SR,127,tab1);
> os_wt_b = os_wt(os_freq_b,os_wav_b,256,ma.SR,127,tab2);
> 
> process = os_wt_a,os_wt_b :> _*volume;
> 
> 
> _______________________________________________
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to