Skip to content

Script Engine Overview ​

Neurode MIDI uses NeuroScript to express custom routing and transformation logic.

Quick Validation

Try the NeuroScript Simulator for quick, single-event tests without creating a full route.

What is the Script Engine? ​

The Script Engine lets you write custom MIDI transforms using NeuroScript. Each MIDI event enters your script, you optionally filter or modify it, and the runtime emits the resulting events deterministically.

How It Works ​

NeuroScript compiles to an immutable execution plan. Each event flows through the statements in your script with bounded execution time. If compilation fails, the route falls back to pass-through and the UI surfaces the error.

Quick Start ​

neuroscript
# Tame velocity peaks on channel-1 notes
when is note and channel == 1 and velocity > 110 {
  velocity = 110
}

State & Memory ​

NeuroScript persists deterministic state across events with state slots:

  • state route <name>: <Type> — one slot shared by the whole route.
  • state channel <name>: <Type> — one slot per MIDI channel.

Read with state.<name> and write with state.<name> = expr.

Example — drop everything after the 4th note on a channel:

neuroscript
state channel notes: Int = 0
when is note {
  state.notes = state.notes + 1
  when state.notes > 4 { drop }
}

Next Steps ​


Performance

The engine tracks per-event execution time. Keep scripts focused and avoid unnecessary work for best realtime performance.

Neurode MIDI for macOS, iPhone, and iPad