Post by Joseph Tennison on Sept 29, 2017 14:05:09 GMT
I am wondering if it is possible to us Stream Byter to receive and store the pitch value of a MIDI note and have its pitch value (not velocity) determine the value added to or subtracted from ANY incoming Continuous controller commands that are later received by the module. I would wante middle C to be the default zero point, such that if Middle C had been played into the module, it would not add or subtract anything from incoming CC commands.
For example, the module would normally pass a CC modulation value of 64 unchanged, but if I had first played a D3 (the D directly above middle C), the module would add a value of 2 to an incoming CC modulation command of 64, and thus send out a value of 66. The module would continue to add 2 to any incoming CC until it received a new note-on different from D3.
That is, the number of semi-tones above or below middle C would determine the magnitude of how any incoming CC was changed.
# retain current note number delta from C3 in L0 IF M0 >= 90 IF M0 <= 9F # we have a note on MAT L0 = M1 - 3C # calc/retain delta SET LB0 L0 +D # see what the delta is END END
# add delta to incoming CC value IF M0 >= B0 IF M0 <= BF # we have a CC MAT M2 = M2 + L0 # apply delta to CC value SET LB1 M2 +D # see what new CC val is END END
Now, there might be a caveat here in that I cannot remember if the MAT expressions will do the correct thing with signed integers, but you'll know soon enough by plugging an Event Monitor in the chain whether it works or not!
As usual, I typed this in by hand. Syntax (and semantics) might be error prone, but it's the idea that counts.
Post by John Tennison on Sept 29, 2017 20:18:06 GMT
It works perfectly well.
One thing I forgot to mention is that I don't want the module to pass through either the note-on or note-off event. That is, I only want the note events to serve the function of creating a change in the value of the incoming continiuous controller events.
Thanks so much! And thanks for your patience with all of my questions.
One other variant that I wanted to try on the module was (in addition to its current function) to have it send out a new set of CC6 values as a function of the most recently received CC6 values on all 16 MIDI channels.
So, for example, if the module had received a CC6 value on channel 1 of 67, and then received an E3 note-on event (4 semi-tones above middle C), the module would immediately send out a new CC6 value on the same channel of 71 (67+4), but also continue its current functionality of continuing to increment or decrement any incoming CC6 as dictated by the most recently received Note-On event.
I am assuming that, for the module to do this, it would need to store the most recently received CC6 values on each of the 16 channels. If it had not received any prior CC6 values for a particular MIDI channel(s), could it incorporate a default value of 64 for CC6 on those MIDI channel(s)?
Also for this new variant of the module, the CC6 values that the module generates and sends out would also need to be stored and references for any additional incoming Note-on events. So in the example above, the CC6 value of 71 that was sent out would have also been stored, such that if another note-on event of E3 (4 semitones above middle c) was received, the module would then send out a CC6 value of 75 (71+4). And then, of course, store the 75 as the most recent CC6 value for its respective channel.
It would also be useful to let the reception of a middle C note-on value "reset" all CC6 values to 64 on all MIDI channels.
I tried out the CC6 specific code that you most recently sent. It's working perfectly well, except that it only seems to be listening to and altering CC6 values sent on channel 1. Is there a simple adjustment that can be made such that it will function for CC6 values on all MIDI channels?
OK, so your nested IF statements are also going to pick up CCs other than number 6 because, for example CC 7 on MIDI channel 1 would also be true. See below for how I would suggest this is done.
To try and go a little further here, this is some code that stores the most recently received CC 6 value on all 16 MIDI channels into variables I00 to I0F as they come in. You can then use those stored values elsewhere. I'm going to use indirect array indexing here!
# process CC6 on any MIDI channel IF M0 >= B0 IF M0 <= BF IF M1 == 06
# we have CC6 on any channel # store the channel number into # transient variable J0 MAT J0 = M0 - B0
# store the CC6 value into I00 to I0F # using J0 as the index into I array ASS IJ0 = M2