now i used a button which sends following osc messages
on press: /shared/keys true
on release: /shared/keys false
If I now press the button, the color of the panel changes. But now I want to have the change happen when a midi note is coming in. So I went to the midi settings and went to the device (aic driver in this case) and set it to script, so that all midi notes should trigger.
This works well until i trigger 2 notes shorter apart than 30ms. What happens then is the ch1 stays stuck at true and no false command is sent in the end. Why does that happen? I thought because the last note would also send the false command, it should also be turned off. How does ableset handle situations like this and what would be the correct script to prevent that?
Is that your entire script or just a part of it? From what I see this should run as expected, but maybe the duration between setting the variable to true and setting it to false is too short. Could you try increasing it to maybe 100ms and check if that helps?
In theory, any delay time should work, but maybe there’s a bug there that I haven’t discovered yet.
I tried it first with 10ms, but that was to fast to really see the color. Afterwards I tried 300ms, but then it just stayed on and didn’t turn off again, which was strange. I figured 30ms was the sweet spot.
Hope this helps!
And btw, ableset 3 is so awesome. Canvas and scripting is a game changer. We had our first show with it this saturday and it stream lined the sound check process a lot!
Hey @FAster77, thank you for providing the script!
The issue lies in that each script can only run once at a time. If the script is triggered again while it’s running, the running script is cancelled and then run again with the new MIDI data.
This is mainly to prevent lots of scripts running at the same time but comes with a few caveats, like the issue you’re seeing here. Basically, the script triggers the first setShared and is then cancelled because the next MIDI note came in.
The easiest workaround would be to place all resets at the bottom of the script so they always run:
thanks for your suggestion, but somehow I doubt that this helps, I’ll try it tho.
But my problem does not come from triggering 2 different types.
If I triggered ch1 and then suddenly trigger ch2, I think then I would run into this issue that you are describing, when the second script trigger only looks for ch2 and the ch1 got canceled. although I might have this issue, I did not notice it yet.
Also with the await command in the end I would run into the issue, that the midi note offs would also trigger the script. So If I trigger a note and then a second one, and the note off of the first one comes slightly after the note on of the second, the script would interrupt and not show a new signal.
But I had this issue when triggering ch1 only. For clarification, ch1 here is a midi keyboard. And when I press to notes really fast the setShared would get stuck at true.
And I don’t understand this because as you mentioned, the script should restart. So what should happen would be:
setShared ch1 → True
script gets reset by second note
setShared ch1 → True (which has no impact at this point
wait 30ms
setShared ch1 → False
So in any situation, the setShared ch1 should end up False in the end.