|
Post by synthi on Apr 20, 2019 20:12:13 GMT
Hi!! 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
Thanks!
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Apr 23, 2019 10:49:04 GMT
Hi synthi , # 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. Regards, Nic.
|
|
|
Post by synthi on Apr 23, 2019 15:23:11 GMT
Thanks a lot Nic!
Tried the code and it works, but have some flaws:
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. Thanks again!!!!
I promise I`ll try to learn and understand the logic behind your code!
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Apr 23, 2019 16:10:44 GMT
Hi synthi , 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 +Bwhich 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 00Which 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 ENDNow, 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. ;-) Regards, Nic.
|
|
|
Post by synthi on Apr 29, 2019 1:41:39 GMT
It works, thanks!!!!!
|
|
|
Post by synthi on Jun 21, 2019 12:14:55 GMT
upfated and now I’m getting errors everywhere...:
# 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
|
|
|
Post by synthi on Jun 21, 2019 12:29:10 GMT
still errors
|
|
|
Post by synthi on Jun 21, 2019 12:47:43 GMT
I was thinking about a formating problem but no luck
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 21, 2019 13:37:30 GMT
Hi synthi , > upfated and now I’m getting errors everywhere...: What did you update? Are you using MidiFire or StreamByter? On iOS or macOS? From the looks of it, you are copy/pasting but there are invisible formatting/locale characters being inserted which is confusing things. This happens for me with Chrome on iOS but not with Safari. What app are you pasting from? Regards, Nic.
|
|
|
Post by synthi on Jun 26, 2019 3:07:56 GMT
I updated streambyter.... I’m trying copy paste from firefox, safari and even first copying to notes App but I Getafe those errors..... Other scripts I copy/paste are working btw
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 26, 2019 7:59:05 GMT
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.
Regards, Nic.
|
|