-
-
Notifications
You must be signed in to change notification settings - Fork 38
Example: Send MIDI Note On when cue ends too
Sometimes people need to interface with systems that respond to Note On events, which as are sent when cues begin, but not to the Note Off events that are sent when the cues end. This shows how you can write a small amount of custom code to send Note On for both situations.
The first step is to set your cue’s Started On Beat message to Custom
. You can still use the cue dropdown menus to configure the Note and Channel that you want to use, because our code is going to be written to use the values you choose there.
As soon as you pick Custom
for the message, BLT will open an expression editor for the Started On-Beat Expression (unless you have already tried putting something into the expression; in that case, you can open the editor by choosing it in the cue’s context or gear menu). Here is the code you want to use in the expression:
(when midi-output
(midi/midi-note-on midi-output started-on-beat-note 127
(dec started-on-beat-channel)))
That is basically the same as the second example described in the Activation Expression section of the User Guide, except modified to work with the values that are available to Cue expressions.
You will then want to also paste the same code into the cue’s Ended expression (context or gear menu > Edit Ended Expression).
That way, the exact same MIDI note message will be sent when the cue ends as when it starts.
If you need a bunch of cues like that, you can add it to your cue library, and then create new ones based on that template, picking different notes in the dropdown menus as needed, and avoid having to type and paste the code each time.