[PD] phase locked loop

Simon Iten itensimon at gmail.com
Mon Mar 13 13:41:06 CET 2023


hi charles,

thanks for doing this!!

i copied your first patch (with the changes you suggested) to my bela and hooked up my hexaphonic bass pickup to it (well one string to start), and it works pretty well!

i will play with the threshold settings etc. as it is now, the pitch seems to go down a half step every time i stop a note on the bass so that the pll osc is a semitone off. not sure this will be a problem in a “proper” implementation, since i mostly want the pll to follow my playing (so i will just mute the osc when i don’t play)

i do not currently grasp the math in the fexpr~ objects, but will try to get into it…

is it hard to implement a detune factor? so that we could adjust the pll transposition (octave up/down, fifth etc.)

thanks so much already!!


> On 11 Mar 2023, at 19:49, Charles Z Henry <czhenry at gmail.com> wrote:
> 
>> If the phase is <0.5,  then we're receiving pulses at more than double
>> the current freq.  In that case, don't update phase, update frequency.
>> If the phase is >0.5 and <2.0, then we're within one octave.
>> The maximum phase update amount is (1-phase)
>> The maximum frequency update amount is ((1-phase)/phase)*freq
>> Then, if the phase is >2.0, then the input freq is more than 1 octave
>> lower.  In this case, don't update phase, update frequency.
> 
> The cool part is this can all be implemented at a basic level in just
> a few lines of code with fexpr~!  (I started in on it just to write
> this part, figuring it takes me 20 min)
> 
> fexpr~ modf($y1+$f5*$y2+$f3*$x1*$y3);
> if($y6!=$y6[-2], $y6, $y2+$f4*$x1*$y4);
> if($y5<0.5, 0, if($y5<2, 1-$y5, 0));
> if($y5<0.5, $y2, if($y5<2, (1-$y5)/$y5*$y2, -1.414*$y2/sqrt($y5)));
> if($x1[-1]==1, $y1+$f5*$y2, $y5+$f5*$y2);
> if($y6!=$f2, $f2, $y6)
> 
> But just so difficult to explain, I created a mathcha document for it,
> if you expected to be able to start modifying it and tuning it up for
> use.
> 
> https://www.mathcha.io/editor/OBgdJIo6UzgsgZHp8K1VSjK188YTN4eVJyHrz1q8G
> 
> work in progress






More information about the Pd-list mailing list