What Is a MIDI Track Transform Script?

A MIDI track transform script is a programmable tool used within digital audio workstations (DAWs) to systematically process, filter, and alter MIDI event data in a musical sequence. This article explains the core purpose of MIDI track transform scripts and details how they inspect, parse, and manipulate polyphonic note data—such as chords and overlapping melodic lines—to automate complex musical behaviors, voice assignments, and expressive timing adjustments.

Understanding MIDI Track Transform Scripts

A MIDI track transform script is an algorithmic sequence of instructions that intercepts, analyzes, and rewrites MIDI messages either in real time or offline. Found in DAWs via tools like Apple Logic Pro’s Scripter, Cockos Reaper’s JSFX, or Steinberg Cubase’s Logical Editor, these scripts operate directly on raw event arrays.

A standard MIDI data stream contains distinct status bytes and data bytes defining events such as Note On, Note Off, pitch number (0–127), velocity (0–127), and timestamp. A transform script listens for these incoming events, runs them through user-defined mathematical or logical operations, and outputs a modified MIDI stream to the instrument or track.

The Challenge of Polyphonic Note Data

Monophonic data consists of single notes played sequentially, making it straightforward to process. Polyphonic data, by contrast, consists of multiple distinct notes occurring simultaneously or with overlapping durations.

In a raw MIDI stream, there is no native "chord" event. A three-note chord is simply transmitted as three independent Note On messages with identical or near-identical timestamps. Because the MIDI specification processes messages linearly, a transform script must establish structural context to treat simultaneous events as a unified polyphonic structure rather than unrelated notes.

How Transform Scripts Process and Manipulate Polyphony

To manipulate polyphonic data, a transform script employs specific computational techniques to organize, evaluate, and alter concurrent notes.

1. Temporal Windowing and Chord Aggregation

To handle human performance variations where chord notes do not land on the exact same millisecond, scripts implement a time window (often 10 to 30 milliseconds). When the first Note On event arrives, the script buffers incoming notes during this window. Once the window elapses, the script groups these notes into an array representing a single harmonic unit (a chord) before executing transformations.

2. Pitch Sorting and Voice Allocation

Once a group of polyphonic notes is collected, the script sorts the array by pitch values from lowest to highest. This allows the script to identify specific chord roles:

3. Time Manipulation (Strumming and Arpeggiation)

Polyphonic scripts frequently alter the playback timing of grouped notes to create humanization or performance effects:

4. Harmonic and Interval Transformations

Scripts can evaluate the interval relationships within a chord array and rewrite the pitch values:

5. Independent Expression and Polyphonic Velocity

Before the widespread adoption of MIDI Polyphonic Expression (MPE), standard MIDI applied control change (CC) messages globally to all notes on a single channel. Polyphonic transform scripts overcome these limitations by dynamically mapping individual notes within a chord to separate virtual channels. This enables independent pitch bends, custom velocity curves, or filter envelopes to be applied to individual voices inside a single polyphonic performance.