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 ​

neuroscript
# Access note fields
note        # Note number (0-127)
vel         # Velocity (0-127)
ch          # Channel (1-16)

Control Change (CC) Events ​

neuroscript
# Access CC fields
cc          # CC controller number (0-127)
value       # CC value (0-127)
ch          # Channel (1-16)

Other MIDI Events ​

neuroscript
bend        # Pitch bend value (-8192 to +8191)
prog        # Program change number (0-127)

Event Types ​

NeuroScript automatically handles different MIDI message types:

Event TypeAvailable FieldsDescription
Note On/Offnote, vel, chNotes pressed/released
Control Changecc, value, chController movements
Pitch Bendbend, chPitch wheel changes
Program Changeprog, chInstrument selection
Aftertouchvalue, chChannel 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
keep note where note >= 60 and note <= 72

# Check velocity
keep note where vel > 80

Modifying Values ​

neuroscript
# Transpose notes
event(note = clamp(note + 12, 0, 127))

# Clamp velocity
event(vel = clamp(vel, 40, 100))

# Change channel
event(ch = 2)

State Access ​

neuroscript
# Read last CC value (from MIDI state)
when cc(7) > 100: event(vel = clamp(vel + 20, 1, 127))

Next Steps ​

Built with ❤️ for musicians