This only answers the error question; I haven't looked at the algorithm and
I don't know if it should work.
You cannot definite two signals that are mutually-determining in Faust
unless you use the recursive operator or the *letrec *environment.
Below is an example of how your functions can be defined using letrec:
import("stdfaust.lib");
FMaths(freq, peakPoint, logExp, onOff) = 1-sigOutInv:calcLogExp, endTrig,
topTrig, (system:_,!): _,_,_,_
with {
sigOutInv = selectIt((system:!,_)-peakPoint);
endTrig = 1-sigOutInv:ba.impulsify;
topTrig = 1-endTrig;
system = onOffB , lf_sawposTrig
letrec {
'onOffB = ba.if(onOff>0, 1, onOff:ba.sAndH(lf_sawposTrig>=1));
'lf_sawposTrig = ma.frac*(onOffB) ~ +(freq'/ma.SR);
};
selectIt(val) = ba.if(val<0, (val/peakPoint):abs, val/(1-peakPoint));
calcLogExp(x) = ba.if(logExp<0.5,
(ma.cbrt(x),x:si.interpolate(min(1,logExp*2))),
(x,x*x*x*x:si.interpolate(max(0,logExp*2-1))));
};
process (freq, peakPoint, logExp, onOff) = FMaths(freq, peakPoint, logExp,
onOff);
Dario
On Mon, 25 May 2020 at 21:41, Sam Pluta <[email protected]> wrote:
> I am making this emulation of the MakeNoise Maths. I am using onOff to
> trigger the process on and off. It all works if in lf_sawposTrig I use
> onOff where it now says onOffB. But this will end the oscillation in the
> middle of a cycle. What I want to do is end the oscillation only at the end
> of the cycle even if onOff has already been set to 0. So I am trying to use
> a sample and hold to grab the value of onOff only when it gets the next
> trigger. I know what I am doing is some tomfoolery (I see the feedback
> loop), but I feel like it should technically work. However, I get a
> "endless evaluation cycle” error on compile. Any idea of another way to
> grab this value or do I need a different approach?
>
> Thanks,
>
> Sam
>
> FMaths(freq, peakPoint, logExp, onOff) = 1-sigOutInv:calcLogExp, endTrig,
> topTrig, onOffB: _,_,_,_
> with {
> sigOutInv = selectIt(lf_sawposTrig-peakPoint);
> endTrig = 1-sigOutInv:ba.impulsify;
> topTrig = 1-endTrig;
>
> onOffB = ba.if(onOff>0, 1, onOff:ba.sAndH(lf_sawposTrig>=1));
>
> lf_sawposTrig = ma.frac*(onOffB) ~ +(freq'/ma.SR);
> selectIt(val) = ba.if(val<0, (val/peakPoint):abs, val/(1-peakPoint));
> calcLogExp(x) = ba.if(logExp<0.5,
> (ma.cbrt(x),x:si.interpolate(min(1,logExp*2))),
> (x,x*x*x*x:si.interpolate(max(0,logExp*2-1))));
> };
>
> process (freq, peakPoint, logExp, onOff) = FMaths(freq, peakPoint, logExp,
> onOff);
> _______________________________________________
> Faudiostream-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users