Skip to content

Event Model ​

Understanding MIDI events in NeuroScript.

Event Fields ​

In NeuroScript, you work directly with MIDI event fields using simple identifiers:

Note Events ​

text
note        # Note number (0-127)
velocity    # Velocity (0-127)
channel     # Channel (1-16)

Control Change (CC) Events ​

text
controller  # CC controller number (0-127)
value       # CC value (0-127)
channel     # Channel (1-16)

Other MIDI Events ​

text
bend        # Pitch bend value
program     # Program change number (0-127)
pressure    # Aftertouch pressure (0-127)

Event Types ​

NeuroScript automatically handles different MIDI message types:

Event TypeAvailable FieldsDescription
Note On/Offnote, velocity, channelNotes pressed/released
Control Changecontroller, value, channelController movements
Pitch Bendbend, channelPitch wheel changes
Program Changeprogram, channelInstrument selection
Aftertouchpressure, channelChannel pressure

Common CC Numbers ​

CCNameTypical Use
1Mod WheelVibrato, modulation
7VolumeChannel volume
10PanStereo position
11ExpressionDynamic expression
64Sustain PedalHold notes (0-63 = off, 64-127 = on)
74Filter CutoffBrightness
91ReverbReverb send level

Working with Events ​

Reading Values ​

neuroscript
# Filter by note range
when is note and note in 60..72 {
  velocity = clamp(velocity + 5, 1, 127)
}

Modifying Values ​

neuroscript
when is note {
  note = clamp(note + 12, 0, 127)   # transpose
  velocity = clamp(velocity, 40, 100)
  channel = 2
}

State Access ​

neuroscript
# Read the cached value of CC7 on the input channel
when is note and cc(7) > 100 {
  velocity = clamp(velocity + 20, 1, 127)
}

Next Steps ​

Neurode MIDI for macOS, iPhone, and iPad