On 09/02, Oleg Nesterov wrote:
>
> Just one note for now, I can hardly understand your image.png, because you
> plot both magnitude and phase in the same window. But this doesn't really
> matter, I'll send another email tomorrow.

Yes...

but before I sleep, let me write the really stupid but simple test case,
see it below.

        $ rdsp /tmp/TEST.dsp -rn 44100 | tail -10
        +0.704864134613         +1.00002277294
        +0.451158937770         +1.00002181207
        +0.241717523054         +1.00001909207
        +0.0934312453347        +1.00001483230
        +0.0182593254887        +1.00000937631
        +0.0222643446729        +1.00000316413
        +0.105123299911         +0.999996696755
        +0.260153654137         +0.999990495791
        +0.474852279770         +0.999985061337
        +0.731903830271         +0.999980831679

so it seems that the code you showed in your email was indeed wrong.

But you know, this doesn't really matter...

I only can't agree with "here is a better one". I mean, I hope that now it is
clear that both versions "do the same". Just Niemitalo's version uses order=4,
while your version uses order = 16/2 = 8.

And hiir library allows to design the "same" filter with any order/transition.

Oleg.

-------------------------------------------------------------------------------
import("stdfaust.lib");

// copy-and-pasted from your email
combAP(coeff, x) = f ~ _ with {
f(s) = x'' - coeff * x + coeff * s';
};
coeffsHilbertVicanek = waveform {
0.0406273391966415,
0.2984386654059753,
0.5938455547890998,
0.7953345677003365,
0.9040699927853059,
0.9568366727621767,
0.9815966237057977,
0.9938718801312583,
0.1500685240941415,
0.4538477444783975,
0.7081016258869689,
0.8589957406397113,
0.9353623391637175,
0.9715130669899118,
0.9886689766148302,
0.9980623781456869
};
coeffHilbertVicanek(i) = coeffsHilbertVicanek , int(i) : rdtable;
hilbertVicanek(x) = (x : seq(i, 8, combAP(coeffHilbertVicanek(i)))) , (x :
seq(i, 8, combAP(coeffHilbertVicanek(i + 8))) : mem);

// I _think_ this fixes your code. At least makes it simpler and more effecient 
;)
fixed = H(a1), H(a2)' with {
        a1 = 0.0406273391966415, 0.2984386654059753, 0.5938455547890998, 
0.7953345677003365,
             0.9040699927853059, 0.9568366727621767, 0.9815966237057977, 
0.9938718801312583;
        a2 = 0.1500685240941415, 0.4538477444783975, 0.7081016258869689, 
0.8589957406397113,
             0.9353623391637175, 0.9715130669899118, 0.9886689766148302, 
0.9980623781456869;
        H_sect(coeff, x) = f ~ _ with { f(s) = x'' - coeff * x + coeff * s'; };
        H(as) = seq(i, outputs(as), H_sect(ba.take(i+1, as)));
};

mag2 = _,_ : ^(2) + ^(2);

process = os.oscrs(1000)
        <: hilbertVicanek, fixed
         : mag2, mag2;



_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to