Hi Mykle, We're working on a better solution, but here's a way to go around this type of problem (directly take from the new mi.lib library):
initState((init)) = R(0,init) with{ R(n,(initn,init)) = +(initn : ba.impulsify@n) : R(n+1,init); R(n,initn) = +(initn : ba.impulsify@n); }; osc(m,k,z,x0,x1) = equation with{ A = 2 - (k + z)/m; B = z/m - 1; C = 1/m; equation = x letrec{ 'x = A*(x : initState(x0)) + B*(x' : initState(x1)) + *(C); }; }; I hope this helps. Cheers, Romain On Fri, Feb 1, 2019 at 9:44 AM Mykle James Hansen <my...@mykle.com> wrote: > Hi, > > Is there a way in Faust to specify the initial value of > a variable whose subsequent values are defined with letrec{} ? > > In my code I have a signal that divides other signals with the % operator. > This divisor is defined never to be zero, but because > the letrec expression defines the value based on > the previous values of other variables, I don’t see > how the initial value is defined at all. In practice > the initial value appears to be zero, because I get a > divide-by-zero crash if I don’t add a bunch of other > defensive code. > > Thanks, > -mykle- > > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > -- Romain Michon +33 (0)7 67 39 72 40http://grame.fr/~michon
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users