Midifilter - trying to filter one (specific) NoteOn/Note Off


I’m wondering if it’s possible to get a VST plugin to filter a particular MIDI note from the input MIDI stream.

(I imagine it IS possible - I just don’t know HOW )

I’m currently using an iterator to traverse the buffer, inspecting each message, and I can identify the one I want - but I’m not sure how (if!) I can delete that, so that plugin’s receiving my output won’t receive the offending NoteOn/Note Off I’m trying to filter-out.

I thought I could just delete one message from the MidiBuffer - but MidiBuffer.clear doesn’t seem to let me do that (I tried midiMessages.clear(itemToDel, 6); but I’m not absolutely sure what the itemToDel number should be (the documentation says “event position” but also talks about deleting messages between 2 times…) I looked at the code, but my head started to hurt :shock:

{BTW - I was trying to be a good boy, and tryed to delete them outside where the iterator was in use, by building a little list of offending message-indexes, and deleting them outside the iterator-loop - But that didn’t work either}


Yeah, the midibuffer is designed to be compact and easy to add to, but not really for insertion/deletion. I’d suggest using a second buffer, copying any notes that you want to keep to the second one, then swapping them over at the end.

The start/end parameters to clear() are the event timestamps, not the indexes - it doesn’t have any index-based deletion.


Thanks and OK. I thought about doing something like that, but I wasn’t sure. I’ll give it a go


Peachy :slight_smile: