Message.delayEvent() for humanization/chord strumming
-
Okie dokie I'm at the point where I'm adding all sorts of features the end user will probably never use:
global humanizationLeft = 0; // This one variable is shared between multiple midiProcessors to ensure they are all delayed together. function onNoteOn() // Global { humanizationLeft = Math.randInt(0, 2000); } function onNoteOn() // midiProcessor-specific { Message.delayEvent(humanizationLeft); } function onNoteOff() // midiProcessor-specific { // To handle stuck notes Message.delayEvent(humanizationLeft + 1); }
I'm still getting hanging notes, should I remove the
+1
from the noteOff? Or am I approaching it wrong?I've also tried
Synth.setFixNoteOnAfterNoteOff(true)
in each midiProcessor but it didn't seem to help either :man_shrugging: -
@iamlamprey You need to move your entire MIDI processing to a parent container, catch the delayed notes in the onNoteOff there and have them not play if the key isn't down.
If you want to humanize the note off as well, you have to make sure that the note off goes off after the note on. So definitely add more than just one sample.
If you want to know more about the delayed message flow, read my posts in this thread https://forum.hise.audio/topic/9244/how-to-delay-note-on
-
Not sure what you're doing wrong, but the
Synth.setFixNoteOnAfterNoteOff()
is precisely for this use case and should work like in this example that delays note ons by a second and prevents hanging notes if you press the key shorter than a second.HiseSnippet 910.3oc2V0saaaCElx1pX1cqncnnnWJLrKbAJJraS6FvtnIwwtvX0IFQo+bWAC0QwDghTihxsFE6cbOJ8MX6PJ6JoFiTGitUr5KLz4OxOdNemC4TshAYYJMwq8IKRAh226GtPZlMXFkKIiOf3cC+IzLCnCJTs+hTZVFDQ77Z9LqBu1sHtee3o6SETICJUQHuTwYvy4IbSo1o696bgXDMBNgmTw6c1cLSIGnDpbDOM86QRoryomAGRst0vm3csgQbiRGZnFHC8YeUzhvYp2JK7+k7L9oBvJzmDhKTgZxfYbQzzUm0LBwyeZ4IuYwI+19S3Q7OpuLCbSmgfxHplC7ZbYPp+U.RdUfTqBHcK+PllmZJsXwy08GKwBRLES0UgRgujF+jm+.E5gz7fD54vHMJ7wH59jd8te.9289sNtJ8ChfXPOfJDmhY6rtwTQFfF6rzbFXFwe2gJCbjbuXbUbeFG20nys9EmKYFtRFnjEN08dc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