Trying to delay a PC message. I want to catch whatever PC message is coming out of the ZSYNTHPC13 midiIn block and delay it. Script compiles, but as I’m looking at the midi monitor, I don’t see any delay. What am I doing wrong? Still very much learning scripting… Thanks!
var
ZSYNTHPC13: MidiInBlock
programChange: integer
On ProgramChangeEvent (m : ProgramChangeMessage) from ZSYNTHPC13
programChange = GetProgramChangeNumber(m)
ZSYNTHPC13.SendLater(m, 500)
End
Please open additionally the global MIDI Monitor.
There you see the incoming MIDI messages and the you should see the delayed MIDI message in the other MiDI monitor.
Nothing is showing up there at all related to these PC messages. The ZSYNTHPC13 in the script is a virtual midi in block. When I manually turn the widget producing the initial PC messages (that are supposed to be “caught”) are not showing up in the global midi monitor either. But the PC are working. The script just isn’t making any difference at all. Does it look right to you?
I’ve got a multi in Kontakt that I use PC to select sounds from. Problem is, the “unbypass” and PC messages are being sent at the same time and Kontakt goes to the wrong preset. All other plugins have no problem getting the PC message and getting the bypass turned off, but Kontakt is. If I manually send the PC message AFTER its already bypassed, it works fine. So the PC message must be delayed that is being sent at the same time as the un-bypass command. Thanks!
Here you go. I just put the basics in there. The widget that produces the PC messages and the midiIn block with Kontakt (or any other plugin…not really needed). What I would like to happen, is when the widget is turned and PC messages are produced, those messages would be “caught” and sent out delayed. Even if there are 2 PC messages (original + delayed on) is OK. Although if this script only send the delayed one, even more elegant.
Thanks!
This is because the widget sending the PC message is assigned to the MIDI out.
Therefore your script is not executed at all.
The widget is now mapped to the “Dummy” MIDI In (OSC).
The ZSYNTHPC13 has checked “Enable MIDI Merge”
And now the script is executed.
And YES: A scriptlet would work also.
And with a scriptlet with parameters you can decide the delay length vie Widgets mapped to exposed scriptlet parameters.
var VDelay : parameter 0..1000 = 500
//Called when a program change message is received
On ProgramChangeEvent(m : ProgramChangeMessage)
SendLater(m,VDelay)
End
This one is my favorite solution as its simple, clean and can be immediately available if other plugins need it. Thank you!
I would still like to understand and learn why my brain wasn’t getting the script solution. You said it wasn’t working b/c the widget is sending the PC messages to the midi out port. BUT! The script says get PC messages FROM midi block, (which in my brain anyway) would expect it to come from the midi out. So I would expect the script to be looking for PC messages coming FROM the midi out of the midi block.
In reality, what is happening is even though the script language says On ProgramChangeEvent …FROM XYZ midi block, it is really looking for ProgramChangeEvent going INTO XYZ midi block. So perhaps I’m being too literal, but this is confusing to me. Thank you for explaining why it wasn’t working!
OK, the widget mapped to PC messages and the MIDI In block sends the pc message to the MIDI Out of the MIDI Block.
A script call back reacts on incoming Messages and not on outgoing.
Yeah I get it now. Perhaps the code language would be more accurately descriptive if it said “On ProgramChangeEvent… IN” midi block, not “FROM”. At least to newbies