[PD] phase locked loop

Charles Z Henry czhenry at gmail.com
Sat Mar 11 17:28:53 CET 2023


On Fri, Mar 10, 2023 at 2:21 PM Charles Z Henry <czhenry at gmail.com> wrote:

> It has a thresholded rising edge detector on the input with
> (hardcoded) 20 samples of de-bounce to avoid noisy triggers.
> Then, once an input spike is received, the oscillator triggers an
> update to its phase and frequency

This part had a major bug.  LOL was working in spite of the de-bounce,
not because of it

The buggy code:
[fexpr~ ($x1[-1]<$f2)&($x1[0]>$f2)]
|
[fexpr~ if($y2>1, 0, $x1);
if($y1==1, 0, $y1+1/20)]

makes no sense...

Here's the syntax that works:

[fexpr~ ($x1[-1]<$f2)&($x1[0]>$f2)]
|
[fexpr~ if($y2<1, 0, $x1);
if($y1>0, 0, $y2+1.0/20)]

and probably some other variations too.





More information about the Pd-list mailing list