|
Post by streamer on Nov 12, 2019 14:07:53 GMT
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?
Thank you in advance
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Nov 12, 2019 18:18:50 GMT
Hi streamer , 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 endI 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. Regards, Nic.
|
|
|
Post by streamer on Nov 13, 2019 14:45:18 GMT
Thank you! I got an error at "if MT == B0" It almost works! This type of code would be very useful to 1000s of people using the Korg! I cannot figure it out though.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Nov 13, 2019 16:46:30 GMT
Hi streamer , I don't get any errors - are you missing the final 'end'? Sometimes copy/paste using this forum doesn't always work. Here's a 'code' tagged version which might fare better: # 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 Regards, Nic.
|
|
|
Post by streamer on Nov 14, 2019 11:20:48 GMT
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.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Nov 14, 2019 12:06:11 GMT
Hi streamer , 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(replace that $10 with $1 or $0) Regards, Nic.
|
|
|
Post by streamer on Nov 19, 2019 11:27:41 GMT
Hi nic, Thank you again. I haven't tried that yet but I will soon.
|
|