Hi Bart,

it seems that you are not convinced, let me try again.

On 04/16, Oleg Nesterov wrote:
>
> On 04/16, Bart Brouns wrote:
> >
> > Somehow the initial value of `u` got lost in the last commit to this
> > function: 
> > https://github.com/grame-cncm/faustlibraries/commit/ba34ca657a8c98efc804061c5b2e1d4f7e6bc6ff.
>
> I don't think it was lost, this code deliberately tries to not use
> "impulse" for initialization of delay line.
>
> See https://sourceforge.net/p/faudiostream/mailman/message/36700742/
>
> (See also https://sourceforge.net/p/faudiostream/mailman/message/36534365/)

lets look at the current code:

        quadosc(f) = tick ~ (_,_) : mem+1,mem with {
          k1 = tan(f * ma.PI/ma.SR);
          k2 = 2*k1 / (1 + k1 * k1);

          tick(u_0,v_0) = u_1,v_1 with {
            tmp = u_0 - k1 * v_0;
            v_1 = v_0 + k2 * (tmp + 1);
            u_1 = tmp - k1 * v_1;
          };
        };

it is easy to show that mathematically (iow, ignoring the floating point
issues) "tick" obeys to the following equation:

        [ u_1 + 1 ]   [ cos(th)  -sin(th) ]   [ u_0 + 1 ]
        [         ] = [                   ] . [         ]
        [   v_1   ]   [ sin(th)   cos(th) ]   [   v_0   ]

where
        th = th = f * 2 * ma.PI/ma.SR;

So this is just a complex quadrature oscillator, but the " + 1" trick
allows to avoid the initialization.

> > Is that what you mean by "more precise"?
>
> Not at all,

Lets look at the code after the patch:

        quadosc(f) = tick ~ (_,_) : (!,_*0.5) with {
          k1 = tan(f * ma.PI/ma.SR);
          k2 = 2*k1 / (1 + k1 * k1);

          tick(u_0,v_0) = u_1,v_1 with {
            tmp = u_0 - k1 * v_0;
            v_1 = v_0 + k2 * (tmp + 1);
            u_1 = (tmp - k1 * v_1)+impulse;
          };
        };

This code obeys to the same equation above except at the very 1st step,
and this "+ impulse" is just wrong.

After your patch quadosc(f) no longer outputs "sine", it is equivalent
(again, mathematically) to the following implementation:

        quadosc(f) = sin(n * th) + sin((n+1) * th) : /(2)
        with {
                th = 2 * f * ma.PI/ma.SR;
                n = ba.time;
        };

Not to mention it removes the 1st (cosine) output.

To me this makes no sense. Please revert that commit?

Oleg.



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to