Skip to content

Instantly share code, notes, and snippets.

@jpcima
Created August 23, 2020 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpcima/108deef74639f7b76ebfb0023ad43ac7 to your computer and use it in GitHub Desktop.
Save jpcima/108deef74639f7b76ebfb0023ad43ac7 to your computer and use it in GitHub Desktop.
// Figure 3.18: 1-pole TPT lowpass filter with resolved zero-delay feedback
g = hslider("Parameter g", 0., 0., 1., 0.01);
process(x) = out with {
G = g/(1+g); // gain term
/* the signal that enters the recursive structure (after multiplier)
as a function of z1 the output of the delay box */
xIn(memZ1) = (x-memZ1)*G;
out = z1'+xIn(z1')
/* the top summer (+) that produces output
it's (z1') because the value is taken after the delay applied */
letrec {
/* expression which compute next value in the delay box according to
the previous one */
'z1 =
xIn(z1) /* left branch which enters bottom summer (+) */ +
(xIn(z1)+z1) /* right branch which enters bottom summer (+) */
;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment