MidiInBlock Settings and Callbacks

Hallo!

First of all I have to congratulate you for the excellent software! I sold my Korg Kronos and I’m glad I don’t have to transport so much anymore. I am also very happy about the almost endless possibilities with the Gig Performer. Right now I’m programming a flexible basic setup, similar to an init combination from Korg.

Now I’ve run into a problem:
If you use a MidiInBlock callback like On NoteEvent, then you have to forward the event “manually” with SendNow. The MidiInBlock settings like “Transpose”, “Spilt”, etc. are ignored. It would be nice if there was the possibility of not triggering a callback at all, for example if the note is below the key- or velocity-split. Okay. I could enter them in the script again, but not e.g. the velocity Min. and Max, because I can’t query these values with e.g. GetMinVelocityFromMidiInBlock from the MidiInBlock.

Maybe I missed something.

Thanks and greetings,
Markus

Well, yes and no.

You can’t control whether there will be a callback based on velocity but you can specify note ranges for your callbacks.

For example, you can write

On NoteEvent (m : NoteMessage) Matching [C1..C2] from SomeBlock
   ///
End

and that callback will ONLY be called if you play a note in the range of C1 to C2. You can specify both ranges inside square brackets as well as individual notes, e.g.

On NoteEvent(m : NoteMessage) Matching G0, A1, [C1..C2] from SomeBlock

Constrained callbacks are very useful if you want to use a few notes as key triggers (say) but you don’t want to have to handle every other note of your keyboard.

Also, you can query those values. Just use the GetParameter function call. All those parameters have index numbers. For example, if you click the +/- beside the Transpose value, you’ll see briefly displayed on the top left of the plugin number the parameter number for Transpose (See picture below)

Thank you for the quick answer. I didn’t know about the GetParameter and the ParameterID until now. That’s already helped me, and I can move on.
I think it would make sense for the future to consider not only the event blocking parameters, but all settings of a MidiInBlock when calling or not calling the callback.

Lee - as soon as you choose to use a callback, the parameter settings in the plugin cannot play a part in the decision as to whether the callback should be called.

Consider, you write a callback that performs some interesting action — now you want to give it to someone else or use it somewhere else. But now your script is dependent on somebody correctly configuring the MidiInPlugin as well and so might simply break somewhere else.

That’s why we have the ability to query all the plugin parameters so you can now customize a script to work regardless of (or in conjunction with) the settings of the plugin.

dhj,
I beg to differ. The exact opposite is the case. For example, I can’t use the AutoSustain code because it would simply ignore my transpose, key- and velocity split settings of the MidiInBlock. Think about it

You may be on to something — it may be that there needs to be a version of SendNow (which the AutoSustainer also uses under the covers) that WILL in fact obey those parameters.

But that would not impact whether the callback is called — we would still always do the callback, but we’d process the RESULTS through the Transpose & Velocity. My partner has made that suggestion in the past.

@dhj I’m interested in this but clearly don’t understand Scripting well enough. This is what I want to do

On NoteEvent (m : NoteMessage) Matching G1, D2, A2, E3, B3, F#4, B4 from SomeBlock
///
End

Essentially from my Midi in only allow the above notes. I’m sure “SomeBlock” is generic? What else do I need to define?

SomeBlock has to be the handle of the MidiIn block that is generating the callback. As for your actual callback, given what you want, it would look something like this:

On NoteEvent (m : NoteMessage) Matching G1, D2, A2, E3, B3, F#4, B4 from SomeBlock
    SendNow(m)
End

Hmmm. I tried the reverse and included all the notes I didn’t want.

On NoteEvent (m : NoteMessage) Matching [E1…F#1], [G#1…C#2], [D#2…G#2], [A#2…D#3], [F3…A#3], [C4…F4], [G4…A#4], [C5…C8]
End

It worked. Not exactly sure why :slight_smile:

Assuming you did this in a rackspace script (not a scriptlet) the reason that worked is because you have no code for the notes hat you specified so GP won’t do anything.

No its a scriptlet. And works :slight_smile:

That will only work as long as you haven’t checked the Block unhandled messages option

screenshot_5343

Interesting. I honestly have no idea why and wish there was a place to learn more about this.

The script I sent you that works contains all the notes I DON’T want to trigger. I assume if I checked that box it would then block everything but not sure why it is blocking the ones I want it to (but it is :))

If you check that box, then other messages (CC messages, pitchbend messages, etc) will also get blocked

Thanks as always!!

When you create a callback event and specify a matching list, all items that match are handled through that callback — so if you don’t put anything in the callback to send the message OUT, nothing will happen.