Skip to content

MIDI Blocks

Domenico Patella edited this page Apr 11, 2025 · 5 revisions

MIDI Blocks represent our interface with the hardware controller

In general, all blocks (Internal Plugins) to be used within scripts must have an alias (handle). As far as MidiDevices are concerned, the handle is associated in the Rig Manager when it is inserted in the device list. For all other blocks, handles are instead declared in the Rackspaces

The types of Midi blocks are as follows.

  • MidiInDevice
  • MidiInBlock
  • MidiOutBlock

MidiInDevice It is created with the alias name in the rig manager. In this example, “touch” represents the alias of the TouchOSC Brige controller.

MidiDevice

💡 Tip:
Controllers can also be software interfaces, in this case TouchOSC Bridge emulates a MIDI device used with TouchOSC application

If we insert the declaration of this variable within GIG Script the variable name must be the same as that declared in the Rig manager

/******************************************************
//
// GiG Script
// 
******************************************************/

var touch : MidiInDevice // Midi device alias

Initialization
	
	Print("Gig script ")
	
End

var touch is a reference to the Midi device created in the Rig manager

  • MidiInBlock
  • MidiOutBlock

These blocks refer to the pluglins inserted during Rackspace wiring. They are associated with the pluglin name entered in the Handle field

Midi1

💡 Tip:
MidiBlock OMNI receive message for each MIDI devices that are connected The menu shows a list of devices we can use, and we can choose a specific Midi device instead of an OMNI block.

MidiDevice 3

These blocks can be insert in Global Rackspace or Current Rackspace

Scope and Visibility

Both MIDI blocks and the associated callback functions can be inserted according to the scope of the script

MIDI block summary

Type GiG Global Current Scriptlet Song
MidiInDevice Y N Y Y Y
MidiInBlock N Y Y N N
MidiOutBlock N Y Y N N

Summary of MIDI callback functions in Scripts

Event Type of Message GiG Global Current Scriptlet Song
MidiEvent MidiMessage Y Y Y Y N
NoteEvent NoteMessage Y Y Y Y N
             
NoteOnEvent NoteMessage Y Y Y Y N
NoteOffEvent NoteMessage Y Y Y Y N
ControlChangeEvent ControlChangeMessage Y Y Y Y N
PitchBendEvent PitchBendMessage Y Y Y Y N
AfterTouchEvent AfterTouchMessage Y Y Y Y N
PolytouchEvent PolyTouchMessage Y Y Y Y N
ProgramChangeEvent ProgramChangeMessage Y Y Y Y N
SysexEvent SysexMessage Y Y Y Y N

Callback Functions

GPScript provides a generic MidiEvent function that uses a MidiMessage object to process any type of MIDI message
Another generic function NoteEvent that uses a NoteMessage object responds for any type of message containing only notes

If we want to process a specific MIDI message, we have callbacks
ControlChangeEvent PitchBendEvent AfterTouchEvent PolytouchEvent ProgramChangeEvent

If we want to process a MIDI message containing notes, we have the callbacks NoteOnEvent NoteOffEvent

The SysexEvent function only responds to messages of type SysexMessage

MidiEventand NoteEvent functions are only activated if there are no specific callbacks

/******************************************************
//
// Gig Script
//
******************************************************/
var touch : MidiInDevice

Initialization
	
	Print("Hello")
	
End


// MIDI/NOTE/SYSESX Message


On MidiEvent(m : MidiMessage) from touch 
	Print ("GiG Script MidiEvent")	
End

On NoteEvent(m : NoteMessage) from touch
	Print ("GiG Script NoteEvent")	
End

On SysexEvent(s : SysexMessage) from touch 
	Print ("GiG Script SysexEvent")	
End

The from keyword is needed to indicate from which device the events are to be received

💡 Tip:
from keyword is not present in scriptlets because the MIDI source is implicit in the connection to the MIDI block during wiring

image

On NoteEvent(m : NoteMessage) 
	Print ("Scriptlet NoteEvent")	
End

Clone this wiki locally