|
Post by dov64 on May 3, 2018 12:24:27 GMT
I’m completely new to MidiFire, but have a background as a programmer. When I got a pedal on my stage piano to mute a channel on my mixer with a simple expression last night, it was an aha moment about the power of this tool. Wow!
Anyone have a bit of code to do this?
I have a controller with a bunch of programmable keys. One of their settings is XY so I can generate a continuous CC varying from 0 to 127 depending on position. As an XY it can send CC’s for each axis. 64 is the resting position in each axis.
I want to turn that into 4 discrete CCs value 127 so it can command an app called BandHelper to advance to the next score page, go back to previous page, advance to the next set of midi presets or go back to the previous set of midi presets. BandHelper understands CC’s in a range - 80 could be next page, for example.
Any help would be appreciated!!
Dov
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on May 3, 2018 13:28:46 GMT
Hi dov64 , I think I know what you are after. You don't mention what the in/out CC numbers are, so I'll make those configurable at the top. # convert X/Y to 4 ON CC's IF LOAD # CCs (+chan) we work with ASS K0 = B0 11 # in X ASS K2 = B0 12 # in Y ASS K4 = B0 21 # out TL ASS K6 = B0 22 # out TR ASS K8 = B0 23 # out BL ASS KA = B0 24 # out BR
# current X/Y values ASS L0 = 40 40 END
# handle X incoming CC IF M0 == K0 K1 ASS L0 = M2 END
# handle Y incoming CC IF M0 == K2 K3 ASS L1 = M2 END
# the send logic IF L0 != 40 40 IF L0 < 40 ASS L2 = 4 # or 8 SET LB1 SL END IF L0 > 40 ASS L2 = 6 # or A SET LB1 SR END IF L1 < 40 SET LB0 STOP END IF L1 > 40 MAT L2 = L2 + 4 SET LB0 SBOT END
# send out CC MAT L3 = L2 + 1 SND KL2 KL3 7F
# reset ASS L0 = 40 40 END
# (optional) block incoming XX = XX +B
I just typed the above in. Code not tested for compile/logic errors! Regards, Nic.
|
|
|
Post by dov64 on May 3, 2018 13:37:10 GMT
It seems that part of the solution is to use a range, like this:
# Any value on X axis under 64 converts to 127 B1 50 0-3F = B1 50 0
# Any value on X axis over 64 converts to CC81 127 B1 50 41-7F = B1 51 7F
# Any value on Y axis under 64 converts to 127 B1 52 0-3F = B1 52 127
# Any value on Y axis over 64 converts to CC83 127 B1 52 41-7F = B1 53 127
This would probably work if I could hold the pedal in the exact position I moved it to. But if I wiggle my foot at all this code will send another of the same CC, moving to another page or preset immediately.
Is there a way to prevent that?
|
|
|
Post by dov64 on May 3, 2018 13:40:43 GMT
Hi Nic,
You must have replied as I was posting my own reply. Thanks!!
This sounds like it would work, but would it avoid the problem of repeatedly sending CC’s as I accidentally wiggle the key?
Thanks again!
Dov
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on May 3, 2018 13:46:04 GMT
Hi dov64 , Oh, I presumed you would be tapping the XY controller to trigger the CC's. At the moment the code only triggers an outgoing CC when both an X and a Y value have been received. I guess the code could be changed to only trigger if both X/Y values changed by a certain amount. Regards, Nic.
|
|