costas loop frequency tracker
glitchy, robust to noise frequency follower
after the great PLL discourse of 2021, it was conclusively demonstrated that this is not, in fact, a costas loop at all, but something new: a zero crossing frequency detector embedded into costas loop architecture. because of this it is able to track frequency content in noisy signals, once it is locked on a note it can maintain lock if another note is introduced around a major second or minor third away. anyway, the thing that is new here is now it tracks the actual note instead of a note a perfect fifth above, because i previously forgot to half the frequency output of the detector. embarrassing!
well, its a special kind of phase locked loop called a costas loop (PLLs are used to demodulate signals), instead of using flip flops to compare phase difference, it multiplies input by a sine and cosine, filters them both, multiplies them together, and filters again. it's a little more subtle way of doing things, but compared to the more conventional method—that i previously ported to core about a half hour earlier, it seems to work much better. the phase signals are filtered in two places, the second filter, which follows the frequency detection is labeled "costas glide" and works a lot like, you guessed it, a portamento or glide i'd recommend keeping it turned down to keep it following the signal smoothly. the other filtering stage, the phase detection cutoff is more the critical control, it will need adjusting depending on range of input, but you'll get the hang of it. it was tracking notes of my dirty volca keys no problem, within a reasonable range. don't plug the top output labeled "freq" into your audio output, that's not what its for, and i am not liable for you blowing your speakers up if you do, its the detected frequency output, for use for.. you know.... whatever
featuring pristine sine and cosine oscillator made by my friend laureano lopez, a frequency tracker built from the guts of one invented by our illustrious catman dude, which then was improved upon with a lessons learned from the one and only salamander anagram
version 1.01 fixed an obnoxiously obvious bug where the frequency detection output was clipped but the frequency controlling the loop VCO was not, leading to possible situations where the detection would run up against an artificial wall. also of possible note: the placing of the second filter in its current position would make this a 'modified costas loop', as far as i can tell. you can simply read that change as 'more musically interesting'