Is it possible to smooth between CC changes? My midi controller knob (korg nanokey studio) only does increments of 2 steps which results in patchy sound changes. I'd like to smooth the data so for example; a change between value of 2 to 4 would go to 2.1, 2.2, 2.3, etc. Also is it possible to edit the delay of which those changes happen? Also how could I apply those to specific Control Numbers and Channels?
A CC only has a range of 0 to 127 so your nanokey is running at 1/2 the resolution if that is the case.
You can smooth between CC changes using a variable to retain a copy of the most recent CC value and a loop that goes between the new and previous values with a delay to smooth it out. It is possible to keep track of every CC on every channel using the 'W' array.
Something like this:
# is this a CC? if MT == B0 # determine the W position into L0 calc L0 = MC * $128 calc L0 = L0 + M1
# get diff between previous and current calc P0 = M2 - WL0
if P0 < 0 # going down assign P1 = -1 else # going up assign P1 = 1 end
# loop, I0 = counter, I1 = delay assign I0 = WI0 0 while I0 != M2 # get next CC value calc I0 = I0 + P1
# send CC with delay send M0 M1 I0 +DI1
# accumulate delay calc I1 = I1 + $10 # 10ms per CC end
# send final CC send M0 M1 M2 +DI1
# block the original CC block
# save new value assign WL0 = M2 end
I just typed in the above to demonstrate the concept; testing and debugging is up to you. :-)
You could vary the inter-CC delay depending upon the difference and other refinements, but that is the gist of what you would need to do.
Nic, thank you for that! Your hard work to solve this is very appreciated. It partially worked. The only issue is that the code is a bit glitchy. Any suggestions how to get a smooth transition between CC values though?
My temporary solution is to assign the x-y pad, which has higher resolution on the Nanokey Studio than the knobs, and that works with the cutoff filter.
It is likely to glitch depending upon the speed at which you turn the knob. I set an inter-CC delay of 10ms, so that might be a little high. If you turn quickly, the CC will jump backwards. Try setting that to a very low value; (zero even may work well) by adjusting this code:
# accumulate delay calc I1 = I1 + $10 # 10ms per CC