tap
Converser
Posts: 35
|
Post by tap on Jul 8, 2018 21:32:31 GMT
Hello. I an running an app that does not support MIDI control 64 (hex 40), which is Sustain on/off. I'm thinking I could trap the Sustain On in a variable, and then if that variable is "on" I would pass through all Note On commands, while blocking all Note Off commands until Sustain Off is received. True? Dangerous? Has anyone tried this, and did they get a lot of hung notes? :-)
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jul 9, 2018 6:20:21 GMT
Hi tap, I think that should for fine, but remember to send 'all notes off' message when the sustain trigger is released! Regards, Nic.
|
|
tap
Converser
Posts: 35
|
Post by tap on Jul 26, 2018 0:31:07 GMT
I ended up wrestling with this issue for a good while. The looping solution I tried out got ensnared in the "runaway loop block" issue that was posted elsewhere, and which Nic was able to quickly resolve. I was happy to help beta test that fix. The soft synth that I'm using not only does not support sustain, it ALSO does not support "All Notes Off", which meant having to loop through an array that keeps track of which notes are being held down.
I came relatively close with my code, but Nic bailed me out. I post his solution here, with gratitude. Note that I am only working on MIDI channel 8 here, which means that note on's are 97's and note off's are 87's...
# NB - works for channel 8 only IF LOAD # NB, we use L00-7F as a note lookup table ASS L80 = 0 # hold mode is off by default END 97 XX 00 = 8X # make life easier
# note off+hold mode = on IF M0 == 87 IF L80 == 7F ASS LM1 = 1 # mark note as autoheld XX = XX +B # block note off END END
# hold trigger event logic IF M0 == B7 40 # toggle hold mode (00 and 7F) ASS L80 = M2
# end of hold mode logic IF L80 == 0 # release all autoheld notes ASS I0 = 0 # loop counter 0-127 (notes) IF I0 < 80 +L IF LI0 == 1 # note is autoheld SND 87 I0 00 # send note off ASS LI0 = 0 # mark note as not autoheld END MAT I0 = I0 + 1 # next note number END END END
|
|