Giving a rhythm pitch — by hand, from a scale, as chords, or generated. Eighteen scales, sixty-four chord types, and several ways to let the machine write the tune.

1. Notes by hand

A Sequencer's notes are consumed one per trigger and wrap when they run out, so you never need as many notes as steps:

(16 claveSon notes: #( 36 38 42 46 )) to: #perc.

Five triggers, four notes — the figure shifts by one each cycle, which is a cheap and musical source of variation. Give it exactly five and it repeats identically.

Many named rhythms take the notes inline as a string:

16 claveSon: '36 38 42 46' to: #perc.

1.1 Note names and the octave question

Where a string of notes is accepted, note names work as well as numbers. asMidiNote handles a generous range of spellings:

WrittenMeans
c4MIDI 60 — middle C in Coypu's reckoning
c#4 cs4Sharp — # or TidalCycles-style s
bb3 bf3Flat — b or f
c##4 cx4 css4Double sharp
cbb4 cff4Double flat
cNo octave digit defaults to octave 4
60A bare number passes through unchanged
Two converters that disagree by an octave Coypu has both asMidiNote and an older asMidiNN, and they do not agree: 'c4' asMidiNote is 60, while 'c4' asMidiNN is 72. The string notations used throughout this manual go through asMidiNote, so c4 means 60. If a melody lands an octave high, check which one you called.

2. Scales

A Scale is an array of semitone intervals from a root. Send the scale's name to the Scale class to get it:

Scale pentaMinor.      "#(0 3 5 7 10)"
Scale pentaMinor: 60.  "the same, rooted at middle C"

2.1 The eighteen scales

ScaleIntervalsNotes
major0 2 4 5 7 9 11The major scale
minor0 2 3 5 7 8 10 12Natural minor — see §2.3
pentaMajor0 2 4 7 9Major pentatonic
pentaMinor0 3 5 7 10Minor pentatonic
yo0 3 5 7 10Japanese yo, used in gagaku and shōmyō — identical to pentaMinor
blues0 3 5 6 7 10Minor pentatonic plus the flat fifth
bebop0 2 4 5 7 9 10 11Major with a chromatic passing tone
chromatic0 1 2 … 11Every semitone
augmented0 3 4 7 8 11Symmetrical, alternating minor and major thirds
gypsy0 2 3 6 7 8 10Hungarian/Romani minor, with its augmented second
flamenco0 1 4 5 7 8 11The Andalusian sound
persian0 1 4 5 6 8 11Persian
enigmatic0 1 4 6 8 10 11Verdi's scala enigmatica
istrian0 1 3 4 6From the Istrian peninsula, Croatia
hirajoshi0 4 6 7 11Koto tuning adapted from shamisen music by Yatsuhashi Kengyō
insen0 1 5 7 10A koto tuning differing from hirajoshi by one note
sakura0 1 5 7 8The Japanese in scale — koto and shamisen
domenico0 2 8 9 11The author's own

Every one has a rooted variant taking a MIDI note — Scale gypsy: 62 — and blues:octaves: spans several octaves at once.

2.2 Using a scale

A scale is just an array, so anything taking notes will take one:

"pick random notes from a scale"
(16 quavers notes: (8 randomNotesFrom: (Scale pentaMinor: 60))) to: #arpy.

fullScale expands a scale across the whole MIDI range, which is what you want when a generator needs room to move:

Scale pentaMinor fullScale.   "the pattern repeated up to 128 notes"

intoScale: goes the other way, mapping scale degrees onto pitches so you can think in steps rather than semitones:

#( 0 2 4 2 ) intoScale: #pentaMinor.

2.3 Two quirks worth knowing

minor includes its octave; nothing else does Scale minor is #(0 2 3 5 7 8 10 12) — eight elements, the last being the octave. Every other scale stops below it. When a generator picks uniformly from the array, minor therefore favours the root slightly and spans one note more than you might expect.
yo and pentaMinor are identical Both are #(0 3 5 7 10). The two names are kept for what they mean musically rather than for any difference in output — much as adowa and sikyi share a rhythm.

3. Chords

Chord list answers a Dictionary of 64 entries, from major to thirteen, each an array of intervals. Many are aliases — major/maj, minor7/min7 — so the number of distinct voicings is smaller than 64.

Chord list.        "inspect the whole table"
Chord traceList.   "print the names to the Transcript"

3.1 Chord notation

Chords are written as strings in root-quality form, separated by spaces. The root may be a note letter or a number:

'c-maj' parseChord.       "#(0 4 7)"
'd-min7' parseChord.     "rooted on D"
'12-sus4' parseChord.    "root as a semitone offset"

Send a whole progression to a Sequencer with chords::

(16 downbeats chords: 'c-maj a-min f-maj g-dom7') to: #piano.
FamilyExamples
Triadsmaj min aug diminished five
Suspendedsus2 sus4 sevensus2 ninesus4
Sixthssix six9 minor5
Seventhsmaj7 min7 dom7 diminished7 minMaj7
Extensionsnine eleven thirteen and their major/minor forms
Alteredsevenflat5 sevensharp5 sevenflat9 min7flat5
Chords make a polyphonic Sequencer chords: answers a SequencerPoly, which sends every note of the chord on each trigger rather than one at a time. Not every backend handles that the same way — SuperDirt gets one message per chord tone.

3.2 Arpeggios

arpeggiate: spreads the chord tones across successive triggers instead of sounding them together:

(16 semiquavers arpeggiate: '12-sus4 0-min') to: #psg.

The variant arpeggiate:octave: shifts the whole figure by octaves. Notes are laid out in chord order and then consumed one per trigger like any other note list, so the rhythm you choose decides the arpeggio's shape.

4. Generated melodies

4.1 Random walks

The difference between a random walk and random notes is that a walk moves by one scale degree at a time. It stays coherent where free choice sounds scattered:

(16 quavers notes: (8 randomWalksOn: Scale pentaMinor octaves: 2 root: 60))
  to: #arpy.
MessageGives
n randomWalksOn: scaleA walk within one octave of the scale
n randomWalksOn: scale octaves: oA walk across o octaves
n randomWalksOn: scale octaves: o root: rThe same, rooted at MIDI note r
n randomNotesFrom: arrayFree choice, no step constraint
n randomNotesFrom: array octaves: oFree choice, octave-displaced
n randomNotesIn: #( lo hi )Uniform between two MIDI notes, ignoring any scale
n randomNotes: #( lo hi )As above, by range

A Sequencer understands several of these directly, which avoids nesting the parentheses:

(16 quavers randomNotesFrom: Scale pentaMinor fullScale) to: #arpy.
(16 quavers withRandomNotesMin: 48 max: 72) to: #arpy.

4.2 Markov melodies

JazzMarkovMelody generates a line by weighted transitions between scale degrees rather than by stepping at random. Motion tends upward and stepwise, which sounds more deliberate than a walk:

gen := JazzMarkovMelody new.
melody := gen
  generateMelodyFromScaleDegrees: Scale bebop
  root: 60
  startDegree: 0
  length: 32.

(32 quavers notes: melody) to: #arpy.

The transition table is seven degrees wide and built in initialize, so it works with any seven-note scale. Feeding it a pentatonic will simply never reach the higher degrees.

melodyFrom: is the simpler relative: it generates notes from a scale and then nudges the note before each octave or second onto a more resolved degree.

(16 quavers melodyFrom: (Scale major: 60)) to: #arpy.

5. Transposing and progressions

MessageEffect
transpose: nShift a Sequencer's notes by n semitones
progression: intervalsRepeat the Sequencer once per interval, transposed each time
+ n / − nArithmetic transposition; + answers a copy
randomOctaves: nDisplace each note by a random number of octaves
"a I–vi–IV–V from one bass figure"
(16 tumbao notes: #( 36 43 )) progression: #( 0 9 5 7 ); to: #bass.

"shift a whole part after the fact"
#bass transpose: -12.
Progressions multiply length progression: #( 0 9 5 7 ) makes the part four times longer. Against 16-step drums that gives a four-bar harmonic cycle for free — but be aware which of your parts are long, or they will seem to drift.

6. Where to go next

DocumentWhat it covers
Rhythms: AdvancedMondo notation, where pitch and rhythm are written together.
Pattern OperatorsThe conversion messages behind these notations.
Effects & MixingShaping how these notes sound.
GalleryMelodic patterns worth stealing.

7. Troubleshooting

My melody is an octave higher than expected

Probably asMidiNN rather than asMidiNote — they differ by twelve. §1.1.

Fewer notes are sounding than I supplied

Notes are consumed one per trigger, not per step. A pattern with four triggers uses four notes however many you give it, and the rest wait for the next cycle — §1.

The scale sounds right but one note keeps recurring

If it is minor, the octave is in the array twice over — as 0 and as 12 — so uniform picking favours the root. §2.3.

A chord plays only one note

The backend may not handle polyphony the way SequencerPoly sends it. Try arpeggiate: instead, which needs nothing special — §3.2.

parseChord raises an error about an invalid chord

The quality is not in Chord list. Check spelling against Chord traceList; the names are lowercase and unhyphenated — min7flat5, not m7b5.

The Markov melody sounds stuck

Its table covers seven degrees. On a five-note scale the higher transitions fall outside the array and the line stays low — give it a seven-note scale — §4.2.