I don't have a paper about this
and I don't see how you could get the SNR from it.

For frequency detection

(prefilter) -> HilbertTransform -> atan2  gives you the phase

differenciate and unwrap gives you the angular frequency:

diff = phase_new - phase_old
if phase_old > Pi and phase_new < Pi then diff += 2Pi

and F Hz = diff * SR

This estimate is not perfect and has some modulation since the filter is not perfect and so the Hilbert Transform includes more than the lowest partial and atan2 is the sum of all  (I think).

A better estimate is to only measure the time between wraparounds of the phase:

The sub-sample time of the wraparound (the time that is passed when its detected) is
(phase_value_after_wrap_round / angular_frequency ) * 1/SR

I basically start a counter with 1/SR at every phase wrap around and
subtract the sub-sample time, and 1/T for F when the cycle is completed.
So this gives you an estimate once per cycle, which is more or less in synch
with the original waveform.

If you need more than one estimate per cycle you can add an offset to the phase, and wrap it, and run counters in parallel, or use the angular frequency per sample
directly.

I just realized I also have a static prefilter to precondition the signal and a minimum frequency for the dynamic filters
if I remember correctly this was to avoid that the system tends to
fall down to dc when there is no signal - your idea to add some noise and to change the Q
of the bandpass might alos improve things




Am 04.02.2018 um 01:45 schrieb Dario Sanfilippo:
Hi, GM.

On 3 February 2018 at 18:39, gm <g...@voxangelica.net <mailto:g...@voxangelica.net>> wrote:





    If your goal is to isolate the lowest partial, why dont you use
    the measured frequency to steer a lowpass or lowpass/bandpass filter?

​I'm already piloting a lowpass in my current algorithm but I was thinking to use a bandpass too, also for another algorithm which detects the loudest partial. I haven't properly thought of that but a first idea was to have the Q of the BP inversely proportional to the derivative of the output of the integrator: that way, when the integrator is not changing we are around the detected partial and we can then select even further by increasing the Q. Though, I should also think of a way to "release" the Q when the input signal changes or the system might enter an attractor.

Currently, in the algorithm that I described earlier, there is a very tiny amount of energy added to the high spectrum of the crossover; tiny enough to be negligible for the measurement, but big enough to move the cutoff up when there is no energy in the crossover's input. So if I have a detected lowest at 1k plus a bunch of partials at 10k and higher, if I remover the 1k partial the system will move to 10k.


    For my time domain estimator I use

    4th order Lowpass, 2nd order BP -> HilbertTransform ->
    Phasedifferenz -> Frequency
     
|________________________cutoff____________________________________________|

​I'm not familiar with the technique which uses the HT and the phase difference to calculate the frequency. I'd be very grateful if you could say a few words about that.​ Can you also control the SNR/sensitivy in your system?


    This gives you an estimate (or rather measurement) per sample.

    A further improvement is to calculate the sub-sample time between
    phase wraparounds,
    this basically elimates any spurios modulations from the phase
    within a cycle,
    simlar to an integrator.

    You can have several measurements per cycle again by adding angle
    offsets to the phase and calculating the time between wraprounds
    of the new angles as well.

    I use SVFs for the filters with Q set to a Butterworth response
    for the LPs
    and Q=2 for the Bandpass.

    I dont know if this method has less overhead than yor method
    because you need the Hilbert Transform, but the prefiltering is
    more efficient

    Depending on your input sorces you can try to exchange the HT with
    a single allpass with adaptive corner frequency

​
All great ideas, thanks a lot for sharing. Have you published any paper on this or other time-domain algorithms for feature-extration? The reason why I implemented that algorithm is that it will probably be used in a time-domain noisiness estimator which I'm working on and that I will perhaps share here if it gets somewhere.

