[PD] phase locked loop

Charles Z Henry czhenry at gmail.com
Tue Mar 28 21:58:50 CEST 2023


On Mon, Mar 27, 2023 at 10:43 AM Simon Iten <itensimon at gmail.com> wrote:
> On 27 Mar 2023, at 05:51, Charles Z Henry <czhenry at gmail.com> wrote:
>
> I spent a lot of time with adaptive filtering, so that's where my
> thoughts went.
>
> maybe you could shed some lights on this and i could incorporate this into my approach to filter out overtones from the strings and prevent octave jumps.

As a framework, it means expressing some kind of goal as a function
and then seeking the minimum of the error achieving it.  So, that's
where I start: I write down my goal verbally and the scope of what it
applies to.  Then, you have to come up with a formula involving some
measurable things or signals for how well the goal is accomplished and
over what timeframe (weighting the inner product).

Adaptive filtering has a lot of types that come from all the choices
you can make, but the framework looks like this:
1.  Make a cost function that measures how much error there is.
2.  Differentiate the cost function E by the filter weights w to get
the gradient vector dE/dw and update with:
w(n)=w(n) - c(dE/dw(n))
Sometimes with complex cost functions, gradient descent is the best
you can do.  Make c a constant that is small enough, and this works
sort of
3.  Use the 2nd derivative of E (d^2E/dw^2) and use its inverse
operator on the vector dE/dw to make a Gauss-Newton method
w(n)=w(n-1) - c (d^2E/dw^2)^-1 (dE/dw)
with c between 0 and 1.  This is much better.  For error functions
with a quadratic form and c=1, this method reaches the optimum value
in a single update.  Take care to regularize (d^2E/dw^2) to avoid
dividing by 0.  Other than the behavior near zeros of (d^2E/dw^2),
this method has strong convergence properties.
If the filter has N weights, then (d^2E/dw^2) is an NxN matrix.  With
complex cost functions, this is very hard to derive and to invert.

The choice of filter type goes right along with forming the cost
function.  Just try some things out and see where it leads





More information about the Pd-list mailing list