I'm very new to the DSP world, and honestly I'm not even sure if this is the right place for this question.
Anyway, I found this piece of code on github, it's a kind of filter (I think), and I would like to know if this can be identified as a commonly used or well known concept. Does it have a name I can use to google? Where do I start to learn more about this, like how does one come up with this code.
The (relevant) code:
This is calculated once:
// Set the loop bandwidth to bw Hz. w = 6.28f * 20 * bw * bsize / fsamp; w0 = 1.0 - exp (-w); w = 6.28f * bw * ratio / fsamp; w1 = w * 1.6; w2 = w * bsize / 1.6; z1 = 0.0 z2 = 0.0 z3 = 0.0
This is calculated every loop:
// Run loop filter and set resample ratio. z1 += _w0 * (w1 * err - z1); z2 += _w0 * (z1 - z2); z3 += _w2 * z2; rcorr = 1 - z2 - z3;
In these snippets
err is the input of the filter and
rcorr is the output.
fsamp are some constants.
For completeness, this code is from here on github.