Cheers,
Dario


    Am 03.02.2018 um 14:49 schrieb Dario Sanfilippo:
    Thanks for the links, Steven!

    Vadim, what is the title of your book? We may have it here at uni.

    Hi, Robert. I'm working on some time-domain feature-extraction
    algorithms based on adaptive mechanisms. A couple of years ago, I
    implemented a spectral tendency estimator where the cutoff of a
    crossover (1p1z filters) is piloted by the RMS imbalance of the
    two spectra coming out of the same crossover. Essentially, a
    negative feedback loop for the imbalance pushes the cutoff
    towards the predominant spectrum until there's a "dynamical
    equilibrium" point which is the estimated tendency.

    A recent extension to that algorithm was to add a lowpass filter
    within the loop, at the top of the chain, as shown in this
    diagram:
    https://www.dropbox.com/s/a1dtk0ri64acssc/lowest%20partial.jpg?dl=0
    <https://www.dropbox.com/s/a1dtk0ri64acssc/lowest%20partial.jpg?dl=0>.
    (Some parts necessary to avoid the algorithm from entering
    attractors have been omitted.)

    If the same spectral imbalance also pilots the cutoff of the
    lowpass filter, we have a nested positive (the lowpass
    strengthens the imbalance which pushes the cutoff towards the
    same direction) and negative (the crossover's dynamical
    equilibrium point) feedback loop. So it is a recursive function
    which removes partials from top to bottom until there is nothing
    left to remove except the lowest partial in the spectrum.

    The order and type of the lowpass (I've tried 1p1z ones,
    cascading up to four of them), I believe, is what determines the
    SNR in the system, so what the minimum amplitude of the bottom
    partial should be to be considered signal or not. Large
    transition bands in the lowpass will affect the result as the top
    partials which are not fully attenuated will affect the
    equilibrium point. Since elliptic filters have narrow transition
    bands at low orders, I thought that they could have given more
    accurate results, although the ripples in the passing band would
    also affect the SNR of the system.

    Perhaps using Butterworth filters could be best as the flat
    passing band could make it easier to model a
    "threshold/sensitivity" parameter. With that regard, I should
    also have a look at fractional order filters. (I've quickly tried
    by linearly interpolating between filters of different orders but
    I doubt that that's the precise way to go.)

    Of course, an FFT algorithm would perhaps be easier to
    model, though this time-domain one should be CPU-less-expensive,
    not limited to the bin resolution, and would provide a continuous
    estimation not limited to the FFT period.

    I've tested the algorithm and it seems to have a convincing
    behaviour for most test signals, though it is not too accurate in
    some specific cases.

    Any comment on how to possibly improve that is welcome.

    Thanks,
    Dario


    Dario Sanfilippo - Research, Teaching and Performance
    Reid School of Music, Edinburgh University
    +447492094358 <tel:07492%20094358>
    http://twitter.com/dariosanfilippo
    <http://twitter.com/dariosanfilippo>
    http://dariosanfilippo.tumblr.com
    <http://dariosanfilippo.tumblr.com>

    On 3 February 2018 at 08:01, robert bristow-johnson
    <r...@audioimagination.com <mailto:r...@audioimagination.com>> wrote:


        i'm sorta curious as to what a musical application is for
        elliptical filters that cannot be better done with
        butterworth or, perhaps, type 2 tchebyshev filters?  the
        latter two are a bit easier to derive closed-form solutions
        for the coefficients.

        whatever.  (but i am curious.)

        --

        r b-j r...@audioimagination.com <mailto:r...@audioimagination.com>

        "Imagination is more important than knowledge."



        ---------------------------- Original Message
        ----------------------------
        Subject: Re: [music-dsp] Elliptic filters coefficients
        From: "Dario Sanfilippo" <sanfilippo.da...@gmail.com
        <mailto:sanfilippo.da...@gmail.com>>
        Date: Fri, February 2, 2018 6:37 am
        To: music-dsp@music.columbia.edu
        <mailto:music-dsp@music.columbia.edu>
        
--------------------------------------------------------------------------


        > Thanks, Vadim.
        >
        > I don't have a math background so it might take me longer
        than I wished to
        > obtain the coefficients that way, but it's probably time to
        learn it. With
        > that regard, would you have a particularly good online
        resource that you'd
        > suggest for pole-zero analysis and filter design?
        >
        > Thanks to you too, Shannon.
        >
        > Best,
        > Dario
        >
        > On 1 February 2018 at 11:16, Vadim Zavalishin <
        > vadim.zavalis...@native-instruments.de
        <mailto:vadim.zavalis...@native-instruments.de>> wrote:
        >
        >> Hmm, the Wikipedia article on elliptic filters has a
        formula to calculate
        >> the poles and further references the Wikipedia article on
        elliptic rational
        >> functions which effectively contains the formula for the
        zeros. Obtaining
        >> the coefficients from poles and zeros should be
        straightforward.
        >>
        >> Regards,
        >> Vadim
        >>
        >>
        >> On 01-Feb-18 12:00, Dario Sanfilippo wrote:
        >>
        >>> Hello, everybody.
        >>>
        >>> I was wondering if you could please help me with elliptic
        filters. I had
        >>> a look online and I couldn't find the equations to
        calculate the
        >>> coefficients.
        >>>
        >>> Has any of you worked on that?
        >>>
        >>> Thanks,
        >>> Dario
        >>>
        >>>
        >>> _______________________________________________
        >>> dupswapdrop: music-dsp mailing list
        >>> music-dsp@music.columbia.edu
        <mailto:music-dsp@music.columbia.edu>
        >>> https://lists.columbia.edu/mailman/listinfo/music-dsp
        <https://lists.columbia.edu/mailman/listinfo/music-dsp>
        >>>
        >>>
        >> --
        >> Vadim Zavalishin
        >> Reaktor Application Architect
        >> Native Instruments GmbH
        >> +49-30-611035-0
        >>
        >> www.native-instruments.com <http://www.native-instruments.com>
        >> _______________________________________________
        >> dupswapdrop: music-dsp mailing list
        >> music-dsp@music.columbia.edu
        <mailto:music-dsp@music.columbia.edu>
        >> https://lists.columbia.edu/mailman/listinfo/music-dsp
        <https://lists.columbia.edu/mailman/listinfo/music-dsp>
        >>
        >>
        > _______________________________________________
        > dupswapdrop: music-dsp mailing list
        > music-dsp@music.columbia.edu
        <mailto:music-dsp@music.columbia.edu>
        > https://lists.columbia.edu/mailman/listinfo/music-dsp
        <https://lists.columbia.edu/mailman/listinfo/music-dsp>

        _______________________________________________
        dupswapdrop: music-dsp mailing list
        music-dsp@music.columbia.edu
        <mailto:music-dsp@music.columbia.edu>
        https://lists.columbia.edu/mailman/listinfo/music-dsp
        <https://lists.columbia.edu/mailman/listinfo/music-dsp>





    _______________________________________________ dupswapdrop:
    music-dsp mailing list music-dsp@music.columbia.edu
    <mailto:music-dsp@music.columbia.edu>
    https://lists.columbia.edu/mailman/listinfo/music-dsp
    <https://lists.columbia.edu/mailman/listinfo/music-dsp>


    _______________________________________________
    dupswapdrop: music-dsp mailing list
    music-dsp@music.columbia.edu <mailto:music-dsp@music.columbia.edu>
    https://lists.columbia.edu/mailman/listinfo/music-dsp
    <https://lists.columbia.edu/mailman/listinfo/music-dsp>




_______________________________________________ dupswapdrop: music-dsp mailing list music-dsp@music.columbia.edu https://lists.columbia.edu/mailman/listinfo/music-dsp

_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Reply via email to