Piano Roll

Author polyphonic note sequences in a piano roll editor.

What it does

Piano Roll is a tempo-synced note sequencer. A pattern of notes is drawn in a visual piano-roll editor and played back beat-for-beat against the project's BPM. Notes are held as four parallel lists, beat position, pitch, velocity and duration, one entry per note, so editing the pattern is editing those lists together.

Playback is polyphonic across four voices. Each note that turns on is assigned to the next free voice (first note on to voice 1, and so on), and each voice exposes its own note, velocity and gate outputs, enough to drive four independent synth voices, four particle emitters, or anything else taking a note-on/note-off stream.

When to use it

ParameterTypeDefaultWhat it does
triggerBoolean or Number—Rising edge restarts playback from beat 0
resetBoolean or Number—Rising edge resets all state and releases all voices
bpmNumber120Tempo in beats per minute
startsString""CSV beat positions for each note
pitchesString""CSV MIDI pitches 0-127 for each note
velocitiesString""CSV velocities 0-127 for each note
durationsString""CSV durations in beats for each note
pattern_lengthNumber0Pattern length in beats (0 = auto from notes)
loop_modeString"Loop"Playback loop mode. One of: Loop, Once, Ping-Pong.
velocity_scaleNumber1Global velocity multiplier
runBooleantruePlay/pause the piano roll

Gotchas

Notes live in four separate lists (starts, pitches, velocities, durations), matched up by position, so all four need the same number of entries. A start time without a matching pitch, velocity and duration will not play correctly.

Pattern Length at 0 derives the loop length from the notes. Raise it only to add trailing silence after the last note before the pattern repeats.

Only four voices are available. With more than four notes active at once, the newest active notes are still assigned voices in order, but there is no fifth voice to spill into. Keep patterns to four-note polyphony or fewer.

Trigger and Reset act on a rising edge only; holding either input high does nothing after the first tick. Trigger restarts playback from beat 0. Reset also clears all voice state, so use Reset to drop every gate immediately.

Worked example

  1. Add a Piano Roll. Open the piano-roll editor and draw a few notes. This fills in Starts, Pitches, Velocities and Durations.

  2. Set BPM to match the project tempo, and choose a Loop Mode (Loop, Once, or Ping-Pong).

  3. Wire Gate 1 and Note 1 into a synth voice's gate and pitch inputs to hear the pattern play back.

  4. Add more notes that overlap in time to hear Voice 2, Voice 3 and Voice 4 pick up the extra polyphony.

See also

Additive Synth · audio.wavetable · Envelope Follower · Numbers, signals & audio