Thank you Stéphane for sharing this draft. This sounds very promising and
well thought.

If you allow me, here are two thoughts that I had after reading this
document:
I have the intuition (here, please excuse my audacity as I am still a
newbie :-) that the down sampling of the computation may be inferred from
the code instead of being explicitly noted by the programmer (for example
when some computation is *gated* or when a value is held under a certain
condition (as in the ba.downsample function)).
And from an efficiency point of view, there's probably a balance to be
found between reducing the stream computation rate and the overload of
computation due to the handling of this reduction.

That said, you are probably more aware of these questions than I am.

Jean-Louis


Le sam. 12 févr. 2022 à 10:49, Stéphane Letz <l...@free.fr> a écrit :

> The « enable » primitive was somewhat experimental and is not officially
> supported.
>
> The plan is to rebuilt it starting for a more primitive design based on
> the « on demand » specification :
> https://github.com/orlarey/faust-ondemand-spec/blob/newmaster/spec.pdf
>
> Stéphane
>
>
> > Le 11 févr. 2022 à 19:09, Jean-Louis Paquelin <jean-lo...@paquelin.net>
> a écrit :
> >
> > Hi there,
> >
> > I was diving in the Faust mailing lists when I stumbled upon an example
> using the enable() function:
> > gen(N) =
> >     par(i, N, os.osc(200*(i+1)) : enable(hslider("oscillators",0,0,N,1)
> : int : >(i))) :> _ <: _,_;
> > process = gen(5);
> >
> > I wasn't able to find the documentation of enable() and I'm not entirely
> sure of what it does but I took a look at the C++ code produced.
> >
> > virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs,
> FAUSTFLOAT** RESTRICT outputs) {
> > FAUSTFLOAT* output0 = outputs[0];
> > FAUSTFLOAT* output1 = outputs[1];
> > int iSlow0 = int(float(fHslider0));
> > float fSlow1 = float((iSlow0 > 0));
> > int iSlow2 = (fSlow1 != 0.0f); This test seems to be the enable
> condition in the 1st branch of the par iteration
> > float fTemp0 = fTempPerm0;
> > float fSlow3 = float((iSlow0 > 1)); This test seems to be the enable
> condition in the 2nd branch of the par
> > int iSlow4 = (fSlow3 != 0.0f);
> > float fTemp1 = fTempPerm1;
> > for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
> > if (iSlow2) {
> > This code isn't executed when iSlow2 is false avoiding unnecessary
> computation relative to the oscillator
> > fRec1[0] = (fConst1 + (fRec1[1] - std::floor((fConst1 + fRec1[1]))));
> > fConst1 equals 200 which is the frequency of the first oscillator
> > fTemp0 = (fSlow1 * ftbl0mydspSIG0[int((65536.0f * fRec1[0]))]);
> > }
> > if (iSlow4) {
> > And here the same for the second enable condition
> > fRec2[0] = (fConst2 + (fRec2[1] - std::floor((fConst2 + fRec2[1]))));
> > fConst2 equals 400
> > fTemp1 = (fSlow3 * ftbl0mydspSIG0[int((65536.0f * fRec2[0]))]);
> > }
> > float fTemp2 = (fTemp0 + fTemp1);
> > output0[i0] = FAUSTFLOAT(fTemp2);
> > output1[i0] = FAUSTFLOAT(fTemp2);
> > Not sure what the 2 following ifs do (buffer swapping?)
> > if (iSlow2) {
> > fRec1[1] = fRec1[0];
> > }
> > if (iSlow4) {
> > fRec2[1] = fRec2[0];
> > }
> > }
> > fTempPerm0 = fTemp0;
> > fTempPerm1 = fTemp1;
> > }
> >
> > So the enable() function (I should say primitive btw) seems to avoid
> unnecessary computation when it is disabled.
> >
> > Am I right?
> >
> > Best regards,
> >
> > jlp
> > _______________________________________________
> > 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