|
Post by novelty on Apr 28, 2022 15:40:52 GMT
Hi. I just want to change the channel of all incoming midi messages by assigning a stored variable (0-F that I have determined) to the channel nibble in order to modify the outgoing message. I'm finding the various PDFs and examples incredibly confusing, even though I have a background in coding. Can anyone assist?
|
|
abadam
Developer 
Rotten Apple
Posts: 52
|
Post by abadam on Apr 28, 2022 16:29:20 GMT
assuming your midi channel is in variable I0, rewrite first byte of each incoming channelised message:
if M0 < F0 calc M0 = MT + I0 end
|
|
|
Post by uncledave on Apr 29, 2022 14:24:37 GMT
Hi. I just want to change the channel of all incoming midi messages by assigning a stored variable (0-F that I have determined) to the channel nibble in order to modify the outgoing message. I'm finding the various PDFs and examples incredibly confusing, even though I have a background in coding. Can anyone assist? Hi there. I think maybe what's confusing is what's so obvious it's left unsaid. The main body of a StreamByter script runs once for every MIDI message received. That message is placed in the M array (usually M0, M1, and M2). You can modify the message and it will be sent out (if not Blocked). So you can think of your script as a subroutine receiving the message as an in/out parameter. The other data arrays are all static, so they are preserved between runs. And they are visible to any Subs you may create; there are no "local" variables or scoping rules. Given those limitations, you can write any program you may wish. I once wrote a recursive Sub to enumerate permutations; had to implement a stack and stack pointer due to no locals. You do need to have some knowledge of the MIDI messages to understand examples. The MIDI site is a good source, and the MIDI "language" is pretty simple.
|
|