|
Post by cnsgmusic on Jun 14, 2019 9:16:12 GMT
Hi Nic and others,
Before I get experimental, I was hoping to gain familiarity with StreamByter by using it for some simple mapping. I've read through the SB University, but I am still a little confused. Below I have writtenn out some examples that if I had the answers for would provide me with a lot of help in continuing my mapping endeavor. (Thank you in advance!!)
How can I:
1) Each time CC50 is pressed, the following sysex messages are sent out all at once:
F0 00 01 61 12 54 01 01 00 F7
F0 00 01 61 12 54 01 02 00 F7
F0 00 01 61 12 54 01 03 00 F7
F0 00 01 61 12 54 01 04 00 F7
F0 00 01 61 12 54 01 05 6D F7
2) CC50 is a momentary button on my controller, but I would like it to behave as though it were a toggle alternating between values 127 and 0.
3) When CC50 is pressed, it sends out CC51, CC52, and CC53 all with a velocities = 0.
3) CC33 & CC34 only pass through when CC51's velocity = 127. Additionally, I need to block all other CCs from passing through when CC51 = 127 (so only CC33 & CC34 pass through)
4) CC33 = CC120 when CC50 is pressed; CC33 = CC121 when CC51 is pressed; and CC33 = CC122 when both CC50 and CC51 are pressed.
5) When CC50's velocity = 127, CC33 is mapped to Channel 16; When CC50's velocity is 0, CC33 is mapped to Channel 1.
Please help! I think I can get very far with the answers to these examples above.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 14, 2019 15:40:30 GMT
Hi cnsgmusic , What you are looking for is a little more advanced than just 'Basic MIDI Mapping' (!), so please bear with me as I answer your questions and explain my answers. :-) I am going to give you code that will work only in StreamByterAU. If you are using MidiFire let me know. MidiFire will be getting the new StreamByter extensions but it's still underway. 1) Each time CC50 is pressed, the following sysex messages are sent out all at once:I am going to assume that CC50 is an ON/OFF switch so alternates between values 0 and 127. Here is the code for 1): # generate some sysex when CC50/CH1 goes ON IF M0 == B0 $50 $127 SEND F0 00 01 61 12 54 01 01 00 F7 SEND F0 00 01 61 12 54 01 02 00 F7 SEND F0 00 01 61 12 54 01 03 00 F7 SEND F0 00 01 61 12 54 01 04 00 F7 SEND F0 00 01 61 12 54 01 05 6D F7 END2) CC50 is a momentary button on my controller, but I would like it to behave as though it were a toggle alternating between values 127 and 0.Right, so assuming when you press it, it sends 127 and when you release it it sends 0, here is how to convert it to a toggle: IF LOAD # we keep track of our CC50 in a variable ALIAS L0 cc50_toggle ASSIGN cc50_toggle = 0 END
# every time we see CC 50 on channel 1 IF M0 == B0 $50 IF M2 == $127 # flip the current value of CC50 MATH cc50_toggle = cc50_toggle ^ $127 SEND M0 M1 cc50_toggle ELSE # ignore cc50 release messages BLOCK END END3) When CC50 is pressed, it sends out CC51, CC52, and CC53 all with a velocities = 0. Pretty much the same as question 1: # send some CCs when CC50/CH1 goes ON IF M0 == B0 $50 $127 SEND M0 $51 0 SEND M0 $52 0 SEND M0 $53 0 END3) CC33 & CC34 only pass through when CC51's velocity = 127. Additionally, I need to block all other CCs from passing through when CC51 = 127 (so only CC33 & CC34 pass through)OK, so now we need to know when CC50 is on or off, so we need to track when that is pressed and release. This code will do that. IF LOAD ALIAS L1 cc50_state ASSIGN cc50_state = 0 END
# remember CC50's state IF M0 == B0 $50 ASSIGN cc50_state = M2 END
# is CC50 currently held down? IF cc50_state == $127 # yes cc50 is held down # do we have a CC coming in? IF MT == B0 # block all CCs less than 33 IF M1 < $33 BLOCK END # block all CCs greater than 34 IF M1 > $34 BLOCK END END END4) CC33 = CC120 when CC50 is pressed; CC33 = CC121 when CC51 is pressed; and CC33 = CC122 when both CC50 and CC51 are pressed.Right, so we have to track the state of CC51 also (this code expands on the above): IF LOAD ALIAS L2 cc51_state ASSIGN cc51_state = 0 END
# keep track of CC51 IF M0 == B0 $51 ASSIGN cc51_state = M2 END
# remap CC33 depending on cc50 and 51 IF M0 == B0 $33 IF cc50_state == $127 # CC50 held down ASSIGN M1 = $120 IF cc51_state == $127 # CC50 and 51 both held down ASSIGN M1 = $122 END END if cc51_state == $127 # CC51 held down ASSIGN M1 = $121 END END5) When CC50's velocity = 127, CC33 is mapped to Channel 16; When CC50's velocity is 0, CC33 is mapped to Channel 1. So, using the above code where we have the current value of CC50 in our cc50_state variable: IF M0 == B0 $33 IF cc50_state == $127 # remap to channel 16 MATH M0 = MT + $15 ELSE MATH M0 = MT END ENDRegards, Nic.
|
|
|
Post by cnsgmusic on Jun 14, 2019 19:37:16 GMT
Dear Nic,
I really, really appreciate your help here. This is going to get me far, and I will be happy to share what I come up with as I continue to develop my project.
It means a lot to have your help in this community.
Best regards,
Charles
|
|
|
Post by cnsgmusic on Jun 25, 2019 12:59:23 GMT
Hi nic , If I want to block the original CC (so only the translation passes), is this the best way to do it? IF M0 == B0 $50 $127 SEND M0 $51 0 SEND M0 $52 0 SEND M0 $53 0 Block END-Charles
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 25, 2019 13:08:14 GMT
Add one ‘BLOCK’ after the sends (but before END)
Regards, Nic.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 25, 2019 13:08:51 GMT
Yeah like that!
|
|
|
Post by cnsgmusic on Jun 25, 2019 13:31:00 GMT
nic , Apologies because I know this is another simple request... If M0 == B0 $100 Send M0 $101 Block EndI thought this would simply translate CC100 into CC101, but instead I'm only getting an output of CC101 with a velocity of 0. What am I doing wrong?
|
|
|
Post by cnsgmusic on Jun 25, 2019 13:37:56 GMT
If you don't mind, could you also show me how it would look translating CC100 to CC101 but also changing the velocity range it outputs? It could be something like:
0-9 = 1 10-19 = 2 20-29 = 3 30-39 = 4
and so on... I can probably figure it out from there if you just want to show me up to velocity = 39.
Really appreciate it!
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 25, 2019 13:46:11 GMT
Need third byte:
If M0 == B0 $100 Send M0 $101 M2 Block End
or for this you can use a single line pattern match rewrite (but in hex only)
B0 64 = XX 63
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 25, 2019 13:50:14 GMT
> If you don't mind, could you also show me how it would look translating CC100 to CC101 but also changing the velocity range it outputs? It could be something like:
There's a few ways. Here is a simple divider+1 and rewriter:
IF M0 == B0 $100 MAT M2 = M2 / $13 MAT M2 = M2 + 1 END
or you can create custom mappings like:
B0 64 00-09 = XX XX 01 B0 64 0A-14 = XX XX 02 B0 64 15-1E = XX XX 03 B0 64 1F-28 = XX XX 04 ... and so on
but again, you need to use hex here
Another option is a lookup table to remap all 128 values to different ones.
Regards, Nic.
|
|