Triggers are ways to set up a script to be executed. In CoyoteMIDI there are currently 2 ways to trigger a script. Translation executions, and the “run” button in the script editor.

 

The “run” button

When you open a script in the built in script editor in CoyoteMIDI, you will be able to trigger the script to run by clicking the “run” button in the top right. This will cause the script to run without any context information.

 

Translations

Translations can be set up to execute a script every time a translation is triggered. In the advanced options of a translation, the action can be set to “Script”, which will reveal a “Script” text input field in which you can specify the file path of your script, starting at the CoyoteMIDI scripts folder. For example, if your script’s file path is “C:\Documents\CoyoteMIDI\scripts\MyScript.cy” the required input for the Script field would be “MyScript.cy”.

A script that is triggered by a translation will have a built in script variable that provides context about the translation that triggered it. This variable comes in the form of a map object named $trigger with the following items inside of it: type, note, velocity, controlchannel, controlvalue, pitchbend, program, and device. For more information on map operations check out this page. the values inside this map can be read individually like so:

  • ($trigger type) – The MIDI event type that triggered the translation, such as “NOTE” or “CONTROLCHANGE”.
  • ($trigger note) – The note number of the MIDI event, in the case it was a NOTE event.
  • ($trigger velocity) – The note velocity value of the MIDI event, in the case it was a NOTE event.
  • ($trigger controlchannel) – The control channel number, in case of a CONTROLCHANGE event.
  • ($trigger controlvalue) – The control channel value, in case of a CONTROLCHANGE event.
  • ($trigger pitchbend) – The pitchbend value, if the MIDI event is a PITCHBEND event.
  • ($trigger program) – The program value, if the MIDI event is a PROGRAMCHANGE event.
  • ($trigger device) – The name of the MIDI device that triggered the translation.

 

RunScript command

Scripts can also be triggered to run with the RunScript command. This can be used for better organization and to create more dynamic scripts. Variables can be passed to the script that is being ran. More information on the RunScript command here.