MIDI Agent System


My current music project is the development of software that uses the interaction between different agents to generate MIDI notes. This is designed primarily for live use and it enables the performer to change the parameters of the agents that are generating the music in real time. For example, one agent can generate random bar markings, a second can add sequences of notes to these bars, a third can change the velocities of notes in the bars and a fourth can shift the pitches up or down. Many of the agents have knobs that can be set to respond to MIDI controllers and by varying the parameters of the agents it is possible to have real time control over very complex music. This software is written in Java and should run on any operating system. A screenshot is shown in Figure 1.

MIDI Agent System screenshot

Figure 1. MIDI Agent System


The software uses a sliding buffer to hold the MIDI notes and messages generated by the agents. At each beat the buffer advances and the agents associated with each track are invoked to make their contribution to the buffer until they have all completed their tasks. The buffer is then advanced and the notes are written to MIDI tracks that are played by the sequencer (see Figure 2). The agents are dynamically loaded at runtime and new agents can easily be created by extending the agent class.

MIDI Agent System operation

Figure 2. The operation of the MIDI Agent System


The agents that I have implemented are listed in Table 1.

Name Description
Bar Marker agent
Bar Marker
Writes agent messages that mark the beginning and end of bars. This agent can generate sequences of bars of different lengths - for example 3/4, 4/4, 2/4 etc. - or random bar lengths. A MIDI controllable knob can be used to vary the maximum bar length.
Basic Notes agent
Basic Notes
Generates sequences of notes with different positions and lengths. Can be set to restart its sequence at the beginning of each bar.
Copy agent
Copies notes from one track to another with an optional delay.
Note Emphasis agent
Note Emphasis
Increases or decreases the velocity of notes at set positions. Can be set to restart at the beginning of each bar.
Piano Roll agent
Piano Roll
Traditional piano roll that enables the user to enter and edit notes.
Pitch Inverter agent
Pitch Inverter
Inverts the notes around the specified pitch.
Pitch Shifter agent
Pitch Shifter
Shifts the pitch of notes up or down by a fixed amount set by a MIDI-controllable knob or continuously increases or decreases the pitch.
Prolong Notes agent
Prolong Notes
Stores note-off messages when the button is pressed, so that all notes are prolonged until the button is pressed again.
Random Eater agent
Random Eater
Randomly deletes notes. The probability of this happening is set by a MIDI-controllable knob.
Simple Notes agent
Simple Notes
Generates a sequence of notes repeating at a particular frequency and pitch without any control from the Bar Marker agent.
Simple Random agent
Simple Random
Randomly generates notes with a specified frequency, pitch range and note length range. The probability of a note being generated is set by a MIDI-controllable knob.
Time Inverter agent
Time Inverter
Creates a mirror image of the notes in the buffer. Can be set to mirror alternate buffers.

Table 1. Agents in the MIDI Agent System


A short user manual is available: mas_manual_3.0.pdf.


The current version is available as source code (mas_src_3.0.zip) or as a Windows installer (mas_setup-3.0.exe).