double notes get stuck
-
I've discovered a strange behavior with my synth
when the DAW sends two of the same notes, whereas the noteoff of the first one is "behind" the second note, the first note doesn't turn off but gets stuck indefinitely
Here's what it looks like in Cubase.Any ideas how this can be prevented or why this even happens?
I'm using a silent synth with faust networks to make the audio and the famous silent killer node
-
@Morphoice said in double notes get stuck:
why this even happens?
I think the midi spec says that the same note on the same channel should never overlap.
The sequence should be note on, note off, note on, note off. Once you have note on, note on, note off, note off things can get weird. Some daws will automatically trim overlapping notes to prevent this issue.
I'm not sure what you can do from the HISE side to deal with it though.
-
@Morphoice The solution I used was to keep track of all note on events, then if you ever receive two note ons in a row on the same note you know you've received some illegal MIDI.
It's pretty easy if on noteOn you check and store the event ID to an array (or MIDIlist I suppose) like
onNoteOn { if (events[Message.getNoteNumber()]){ Console.print(You've just received some illegal MIDI!); } else { events[Message.getNoteNumber()] = Message.getEventId(); } } onRelease { events[Message.getNoteNumber()] = undefined; }
How you handle the lawbreakers is up to you, but at a minimum it's best to stop everything on that note, as this situation breaks the assumption that every note on will have a corresponding note off.
In my case I'm using artificial events, so stopping them all is easy. I don't actually know how you'd go about stopping the normal events.
Give
Synth.allNotesOff()
a try, I know that doesn't affect notes with a timestamp in the future but I assume it works on stuck regular events.It would be nice if we got this built in similar to setfixnoteonafternoteoff