new user here. Just trying the scripts, I’m not very good at programming... I’m looking for a kind of auto-sustain or latched sustain that I could activate or deactivate using a button from my controller. It will sustain the notes infinitely until a new note or chord is played, so the the new notes replace the ones held. I think is a mind of hold that some arps have.
Anyone made something like this?.
edit: I`ve seen a script for sustaining notes (filter the note off) so you can activate and deactivate notes (one press activate and sustain, second press deactivate note). I`m looking for automatic deactivating all notes when a new notes are received
# auto chord hold by audeonic IF LOAD ASS L80 = 0 # held note count END
9X XX 00 = 8X IF MT == 90 # new note on IF L80 == 0 # issue/reset pending note offs ASS I0 = 0 MAT I1 = 80 + MC IF I0 <= 7F +L # send pending note off IF LI0 == 1 SND I1 I0 00 ASS LI0 = 0 END MAT I0 = I0 + 1 END END # increment held count MAT L80 = L80 + 1 END
# handle note off IF MT == 80 MAT L80 = L80 - 1 # decrement ASS LM1 = 1 # mark as pending XX = XX +B # block note off END
I will come clean - I just typed this in. Might be syntax or logic errors. Please let me know how you get on.
if you change i.e. from (C-E-G) to another chord that share some notes (i.e. C-E-A) there are missing notes in the chord. I think it need to retrigger notes (??). Its the same as when you put one note instead of a chord: the first time the note hold and subsequent times the note is muted. Also if you repeat two note chords one of the notes is missing the second time. Or if you hold a chord and next note is one note that was in the chord then the note can´t sound. Finally would be great to have a MIDI CC controlling the Hold on-off so It can be engaged disengaged using a MIDI button.
I promise I`ll try to learn and understand the logic behind your code!
Err, yeah, that code sends the new note on before the note offs. So, we need to send the new note on *after* those note offs instead. It's a bit of a cheat, but if you add these two lines to the bottom of the script that should fix that:
9X = XX +C 9X = XX +B
which clones the note on and then blocks the original. The clone will be put onto the queue after any note ons.
And of course, when you release the last chord, it will sound forever. It is possible to use a CC to fix this, and again, this is a bit of a lazy cheat:
BX 50 7F = XX 7B 00
Which will look for a CC 80 ON (any channel) and issue an 'all notes off' CC in its place. Obviously you will want to change that '50' in the rule above with the hex value of the CC you wish to use. You can put that line at the end of the script also (or the beginning, or the middle - just not inside any existing IF statements).
However, if your sound generator does not honour the 'all notes off' CC, then to switch it off the correct way:
# turn off held notes when CC80/CH1/ON is seen IF M0 == B0 50 7F # issue/reset pending note offs ASS I0 = 0 MAT I1 = 80 + MC IF I0 <= 7F +L # send pending note off IF LI0 == 1 SND I1 I0 00 ASS LI0 = 0 END MAT I0 = I0 + 1 END END
Now, that's a repeat of the note off code that is used when we have the new note on. There are ways of avoiding having to reproduce the same code in two places, but let's keep things simple for now. ;-)
# auto chord hold by audeonic IF LOAD #ERR ASS L80 = 0 # held note count END
9X XX 00 = 8X IF MT == 90 #ERR # new note on #ERR IF L80 == 0 #ERR # issue/reset pending note offs #ERR ASS I0 = 0 #ERR MAT I1 = 80 + MC #ERR IF I0 <= 7F +L #ERR # send pending note off #ERR IF LI0 == 1 #ERR SND I1 I0 00 #ERR ASS LI0 = 0 #ERR END #ERR MAT I0 = I0 + 1 #ERR END #ERR END #ERR # increment held count #ERR MAT L80 = L80 + 1 END
# handle note off IF MT == 80 #ERR MAT L80 = L80 - 1 # decrement #ERR ASS LM1 = 1 # mark as pending #ERR XX = XX +B # block note off END
Hmm, ok, this is happening to me too. I think it is the code above which contains strange characters instead of spaces. I have amended the post at the top to use a 'code' directive. This worked for me.