Post by reezekeys on Jun 13, 2023 20:34:38 GMT
I have things working but I think there might be a better way to code this. I'm making a patch to play left-hand bass on my keyboard so what I need to do is:
1: put all notes middle C and below on midi channel 3 (for my bass plugin)
2: transpose all remaining notes (above middle C) down one octave
The slight complication is that my controller sends true note-offs (8n), not note-ons with vel=0. I wanted to come up with code that would act on both note-ons and offs, but couldn't figure out a way. I did read the documentation and try a few things without success – but I'm pretty sure this is about my own ignorance and lack of programming experience, which is why I'm here!
The only thing I've come up with is to have two almost identical series of nested IF-THEN statements, one for the note ons, another for the note-offs:
IF M0 == 90 # note-on
IF M1 > 3C # note is above middle C
MAT M1 = M1 - $12 # transpose down an octave
ELSE # this is a bass note
NX = X2 # put on ch. 3, don’t transpose
END
END
IF M0 == 80 # note off
IF M1 > 3C # note is above middle C
MAT M1 = M1 - $12 # transpose down an octave
ELSE # this is a bass note
NX = X2 # put on ch. 3, don’t transpose
END
END
Is this really the most efficient way to do this? TIA for any tips!
(PS - I realize I can easily convert the note offs to note-ons with vel=0 but I'd rather keep the release velocity data intact - for now at least.)
1: put all notes middle C and below on midi channel 3 (for my bass plugin)
2: transpose all remaining notes (above middle C) down one octave
The slight complication is that my controller sends true note-offs (8n), not note-ons with vel=0. I wanted to come up with code that would act on both note-ons and offs, but couldn't figure out a way. I did read the documentation and try a few things without success – but I'm pretty sure this is about my own ignorance and lack of programming experience, which is why I'm here!
The only thing I've come up with is to have two almost identical series of nested IF-THEN statements, one for the note ons, another for the note-offs:
IF M0 == 90 # note-on
IF M1 > 3C # note is above middle C
MAT M1 = M1 - $12 # transpose down an octave
ELSE # this is a bass note
NX = X2 # put on ch. 3, don’t transpose
END
END
IF M0 == 80 # note off
IF M1 > 3C # note is above middle C
MAT M1 = M1 - $12 # transpose down an octave
ELSE # this is a bass note
NX = X2 # put on ch. 3, don’t transpose
END
END
Is this really the most efficient way to do this? TIA for any tips!
(PS - I realize I can easily convert the note offs to note-ons with vel=0 but I'd rather keep the release velocity data intact - for now at least.)