Hi Klaus and Giuseppe, A simple and efficient implementation can be done using the min and max primitives:
limit(lo,hi) = min(hi) : max(lo); Cheers Yann Le lun. 19 juil. 2021 à 11:07, Giuseppe Silvi via Faudiostream-users < faudiostream-users@lists.sourceforge.net> a écrit : > Hi Klaus, > > import("stdfaust.lib"); > > minn = hslider("minimum", -6, -10, 0, 0.1); > maxx = hslider("maximum", +6, 0, 10, 0.1); > > // limit > limit(minn,maxx) = _ <: ba.if( _ < minn, minn , _) <: ba.if( _ > maxx, > maxx, _); > > process = os.osc(1000) : limit(minn,maxx); > //process = os.osc(1000)*5 : limit(-3,4); > > Ciao! > G > > > > On 19 Jul 2021, at 10:46, Klaus Scheuermann <kla...@posteo.de> wrote: > > > > this one is probably simple, but I did not find anything in the syntax > or libraries. > > > > How do I limit a value or signal with a min and a max so it never > exceeds this range? > > > > Something like: > > > > min = -3; > > max = 4; > > process = _ : limit(min,max) : _ > > > > I mean, I did try to implement it, but it does not work ;) : > > > > // limit > > limit(x) = ba.if( x < minimum, minimum , x) : ba.if( x > maximum, > maximum, x) with { > > minimum = hslider("minimum", -6, -10, 0, 1); > > maximum = hslider("maximum", +6, 0, 10, 1); > > }; > > _______________________________________________ > > 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 >
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users