So, due to the peculiarities of the guitar synth resistive fretboard shenanigans, I am looking at a design where the output voltage from the fretboard would be between 2.5 and 5 volts.
Is there a way to fix this in the code? I would want 2.5V to send a 0 CC value, and 5V to send a 127(max) CC value. Linear scaling in between.
I did look at the example at the bottom of this page:
Heh I knew you’d have the answer on this AC, I was thinking as I typed “I’m totally rushing this and I’m sure AC will come along in 5 minutes with the right answer anyway, maybe I should hit CTRL+F4”
no need for complex divisions or multiplications…
Definitely not. My post was more intended to demonstrate the concept, I wasn’t sure if squeal is familiar with bitshifting and it’s advantages? Anyway it could be:
pin_value = ((pin_value-64) <<1 )
The compiler will optimise *2 to <<1 anyway, but it’s better to specify it. Problem is, because we are scaling up from 63 to 127,we are generating 7bit from 6bit, so there’s a loss of resolution.
Get the value as 10bit…and you just have to bitshift the signal (divide by 4)