Closed mogrifier closed 2 months ago
Remember that voltage to frequency is non-linear. I don't think that matters except in the sense it makes it easier to perform this. I am not outputting the frequency, so everything is being done linearly. 0-1 is an octave so just divide by 12 or 24 to get the values you are quantizing to. Then just add the rest of the voltage back.
Precompute the quantization sets (linear) and just stick in the code.
Example Voltage is 2.5 ignore the 2, just quantize the 0.5 find the number between 0 and 1 that 0.5 is closest to. then add 2 and output the result.
How do I get the fraction of a float?
float myFloat = 3.14159;
float fractionalPart = myFloat - static_cast
// 'fractionalPart' now holds the fractional portion.
OR
float myFloat = 3.14159; float fractionalPart; float integralPart = modf(myFloat, &fractionalPart);
// Now 'integralPart' contains the integer part, and 'fractionalPart' contains the fractional part.
Store the quantization sets (12 and 24) in arrays. Iterate the array to find what the input is closest to. That is the quantized result.
sounds kind of neat changing mode on same pattern.
Mode performs voltage output quantization. Settings are: continuous (none- the default behavior requires no coding), 12 tone, quarter tone (24).