Hi Dario, perhaps it is me who made some mistake... I'll recheck once again tomorrow, I am too tired today.
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. Oleg. On 09/02, Dario Sanfilippo wrote: > > Hi, Oleg. > > On Wed, Sep 2, 2026 at 3:50 PM Oleg Nesterov <[email protected]> wrote: > > > On 09/02, Dario Sanfilippo wrote: > > > > > > Niemitalo's isn't great either, depending on the frequency range you're > > > analysing; here is a better one, courtesy of Martin Vicanek, who provided > > > the coefficients for a 16th-order one in the paper: > > > https://vicanek.de/articles/ReverseIIR.pdf. > > > > > > 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); > > > > Confused... the freq responce of > > > > process = 1-1' : hilbertVicanek; > > > > doesn't look as a hilbert transform at all... > > > > Could it be that I inverted the branches? This is the impulse response that > I get with what I implemented, so the second branch is at ~-90deg. That > should give cosine and sine, which seemed fine. > [image: image.png] > > > > > > So I tried to simplify and fix your code: > > > > hilbertVicanek = 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))); > > }; > > > > Is this your corrected version? Isn't it the same output as mine? > > > > > > seems to work... And now we can see that allpass/pipeline is the same as in > > hilbert() from > > https://sourceforge.net/p/faudiostream/mailman/message/36710453/ > > > > hilbert = _ <: H(a2), H(a1)' with { > > a1 = 0.6923878, 0.9360654322959, 0.9882295226860 , > > 0.9987488452737; > > a2 = 0.4021921162426, 0.8561710882420, 0.9722909545651, > > 0.9952884791278; > > H_sect(a) = f ~ _ with { f(y, x) = a^2 * (x + y') - x''; }; > > H(as) = seq(i, outputs(as), H_sect(ba.take(i+1, as))); > > }; > > > > just the order and coeffs differ. > > > > Now. IIRC this filter is based on hiir library > > > > https://ldesoras.fr/prod.html > > https://ldesoras.fr/src/hiir-1.50.zip > > > Indeed, which in turn is based on some other reference that I don't have at > hand. > > Dario > > > > > > > > which allows to make the filter of any order/transition. Let me show my > > very old implementation written in fpp which uses this library, it > > computes the coeffs at init time. > > > > hiir_hilber(N, T) = hilbert with { > > coef = FPP() eval { > > MAKE: -I /home/oleg/SRC/DSP/ > > FILE: #include <hiir/PolyphaseIir2Designer.cpp> > > decl: double $c[2*$(N)]; > > init: > > hiir::PolyphaseIir2Designer::compute_coefs_spec_order_tbw($c, 2*$(N), > > $(T)); > > exec: $c > > }; > > > > getc = FPP(i, n) { $(coef)[$i + 2*$n] }; > > > > hilbert = _ <: H(0), H(1)' with { > > ap(a) = f ~ _ with { f(y, x) = a * (x + y') - x''; > > }; > > H(i) = seq(n, N, ap(getc(i,n))); > > }; > > }; > > > > A "random" test-case to compare it with your (fixed) hilbertVicanek: > > > > process = 1-1' <: hiir_hilber(8, .001), hilbertVicanek; > > > > freq responces are very close, and I guess could be even closer with > > another T=.001 argument. > > > > Oleg. > > > > _______________________________________________ Faudiostream-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/faudiostream-users
