@Alphagem-O, Ah, I think that my solution works “better” (i.e., has the right number of visible levels) when the input ranges from -5 to 5, and yours works better when the input range is 0 - 10.
@Squinky, That’s a, hmmm, really interesting thought about hysteresis. Certainly in hardware I would consider that. On the other hand, the floats used within VCV are pretty free from noise. On the gripping hand, signals into VCV could be coming from noisy hardware!
@k-chaffin, I also read the QNT source. I found the updateRanges() code became more baffling the more closely I looked at it. What is that loop from -12 → 24 doing…?
I rewrote it all in terms of “search spaces” and “error functions”. Looking at it now, I don’t remember the details since I have not messed with it in a long time.
You might think that, but you would be very, very wrong.
One example is the one I mentioned earlier. A user intentionally runs a “noise source” into the quantizer. There is by definition noise on the signal.
Another example is the Gibbs phenomenon that is mentioned in the VCV manual where it recommends you use a Schmidt trigger (digital logic with hysteresis) so as not to false trigger on the very real overshoot that you will see on any band limited “square wave”.
Here’s a third, imaginary one: You run a “knob” into a quantizer. The knob is controlled by a hand that will likely waver a bit.
Yeah, you’re right! The formula had a constant maximum voltage of 10 V embedded, so the function did not work properly at other input voltage ranges.
Hence I added a variable for the maximal input voltage (maxvolt) as well as an offset (offset), yielding the following formula and code:
' ENTER VALUES for numlevels, maxvolt and offset
numlevels=8
' number of levels including min and max; equals number of slices + 1
maxvolt=5
' maximal input voltage, e.g. 5 is maximal input of 5 V, i.e. covers the range of 0 to 5 V
offset=-2.5
' voltage offset to adjust minimum values (bottom)
out1 = maxvolt/(numlevels-1)*floor(1/maxvolt*in1*(numlevels-1)+0.5)+offset
Ignoring the notion of establishing a min and max value, and if all you want is an arbitrary number of steps per octave, shouldn’t it work if you run a CV through a scaler (such as Bogaudio’s OFFSET) to scale it up, then through any old chromatic quantizer, then another scaler set to the inverse to scale it down again?
If you use scaling ratios of, say, 1.5 and 0.6666, you would have 1.5 x 12 = 18 steps per octave.
To get the first ratio just divide the desired number of steps by 12.
Thanks! I like the idea for its simplicity, but can’t get it to work here based on your description.
Was using VCV’s QNT as “the old chromatic quantizer”, but it sends out the signal in small steps over the full voltage range to cover different octaves.
Could you perhaps show a model or screenshot of the setup you envision?