Yes, it is important to distinguish between compile-time and run-time computations, and the basic nature of pattern-matching followed by repeated functional expansion. I suggest (re?)reading a tutorial on the Faust language. The one I use in my teaching is here:
https://ccrma.stanford.edu/~jos/aspf/Primer_FAUST_Language.html Have fun! - Julius On Fri, Jun 8, 2018 at 5:41 AM Sébastien Clara <sebastiencl...@no-log.org> wrote: > > I try to use Faust as an imperative language and signals as arrays. To > calculate the shape of my waveform (my array) at time T, I use the > previous values (T-1 and T-2). > > I must restart from scratch... > > Thanks Oleg for your attention ! > > Sébastien > > > > Le 08/06/2018 à 13:05, Oleg Nesterov a écrit : > > On 06/07, Sébastien Clara wrote: > >> Unfortunately, my code crashes during compilation and I do not know if my > >> mistake comes from: > > may be stack overflow due to infinite recursion, > > > >> x = ba.if(gate==1, > >> par(i, nbMass, ba.if(i==int(nbMass/2),1,ba.take(i+1,x'))), > >> par(i, nbMass, > >> // Xi(n) = P1.Xi(n-1) + P2.[Xi-1(n-1) + Xi+1(n-1)] + > >> P3.Xi(n-2) + P4.f > >> ba.if(i==0, > >> (p1*ba.take(i+1,x@ba.sec2samp(1/sr))) + > >> (p2*(ba.take(nbMass,x@ba.sec2samp(1/sr)) + > >> ba.take(i+2),x@ba.sec2samp(1/sr))) + (p3*ba.take(i+1,x@ba.sec2samp(2/sr))) > >> + (p4*f), > >> (p1*ba.take(i+1,x@ba.sec2samp(1/sr))) + > >> (p2*(ba.take(i,x@ba.sec2samp(1/sr)) + > >> ba.take((i+2)%(nbMass+1)),x@ba.sec2samp(1/sr))) + > >> (p3*ba.take(i+1,x@ba.sec2samp(2/sr))) + (p4*f) > >> ) > >> ) > >> ); > > I have no idea what are you trying to do, but this code looks wrong in any > > case > > or I am totally confused. > > > > ba.take(i+1,x@ba.sec2samp(1/sr)) > > > > looks doubly wrong. ba.take() doesn't make any sense to me, I fail to > > understand > > what it should do. Say, > > > > process = par(i, 2, ba.take(i+1, 0)); > > > > is simply wrong and won't compile. > > > > Also. x@ba.sec2samp(1/sr) refers to the same signal 'x' you are trying to > > define, > > this can't work. For example, > > > > x = x@1; > > process = x; > > > > leads to the endless evaluation cycle, and perhaps this explains the crash. > > > > Oleg. > > > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users -- Julius O. Smith III <j...@ccrma.stanford.edu> Professor of Music and, by courtesy, Electrical Engineering CCRMA, Stanford University http://ccrma.stanford.edu/~jos/ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users