Is there a clever way to deal with overlapping MIDI notes?
-
Hi HISE Community,
I have written a Hise script that manipulates MIDI notes.
This means that I can trigger the same MIDI values with different keys on my MIDI keyboard.This leads to the problem that if I press two or more keys on my MIDI keyboard that trigger the same MIDI value, that when I release one of the keys, the note is completely gone, even though I still press the other key.
I use the Message object to manipulate the incoming MIDI notes andMessage.sendToMidiOut
to pass the manipulated notes to the next plugin.Any suggestions for solutions, perhaps with an example script/snippets.
Would be quite helpful -
@WillDevelop You can keep track of different events using their event Id
-
@WillDevelop I have tested that and can not get it to work, as soon as I trigger the same note on event as the active note, it will kill the first active note.
It seems to be an inbuilt safety function in Hise (only guessing here)
I have not tested it using sendToMidiOut(), maybe that will work, I guess it depends on how the "receiving" daw, plugin, handles it.
Inside Hise I can get it to work using the Synth.addPitchFade(), but that will not be applied to what
Message.sendToMidiOut();
sends out, it will still send the actual pressed key
this is an example using the pitch fade function
HiseSnippet 1445.3oc6X80aSbDD+NmbsXCEAUzpp9zJTExQJ0xWZHlTZKNI1lZQLwM1D5KUnM2M1dEm285c6EvBgDpeAZ+H0OB8iBuzmSmcuy9tKwABVfZKB+PT1Ym+761cleybW2.gCDFJBLLK1ehOXXdIqdS3xQ6Lhx3FsaXXdYqNzPIDPhEs8DeZXH3ZXZtzcUBLKtrg92Kuy1TOJ2AREYXbff4.6xFyjoR6V+dLOuVTWnOabFsWudaGAeGgmHBwyRVUM7oNOlNDtOUoVAKCyOpoKSJB5IoRHzvb4sEtS5MR7Ddr9GvBYG5ApE1F8PGEKtkvyUgXkTicFw7b6N84Nzvvzpa5ovRwmBWypCykMSd5owUzaPRsH64gYg7vaobvyNK7plAdyARlYfzxwP5pV8bBX9xzcT34hVs43ky.JdrmEJw5ZT32KXsi.0fKqLl9XnU.tXlEk2nZ0UI3eV41kJE.CIiwmscYgRx2SZxGx3PEm..eV5jHurRwRCh3NRlfSD76Kjvd7xqT5YkJ1AQEdYUgMjKBflGgwrrLHBPaJVpnmvg5Q3nmmp2PPpL+9QiODBJ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KsI3n+0K+gIaBQn57YD7dIa8m1L2kbkycFgibOgxcMww+e+nAsgwj5Lv51vt1vS7ARofpJdWMXuasY1FhW9Y3megZ36I7KTKnPXxIcWmK0kaVEu.62WHA3jsH8VpjmfuSzB1fZxjp4UUvLqWpqiM+moonrXcJbKzY2agNEuE5T5Vnyd2BcJeKzoxGTGLOTvMUDFN.BNqoH8ahDMESwKhBU9+3x1OzF
-
I have found a simple solution with the MidiList object:
- When a Note On command comes in, then in a MidiList the index of the pressed key is set to the value of the note that is output. e.g. I press key 60 which is not active but only the next key so "60 -> 61" is stored in the MidiList.
- When a Note Off command comes in, before the Note Off command is sent, it is first checked whether another key also has this value
- If no key has this value, a Note Off command is sent for the note and the key is set to -1 in the MidiList.
- If one or more keys have this value, the NoteOff command is not sent
onInit()
reg midiKeyList = Engine.createMidiList();
onNoteOn()
const receivedNote = Message.getNoteNumber(); var outputNote = getOutputNoteBySnapMode(receivedNote); midiKeyList.setValue(receivedNote, outputNote); sendNoteToMidiOut(outputNote);
onNoteOff()
const receivedNote = Message.getNoteNumber(); var outputNote = getOutputNoteBySnapMode(receivedNote); midiKeyList.setValue(receivedNote, -1); // set pressed Note in midiList to -1 if (midiKeyList.getValueAmount(outputNote) <= 0) { sendNoteToMidiOut(outputNote); }
I hope you can understand it.
Thanks guys