Scriptlet to Pass Only One Type of MIDI Event

Hi.

I wonder if someone could show me how best to code a scriptlet that will pass just one type of MIDI event, blocking all others.

My immediate interest is in passing only Song Select messages, but might as well have a clear general template/solution.

Did you try the MIDI filter plugin?

Song Select is not a type found in the MIDI filter plugin.

In any case, this is a scripting question.

My impression is that it’s probably just a few lines. Someone who knows which few lines could really boost me here!

The general On MidiEvent callback can just process the event you want. If you don’t send out the other events then it should block them.

1 Like

Haven’t tried it but this should work

On MidiEvent(m : MidiMessage)
   var
      kind : integer = GetByte(m, 0)
      
   if kind == 243  // 0xF3
       then SendNow(m)
   end     
End
1 Like

Yes, but you could filter out all other messages.

1 Like

Thanks to all who replied. David’s code works great!