I've been doing small tests to see if I could snap a cursor moving over a frequency space to given notes while still allowing large glides and vibratos.



This is the p5 sketch sliderScale.zip
And a js demo of it.

In short : I used a blend of smoothing, lerping to targets (the slower the cursor moves the quicker the snapping), and adjusting pitch based on the local movement of the cursor rather than its absolute position (so vibrating around a point between notes means vibrating around the nearest target).
It's nice, but what I called "simple snap" (lerping to the nearest target wile the cursor doesn't move at all) does the trick as well and is a bit more responsive in this specific set of settings.
However, my more complex method shows its strengths in scenarios like vibratos, continuous slides, or very slow cursor movements.
Unfortunately, the latency in this implementation limits the ability to use and make sense of this algorithm.
Also this is one additional occasion for me to state that scales usualy evolve throughout a song and should in my opinion be defined on a computer by choosing a boolean (inclusion/exclusion) for each notes rather than a bass note and an endless confusing list of modes.