FatJak I think I just could find a harder way to do it.
๐
for clarity's sake: the patch i linked to only calibrates the incoming voltages, so the [adc~]
reading from the input jacks, and therefore the pots when nothing is plugged into the jacks.
Pd expects a true 0-10v and will map this to [0-1]
automatically. but if the voltage falls a bit short, you'll never reach [1]
, as you noticed. so the idea is to correct for a slightly low incoming voltage (not quite reaching the 'ideal' 10v) in software.
i mostly just use the onboard pots of Pepper for calibration, because you need some sort of reference point to start from.. so i use the internally provided "not-quite-10v". if you're working with other modules that don't quite reach 10v, the same method applies, but i feel you lose consistency over different patches with different modules.
so.
maybe a bit redundant, but let me explain what the patch does.
feel free to skip.
looking at the patch, the top left inlet is where you hook up your [adc~], aka the pot/input you're after.
samplerate is just that: how often you want the pot value to be read. hook up a [metro] there.
the [lop~] should smooth out the readings enough so you get something that doesn't bounce around too much after the third decimal. so if you're getting, for example, 0.124756547 bouncing up and down, at least up to the 0.124 it should be relatively steady.
the idea is to multiply that 0.124756547 by 1000, and the remove the decimals by running the result through an [ i ].
so now you have 0.124756547 * 1000 = 124.756547, through [ i ] = 124.
this number gets clipped if needed, then divided by 1000 again.. = 0.124.
which is the same steady part we got to begin with. boring ๐
now, for calibration: what i do is run a [print] object somewhere in this path to monitor Pd's values in the IDE.
say you have the pot cranked, so you're expecting a 1 at the [snapshot~] output. however, you're seeing 0.987.
now 1 / 0.987 = 1.013 approx. (ratio of ideal to actual number, if you like.)
meaning: if i multiply the incoming reading by 1013 instead of by 1000 (or better yet: a bit more, say 1015) , that's 0.987 * 1015 = 1001.805.
run that through the [ i ] and you get 1001. that gets clipped to 1000, which gives you a clean 1 at the output.
the bit that gets clipped is so small (1/1000) i don't expect you to notice that on your pot rotation.
in practice, you can actually get away with larger offsets for safety.
you can set that offset - the difference between 1000 and 1015 - at the inlet on the right.
just send it the number 15, it will replace the default 1000 with 1015 and you're good to go.
or set the multiplier manually if you prefer, of course.
there might be easier ways to do this, but this was meant to be universally applicable.
there might also be harder ways to do it ๐