May this site count your visit with Google Analytics? It sets cookies and is used only for visit statistics. Privacy →

Step 03 of 11

Notes and chords

Octaves, basslines, chords and inversions, chords from notes (with the keyboard explorer), melody, scales and arpeggios.

3.1Notes and octaves: where each part belongs

Music uses seven letter names, A B C D E F G, and then starts again. The distance from one note to the next note with the same name is an octave: the higher note vibrates exactly twice as fast and sounds like the same note, only higher. That is why every note name in Strudel ends in a number. You will use these numbers in every lesson from 3.2 Bassline on.

A note name like a2 is the note plus an octave number. Each step up doubles the frequency: a1 = 55 Hz, a2 = 110 Hz, a3 = 220 Hz, a4 = 440 Hz (concert A). The number changes at C, so b3 is directly below c4, and c4 is middle C.

OctaveRangeWhat lives here
c0–b016–31 HzToo low for most speakers. Avoid it.
c1–b133–62 HzSub-bass: 808 bass, the low end of a kick drum. You feel it more than hear it; laptop speakers barely play it.
c2–b265–123 HzBass: basslines, bass guitar, low synths
c3–b3131–247 HzLow-mid: lower chord notes, piano left hand, cello
c4–b4262–494 HzMiddle: chords, pads, singing range, main melodies
c5–b5523–988 HzHigh: lead synths, high melodies, arpeggios
c6–b61–2 kHzTop: bells, glockenspiel, sparkles

Good octaves for each part

PartOctaves (Strudel)ExampleTips
808 / sub bass1note("a1").s("sine")Use a simple wave (sine) and only one note at a time. Leave the kick room, or make the two hit at different moments.
Bassline1–2note("a1 a2").s("sawtooth")Mostly the root note of each chord. A bass guitar's lowest note is e1.
Chords, pads3–4chord("Am7").voicing()Below c3, chords sound muddy. voicing() keeps the top note at or below c5 automatically.
Melody, lead4–5.scale("A4:minor")Keep it above the chords so it stands out.
Arpeggios, bells5–6.scale("A5:minor")Use them quietly, as decoration.

The example below plays every register at once. Each layer uses the same progression, so they all fit together. .rootNotes(1) takes each chord's root note in octave 1, so the bass follows the chords without your writing the notes out.

Strudel · registersOpen in Strudel ↗
setcpm(100/4)
const prog = "<Am7 F^7 C^7 G7>"

// octave 1: sub bass (felt more than heard)
$: prog.rootNotes(1).note().s("sine").gain(.8)
// octave 2: bassline
$: prog.rootNotes(2).note().struct("x ~ x x ~ x x ~")
  .s("sawtooth").lpf(700).decay(.15).sustain(0)
// octaves 3-4: chords
$: chord(prog).struct("[~ x]*2").voicing().s("gm_epiano1").gain(.6)
// octave 4: melody
$: n("0 2 4 2").scale("A4:minor").s("triangle").gain(.5)
// octaves 5-6: sparkle
$: n("[0 2 4 7]*2").scale("A5:minor").s("gm_glockenspiel").gain(.25)

Moving a part up or down

GoalCode
Whole part one octave down.transpose(-12)
Whole part one octave up.transpose(12)
Scale melody in another octave.scale("A3:minor")
Chords lower.anchor("c4").voicing() (anchor must come before voicing())
A note with no number"c" means c3

3.2Bassline

note() takes pitches with octave numbers. "<a1 f1 c2 g1>" plays one root note per bar, which gives the four-bar progression A, F, C, G. .struct() supplies the rhythm: each x is a hit. The sawtooth synth goes through a low-pass filter (lpf), and decay with sustain(0) makes each note short and plucky.

Strudel · lesson 3.2Open in Strudel ↗
setcpm(124/4)

$: s("bd*4").bank("RolandTR909")
$: s("~ cp ~ cp").bank("RolandTR909")
$: s("[~ oh]*4").bank("RolandTR909").gain(.4)
$: s("hh*16").bank("RolandTR909")
  .gain("[.25 .5]*8")
  .sometimesBy(.2, x => x.ply(2))

$: note("<a1 f1 c2 g1>")
  .struct("x ~ x x ~ x x ~")
  .s("sawtooth")
  .lpf(500)
  .decay(.15).sustain(0)

Listen for

The bass changes note every bar and repeats every 4 bars.

Try changing

  • .lpf(1200) for a brighter sound
  • .s("square")
  • .struct("x(5,8)")

3.3Chords

chord() reads chord symbols; ^7 means major seventh. .voicing() turns each symbol into notes and keeps them close together, so the chords move smoothly. .struct("[~ x]*2") places stabs on the off-beats. gm_epiano1 is the General MIDI electric piano, and .room(.5) adds reverb.

Strudel · lesson 3.3Open in Strudel ↗
setcpm(124/4)

$: s("bd*4").bank("RolandTR909")
$: s("~ cp ~ cp").bank("RolandTR909")
$: s("[~ oh]*4").bank("RolandTR909").gain(.4)
$: s("hh*16").bank("RolandTR909")
  .gain("[.25 .5]*8")
  .sometimesBy(.2, x => x.ply(2))

$: note("<a1 f1 c2 g1>")
  .struct("x ~ x x ~ x x ~")
  .s("sawtooth")
  .lpf(500)
  .decay(.15).sustain(0)

$: chord("<Am7 F^7 C^7 G7>")
  .struct("[~ x]*2")
  .voicing()
  .s("gm_epiano1")
  .room(.5).gain(.6)

Listen for

The chords follow the same A, F, C, G roots as the bass.

Try changing

  • .s("piano")
  • .struct("x ~ ~ x ~ ~ x ~")
  • "<Dm7 G7 C^7 A7>" (also change the bass)

Going deeper: chord inversions

A chord's notes can be stacked in different orders. C major in root position is C-E-G. Move the bottom note up an octave and you get the 1st inversion, E-G-C. Do it again for the 2nd inversion, G-C-E. It's the same chord with a different color. Inversions let you change chords while each note moves only a little ("voice leading"), which sounds smooth instead of jumpy.

Listen for the difference: bars 1–4 play every chord in root position, and bars 5–8 play the same chords with inversions.

Strudel · root position vs inversionsOpen in Strudel ↗
setcpm(90/4)

// bars 1-4: root position, every chord starts on its root and jumps around
$: note("<[a3,c4,e4] [f3,a3,c4] [c4,e4,g4] [g3,b3,d4]>")
  .s("gm_piano").mask("<1 1 1 1 0 0 0 0>")
// bars 5-8: inversions, the notes barely move
$: note("<[a3,c4,e4] [a3,c4,f4] [g3,c4,e4] [g3,b3,d4]>")
  .s("gm_piano").mask("<0 0 0 0 1 1 1 1>")
What you wantStrudel
Smooth chords chosen for youchord("<Am F C G>").voicing() picks inversions automatically
Root positionchord("C").mode("root").anchor("c3").voicing() → C3 G3 C4 E4
1st inversionchord("C").dict("triads").mode("above").anchor("e4").voicing() → E4 G4 C5
2nd inversionchord("C").dict("triads").mode("above").anchor("g4").voicing() → G4 C5 E5
Open (spread) voicingWrite the notes: note("[c3,g3,e4]")
Drop voicingWrite the notes: note("[b3,c4,e4,g4]")
More notes, stacked upWrite the notes: note("[c4,e4,g4,c5,e5]")
Any shape you likenote("[e3,g3,c4]")

In Strudel, dict, mode and anchor must all come before .voicing(). After it, they have no effect.

Choosing the inversion of each chord

The easiest way to control inversions in Strudel is to choose the lowest note of each chord. .dict("triads") gives plain three-note chords. .mode("above") builds each chord upward from the anchor note, so the anchor becomes the bass note. That decides the inversion:

  • Lowest note = the root (C in C major): root position
  • Lowest note = the third (E in C major): 1st inversion
  • Lowest note = the fifth (G in C major): 2nd inversion

Musicians write this as a slash chord: F/A means "F major with A in the bass", which is F's 1st inversion. Give anchor one note per chord, in the same rhythm as the chords.

Strudel · one chord, three inversionsOpen in Strudel ↗
// C major: root position, 1st inversion, 2nd inversion
// the anchor is the lowest note: C4 → C4 E4 G4, E4 → E4 G4 C5, G4 → G4 C5 E5
chord("<C C C>").dict("triads").mode("above")
  .anchor("<c4 e4 g4>")
  .voicing().s("gm_epiano1")
Strudel · a progression with chosen inversionsOpen in Strudel ↗
setcpm(90/4)

// Am     → A3 C4 E4  root position
// F/A    → A3 C4 F4  1st inversion
// C/G    → G3 C4 E4  2nd inversion
// G/B    → B3 D4 G4  1st inversion
$: chord("<Am F C G>").dict("triads").mode("above")
  .anchor("<a3 a3 g3 b3>")
  .voicing().s("gm_piano")
// the bass plays the same lowest notes an octave down: A A G B
$: note("<a2 a2 g2 b2>").s("gm_acoustic_bass")
Strudel · two chords per barOpen in Strudel ↗
setcpm(90/4)

// bar 1: Am, then F/A · bar 2: C/G, then G
// chords and anchors use the same [ ] grouping, so each chord gets its own bass note
$: chord("<[Am F] [C G]>").dict("triads").mode("above")
  .anchor("<[a3 a3] [g3 g3]>")
  .voicing().s("gm_epiano1")
$: note("<[a2 a2] [g2 g2]>").s("gm_acoustic_bass")
Strudel · inversions with rhythmOpen in Strudel ↗
setcpm(100/4)

// the struct gives the rhythm, the anchor picks the inversion for each bar:
// Am (root) · Dm/A (2nd inv) · G/B (1st inv) · C (root)
// "triads" only has three-note chords, so use Am, Dm… not Am7, Dm7…
$: chord("<Am Dm G C>").dict("triads").mode("above")
  .anchor("<a3 a3 b3 c4>")
  .struct("x ~ x ~ ~ x ~ x")
  .voicing().s("gm_epiano1").room(.4)
$: note("<a2 d2 g2 c2>").s("gm_acoustic_bass")
$: s("bd ~ sd ~, hh*8").bank("RolandTR909").gain(.6)

3.4Chords from notes

In lesson 3.3, chord("Am7").voicing() picked the notes for you. Here you write every note of the chord yourself. It takes longer, but you decide exactly which keys sound: the octave, the order, extra notes. That's how the Bach prelude (11.5) is written.

The one rule: commas mean "at the same time"

WriteYou hear
"c4 e4 g4"Three notes one after another: a melody
"[c4,e4,g4]"Three notes at once: a chord
"<[c4,e4,g4] [a3,c4,e4]>"One chord per bar: a progression
"[c4,e4,g4]*4"The same chord 4 times per bar
Strudel · spaces vs commasOpen in Strudel ↗
setcpm(80/4)

// bar 1: spaces = one after another · bar 2: commas = all at once
note("<[c4 e4 g4] [c4,e4,g4]>").s("piano")
CommandWhat it does
note("<[c4 e4 g4] [c4,e4,g4]>")Two bars, alternating (< >). In bar 1, [c4 e4 g4] has spaces, so the three notes share the bar one after another. In bar 2, [c4,e4,g4] has commas, so they sound together.
.s("piano")Plays them on the piano.

How a chord is built: counting semitones

Every key on the piano, black or white, is one semitone away from the next. A chord is a root note plus a recipe: how many semitones up the other notes are. Count from the root and you can build any chord on any note.

C major = 0 + 4 + 7CDEFGABCDE0+4+7 C minor = 0 + 3 + 7CDEFGABCDE0+3+7 C7 = 0 + 4 + 7 + 10CDEFGABCDE0+4+7+10
Click a keyboard to hear its chord. The numbers count semitones (every key, black and white) up from the root. Major and minor differ by just one key: the middle note is 4 semitones up for major and 3 for minor.
ChordRecipe (semitones)On CSound
Major0 4 7C E Gbright, happy
Minor0 3 7C E♭ Gsad, dark
Diminished0 3 6C E♭ G♭tense, unstable
Augmented0 4 8C E G♯floating, strange
Sus20 2 7C D Gopen, neither major nor minor
Sus40 5 7C F Gopen, wants to move to major
7 (dominant)0 4 7 10C E G B♭bluesy, wants to resolve
Maj70 4 7 11C E G Bsoft, jazzy, dreamy
Minor 70 3 7 10C E♭ G B♭mellow: house, soul

Example on another root: A minor = A + 3 + 7 → A, C, E. Count on the keyboard: A → A♯ → B → C (3 up), then on to E (7 up).

Try it: every chord type on the keyboard, with sound

Pick a chord type and a root. The keyboard lights the chord's keys and tags each one with its distance from the root in semitones; then you hear it. Below the keyboard is the code that plays the same chord in Strudel (with your own notes, and by chord name). You can click any key to hear a single note.

1Chord type (the numbers are the recipe in semitones):

Basic shapes (2–3 notes)

Four notes: sevenths, sixths, add9

Five notes: ninths

2Root note (the chord is built up from here):

3C (major) bright, happy

C4D4E4F4G4A4B4C5D5E5F5G5A5B5C6D6E6
Notes C4 · E4 · G4
Strudel note("[c4,e4,g4]").s("piano")
By name chord("C").voicing().s("piano")
The sound is Strudel's own piano, the same recordings as .s("piano"), played straight by your browser without starting Strudel. They start loading when you point at the explorer; until they arrive (or if they can't load), you hear a simple piano-like tone instead. Change only the type and the bottom key stays put: you can see and hear which keys move. Change only the root and the whole shape slides along the keyboard while the semitone tags stay the same. Some notes get unusual names, like F♭ (the same key as E) or B♯ (the same key as C): music theory names each chord note by its letter (a third is always two letters above the root). Strudel understands these names too. The By name line uses chord(), which picks its own octave and note order (lesson 3.3), so it sounds the same chord in a different layout.
Strudel · chord typesOpen in Strudel ↗
setcpm(70/4)

// one root (C), a different recipe each bar:
// major · minor · diminished · sus4 · 7 · maj7
note("<[c4,e4,g4] [c4,eb4,g4] [c4,eb4,gb4] [c4,f4,g4] [c4,e4,g4,bb4] [c4,e4,g4,b4]>")
  .s("piano")
CommandWhat it does
[c4,e4,g4]Bar 1, major: C + 4 = E, C + 7 = G.
[c4,eb4,g4]Bar 2, minor: only the middle note changes (E → E♭, 3 semitones up).
[c4,eb4,gb4]Bar 3, diminished: the top note also drops (G → G♭).
[c4,f4,g4]Bar 4, sus4: the middle note goes up to F (5 semitones).
[c4,e4,g4,bb4]Bar 5, 7th: a fourth note, B♭ (10 semitones).
[c4,e4,g4,b4]Bar 6, maj7: B instead of B♭ (11 semitones).
eb4, gb4, bb4Flats are written with b (E♭ = eb4) and sharps with # (F♯ = f#4).

Sus chords: Dsus2, Fsus2, Asus4…

In a major or minor chord, the middle note sets the mood. 4 semitones above the root sounds major (happy) and 3 sounds minor (sad). Musicians call this note the 3rd. A sus chord (short for suspended) leaves the 3rd out and plays another note in its place:

  • sus2: the middle note moves down to 2 semitones above the root. Recipe 0 2 7.
  • sus4: the middle note moves up to 5 semitones above the root. Recipe 0 5 7.

The root (bottom) and the top note, 7 semitones up (the 5th), stay where they are. Without the 3rd, the chord is neither major nor minor. It sounds open and unfinished, as if it's waiting to move on. That's why a sus chord is often followed by the plain chord on the same root, for example Dsus4 → D.

D = 0 + 4 + 7CDEFGABCDE0+7+4 Dsus2 = 0 + 2 + 7CDEFGABCDE0+2+7 Dsus4 = 0 + 5 + 7CDEFGABCDE0+5+7 Fsus2 = 0 + 2 + 7CDEFGABCDE0+2+7
Click a keyboard to hear its chord. From D to Dsus2 or Dsus4, only the middle key moves: F♯ (+4) steps down to E (+2) or up to G (+5). D and A stay. Fsus2 is the Dsus2 shape slid up to F: F, then G (+2), then C (+7).

Any sus chord works the same way. Start on the root and count: sus2 is root, +2, +7 and sus4 is root, +5, +7. Here are all 12 of each, with the notes to write in Strudel. In the explorer above, pick Sus2 or Sus4 and click a root to see and hear any of them.

Rootsus2 (0 2 7)Strudel notessus4 (0 5 7)Strudel notes
CCsus2: C D G[c4,d4,g4]Csus4: C F G[c4,f4,g4]
D♭D♭sus2: D♭ E♭ A♭[db4,eb4,ab4]D♭sus4: D♭ G♭ A♭[db4,gb4,ab4]
DDsus2: D E A[d4,e4,a4]Dsus4: D G A[d4,g4,a4]
E♭E♭sus2: E♭ F B♭[eb4,f4,bb4]E♭sus4: E♭ A♭ B♭[eb4,ab4,bb4]
EEsus2: E F♯ B[e4,f#4,b4]Esus4: E A B[e4,a4,b4]
FFsus2: F G C[f4,g4,c5]Fsus4: F B♭ C[f4,bb4,c5]
F♯F♯sus2: F♯ G♯ C♯[f#4,g#4,c#5]F♯sus4: F♯ B C♯[f#4,b4,c#5]
GGsus2: G A D[g4,a4,d5]Gsus4: G C D[g4,c5,d5]
A♭A♭sus2: A♭ B♭ E♭[ab4,bb4,eb5]A♭sus4: A♭ D♭ E♭[ab4,db5,eb5]
AAsus2: A B E[a4,b4,e5]Asus4: A D E[a4,d5,e5]
B♭B♭sus2: B♭ C F[bb4,c5,f5]B♭sus4: B♭ E♭ F[bb4,eb5,f5]
BBsus2: B C♯ F♯[b4,c#5,f#5]Bsus4: B E F♯[b4,e5,f#5]

The octave number goes up at every C. That's why, from Fsus2 on, the top note is in octave 5: Fsus2 = f4, g4, c5. Each black key has two names (D♭ = C♯), so C♯sus2 is the same chord as D♭sus2.

Same keys, two names. Dsus2 (D E A) and Asus4 (A D E) use the same three notes. The name depends on which note is at the bottom. With D at the bottom it's Dsus2, and with A at the bottom it's Asus4. In the same way, Csus2 = Gsus4 and Fsus2 = Csus4.

To hear sus chords in a whole song, with all of these ideas, play 11.9 Open Road.

Writing sus chords in code

ChordYour own notesStrudel chord name
Dsus2note("[d4,e4,a4]")chord("D2").voicing()
Dsus4note("[d4,g4,a4]")chord("Dsus").voicing()
D7sus4note("[d4,g4,a4,c5]")chord("D7sus").voicing()

Careful: in Strudel, chord("Dsus2") and chord("Dsus4") play nothing, and the Console tab shows [voicing]: unknown chord "Dsus2". Strudel takes its chord names from the jazz app iReal Pro, which writes sus2 as 2 and sus4 as plain sus.

Strudel · sus chords from notesOpen in Strudel ↗
setcpm(80/4)

// D · Dsus4 · D · Dsus2, then F · Fsus2 · Fsus4 · F (one chord per bar)
note("<[d4,f#4,a4] [d4,g4,a4] [d4,f#4,a4] [d4,e4,a4] [f4,a4,c5] [f4,g4,c5] [f4,bb4,c5] [f4,a4,c5]>")
  .s("piano")
CommandWhat it does
< … >One chord per bar: 8 bars, then it starts again.
[d4,f#4,a4]Bars 1 and 3, D major: the middle note F♯ is 4 semitones above D.
[d4,g4,a4]Bar 2, Dsus4: F♯ goes up to G (+5). D and A don't change.
[d4,e4,a4]Bar 4, Dsus2: F♯ goes down to E (+2).
[f4,a4,c5]Bars 5 and 8, F major: A is 4 semitones above F. C comes after B, so it's c5.
[f4,g4,c5]Bar 6, Fsus2: A goes down to G (+2).
[f4,bb4,c5]Bar 7, Fsus4: A goes up to B♭ (+5).
Strudel · sus chords by nameOpen in Strudel ↗
setcpm(84/4)

// Dsus2 · Bm7 · Gsus2 · Asus4, with a bass line on the roots
const prog = chord("<D2 Bm7 G2 Asus>")
$: prog.voicing().s("gm_epiano1").room(.3)
$: prog.rootNotes(2).s("gm_acoustic_bass").gain(.8)
CommandWhat it does
chord("<D2 Bm7 G2 Asus>")Four chords, one per bar: Dsus2, Bm7, Gsus2, Asus4. Inside chord(), 2 means sus2 and sus means sus4. G2 here is the chord Gsus2, not the note G in octave 2.
const prog =Stores the progression, so both layers below play the same chords.
.voicing()Picks the notes and octaves of each chord, as in lesson 3.3.
.s("gm_epiano1").room(.3)Electric piano with a little reverb.
.rootNotes(2)Plays only the root of each chord, in octave 2: a bass line D, B, G, A.
.s("gm_acoustic_bass").gain(.8)Upright bass, a little quieter.

Other chord names you'll meet

Songbooks and chord websites use many more names. Each one is still a root plus a recipe. The explorer above plays all of them on any root. Here they are on D, with the name to write in Strudel.

ChordRecipeNotes on DStrudelSound
D5 (power chord)0 7D Achord("D5")hard and plain, neither major nor minor: rock guitar
Dadd90 4 7 14D F♯ A Echord("Dadd9")major with a sparkle: pop, ballads
D60 4 7 9D F♯ A Bchord("D6")sweet, old-fashioned: swing, surf
Dm60 3 7 9D F A Bchord("Dm6")mysterious: spy films
D7sus40 5 7 10D G A Cchord("D7sus")soft tension: gospel, neo-soul
Dmaj70 4 7 11D F♯ A C♯chord("D^7")soft, jazzy, dreamy
D90 4 7 10 14D F♯ A C Echord("D9")funky, bluesy
Dm90 3 7 10 14D F A C Echord("Dm9")lush minor: lo-fi, neo-soul
Dmaj90 4 7 11 14D F♯ A C♯ Echord("D^9")dreamy, floating
Ddim (D°)0 3 6D F A♭chord("Do")tense, unstable
Ddim7 (D°7)0 3 6 9D F A♭ C♭ (C♭ is the key B)chord("Do7")spooky, very tense: old horror films
Dm7♭5 (Dø)0 3 6 10D F A♭ Cchord("Dm7b5")dark, jazzy: often leads to a minor chord

Numbers above 12 reach into the next octave: 14 = 12 + 2, so the 9th is the 2nd one octave higher. Dadd9 and Dsus2 both contain E, but add9 keeps the 3rd (F♯) and adds E on top, while sus2 replaces the 3rd with E. Slash chords like D/F♯ mean "D with F♯ as the lowest note". Write those notes yourself: note("[f#3,d4,f#4,a4]").

Songbook writesWrite in Strudel's chord()
sus22 (Dsus2 → D2)
sus4, sussus (Dsus4 → Dsus)
7sus47sus
maj7, Δ7^7 or M7
maj9^9
dim, °o
dim7, °7o7
m7♭5, øm7b5 or h7
aug, +aug or +
m, 7, m7, 6, m6, 9, m9, add9, 5the same as the songbook

A progression written as notes

Strudel · progression as notesOpen in Strudel ↗
setcpm(80/4)

// C – Am – F – G, one chord per bar, every chord written note by note
note("<[c4,e4,g4] [a3,c4,e4] [f3,a3,c4] [g3,b3,d4]>").s("piano")
CommandWhat it does
"<[c4,e4,g4] [a3,c4,e4] [f3,a3,c4] [g3,b3,d4]>"Four chords, one per bar (< >): C, Am, F, G. Each chord is in root position, with its root as the lowest note.
.s("piano")Played on the piano.

That works, but every chord jumps to a new place. Writing the notes yourself lets you choose positions that sit close together:

C (E G C)CDEFGABCDEEGC Am (E A C)CDEFGABCDEEAC F (F A C)CDEFGABCDEFAC G (D G B)CDEFGABCDEDGB
Click a keyboard to hear its chord. The same four chords (C, Am, F, G) as in the code below, voiced so the hand barely moves: C stays on top for three chords, and each change moves only one or two keys a small step. This is the voice-leading idea from lesson 3.3, written as notes.

Chords with rhythm and a bass line

A chord doesn't have to last the whole bar. Give it a rhythm with .struct, make it short with .clip, and put the root in a separate low bass. Now the chords sound like an accompaniment.

Strudel · chords, rhythm & bassOpen in Strudel ↗
setcpm(100/4)

// voice-led chords (see the keyboards above) with a rhythm
$: note("<[e4,g4,c5] [e4,a4,c5] [f4,a4,c5] [d4,g4,b4]>")
  .struct("x ~ x x ~ x ~ x")
  .s("gm_epiano1").clip(.6)
// the bass plays each chord's root, low
$: note("<c2 a1 f1 g1>").s("gm_acoustic_bass")
// drums
$: s("bd ~ sd ~, hh*8").bank("RolandTR909").gain(.6)
CommandWhat it does
note("<[e4,g4,c5] [e4,a4,c5] [f4,a4,c5] [d4,g4,b4]>")C, Am, F, G in close positions (the keyboards above). The hand barely moves.
.struct("x ~ x x ~ x ~ x")Rhythm: the chord plays on every x of 8 steps and rests on ~.
.s("gm_epiano1").clip(.6)Electric piano. Each hit lasts 60% of its step, which gives a short, bouncy feel.
note("<c2 a1 f1 g1>")A separate bass with each chord's root in a low octave. The chords above don't need their roots at the bottom.
.s("gm_acoustic_bass")Played on an acoustic bass.
s("bd ~ sd ~, hh*8")A simple beat: kick, snare and 8th-note hi-hats.

Shortcut 1: chords from numbers

Instead of naming every note, give a root and a recipe. Notes as numbers (MIDI) can be added: 60 is middle C (C4), and each +1 is one semitone up.

Strudel · chords from numbersOpen in Strudel ↗
setcpm(80/4)

// roots as MIDI numbers: 60 = C4, 57 = A3, 53 = F3, 55 = G3
// recipes in semitones: [0,4,7] = major, [0,3,7] = minor
note("<60 57 53 55>".add("<[0,4,7] [0,3,7] [0,4,7] [0,4,7]>"))
  .s("piano")
CommandWhat it does
"<60 57 53 55>"The roots as numbers, one per bar: 60 = C4, 57 = A3, 53 = F3, 55 = G3.
.add("<[0,4,7] [0,3,7] [0,4,7] [0,4,7]>")Adds a recipe to each root. The commas turn one root into three notes: [0,4,7] = major, [0,3,7] = minor (bar 2, Am).
note(…)Plays the resulting numbers as notes.

Shortcut 2: chords from a scale

With n() and .scale() (lesson 3.5), the numbers are scale steps, not semitones. Steps [0,2,4] are the 1st, 3rd and 5th notes of the scale: a triad. Because it uses only scale notes, the chord is always in key, and it comes out major or minor by itself.

Strudel · chords from a scaleOpen in Strudel ↗
setcpm(80/4)

// [0,2,4] = scale steps 1, 3 and 5 = a triad that always fits the key
// .add moves the triad to another step: 0 = C, -2 = A, -4 = F, -3 = G
n("[0,2,4]".add("<0 -2 -4 -3>")).scale("C4:major").s("piano")
CommandWhat it does
"[0,2,4]"Scale steps 0, 2 and 4 together: in C major that is C, E, G.
.add("<0 -2 -4 -3>")Moves the triad each bar: start on step 0 (C), −2 (A), −4 (F), −3 (G). That gives C, Am, F, G.
.scale("C4:major")Turns the steps into C major notes, counting from C4.
n(…)n means "these are scale steps" (with .scale), not notes.
Way to write a chordExampleUse it when…
Chord symbolchord("Am").voicing()you think in chord names and want Strudel to choose the notes
Notesnote("[a3,c4,e4]")you want exact control of every key
Root + recipenote("57".add("[0,3,7]"))you think in intervals, or want to change chord type quickly
Scale stepsn("[0,2,4]").scale("C4:major")you want chords that always fit the key

Practice

  • Write G – D – Em – C as notes. Use the recipe table: G major = G + 4 + 7 → G, B, D.
  • Change the progression example so every chord is a 7th chord (add a fourth note, 10 or 11 semitones up).
  • In the scale shortcut, change "C4:major" to "A3:minor" and listen: the same steps make different chords.

3.5Melody from scale degrees

With n() plus .scale(), numbers are steps in a scale, not pitches. In A minor, 0 is A, 2 is C and 4 is E. That means a melody can't play a wrong note. .add("<0 -2 2 -1>") shifts the whole motif each bar so it follows the chords: A, then F (two steps down), C (two up) and G (one down). The triangle synth is soft, and .delay(.4) adds echoes.

Strudel · lesson 3.5Open in Strudel ↗
setcpm(124/4)

$: s("bd*4").bank("RolandTR909")
$: s("~ cp ~ cp").bank("RolandTR909")
$: s("[~ oh]*4").bank("RolandTR909").gain(.4)
$: s("hh*16").bank("RolandTR909")
  .gain("[.25 .5]*8")
  .sometimesBy(.2, x => x.ply(2))

$: note("<a1 f1 c2 g1>")
  .struct("x ~ x x ~ x x ~")
  .s("sawtooth")
  .lpf(500)
  .decay(.15).sustain(0)

$: chord("<Am7 F^7 C^7 G7>")
  .struct("[~ x]*2")
  .voicing()
  .s("gm_epiano1")
  .room(.5).gain(.6)

$: n("0 [~ 2] 4 [3 2]".add("<0 -2 2 -1>"))
  .scale("A4:minor")
  .s("triangle")
  .delay(.4).gain(.5)

Listen for

The same four-note shape at a different height each bar.

Try changing

  • .scale("A4:dorian")
  • "0 2 4 7" as the motif
  • .s("gm_vibraphone")

3.6Scales & arpeggios

A scale is the set of notes a piece uses, like the white keys from C to C for C major. An arpeggio plays the notes of a chord one after another instead of all at once. Both are the main source of melodies, basslines and synth patterns.

Scales: numbers instead of note names

With n("…").scale("C4:major"), each number is a step in the scale, counted from the root (0). In a 7-note scale, 7 is the root an octave up. Negative numbers go below the root. In a 5-note (pentatonic) scale, 5 is already the octave.

Strudel · up and down a scaleOpen in Strudel ↗
setcpm(100/4)

// bar 1 up, bar 2 down: the C major scale over one octave
n("<[0 1 2 3 4 5 6 7] [7 6 5 4 3 2 1 0]>").scale("C4:major").s("gm_piano")

Every scale has its own mood. This example plays the same melody each bar while the scale changes:

Strudel · hear the modesOpen in Strudel ↗
setcpm(100/4)

// major, minor, dorian, lydian, mixolydian, phrygian
n("0 2 4 [6 5] 4 2 1 0")
  .scale("<C4:major C4:minor C4:dorian C4:lydian C4:mixolydian C4:phrygian>")
  .s("gm_vibraphone")
Strudel nameNotes from CSound
majorC D E F G A BBright, happy
minorC D E♭ F G A♭ B♭Sad, dark
dorianC D E♭ F G A B♭Minor, but warmer: funk, jazz, house
phrygianC D♭ E♭ F G A♭ B♭Dark, Spanish, metal
lydianC D E F♯ G A BDreamy, floating: film music
mixolydianC D E F G A B♭Major with a bluesy edge: rock
locrianC D♭ E♭ F G♭ A♭ B♭Unstable, tense
harmonic minorC D E♭ F G A♭ BExotic, classical
melodic minorC D E♭ F G A BJazz
major pentatonicC D E G AFolk, pop. Hard to play a wrong note
minor pentatonicC E♭ F G B♭Rock and blues solos
bluesC E♭ F G♭ G B♭Blues
whole toneC D E F♯ G♯ A♯Dreamlike, no clear home
hirajoshiC D E♭ G A♭Japanese
chromaticAll 12 notesEvery note

In Strudel, put the key and octave first: "A4:minor", "D3:dorian", "F#4:major pentatonic".

Random notes that always fit. irand(8) picks random numbers from 0 to 7. Because they go through a scale, every note is in key, and the melody never repeats exactly.

Strudel · generative melodyOpen in Strudel ↗
setcpm(90/4)

// 8 random scale steps per bar, about 30% of them left out
$: n(irand(8).segment(8)).scale("A4:minor pentatonic")
  .s("gm_kalimba").degradeBy(.3).room(.5)
$: note("<a2 a2 e2 g2>").s("gm_acoustic_bass")

Arpeggios

Write the notes. The simplest arpeggio is a chord's notes in order. The four bars below play C major up, down, up-and-down, and "broken" (skipping around).

Strudel · written arpeggiosOpen in Strudel ↗
setcpm(100/4)

note("<[c4 e4 g4 c5] [c5 g4 e4 c4] [c4 e4 g4 e4] [c4 g4 e4 g4]>")
  .s("gm_orchestral_harp")

Arpeggiate chord symbols. Add n() to chord().voicing(), and each number picks a note of the chord from the bottom: 0 is the lowest. Numbers bigger than the chord continue into the next octave. You write the shape once, and it follows every chord.

Strudel · arpeggio from chordsOpen in Strudel ↗
setcpm(110/4)

// up and back down through each chord
$: n("0 1 2 3 4 3 2 1").chord("<Am F C G>").voicing()
  .s("gm_epiano1")
// bass on each chord's root (after chord(), rootNotes already gives notes, so no .note())
$: chord("<Am F C G>").rootNotes(2).s("gm_acoustic_bass")
ShapePattern for n()
up"0 1 2 3"
down"3 2 1 0"
up-down"0 1 2 3 2 1"
broken"0 2 1 3" or "0 2 1 2" (the classical "Alberti bass")
two octaves"0 1 2 3 4 5 6 7"
faster"[0 1 2 3]*4" (sixteenth notes)

A classic synth arpeggio. Sixteenth notes on a short, filtered sawtooth with an echo, the sound of trance and synth-pop:

Strudel · synth arpOpen in Strudel ↗
setcpm(124/4)

$: n("[0 1 2 3]*4").chord("<Am F C G>").voicing()
  .s("sawtooth").lpf(1800).clip(.5).delay(.3).gain(.5)
$: s("bd*4, [~ hh]*4").bank("RolandTR909")

Pick notes from a stacked chord. (To see this on a piano keyboard, step by step, go to How cat and .arp work together in 11.5.) .arp() takes notes from a chord you wrote with commas, by position (0 is the first note written). [0,2] plays two of them together.

Strudel · arp()Open in Strudel ↗
setcpm(100/4)

note("<[c4,e4,g4,b4] [a3,c4,e4,g4]>")
  .arp("0 1 2 3 2 1 [0,2] ~")
  .s("gm_vibraphone")

Tested with Strudel 1.3. Course text: CC BY-SA 4.0, code: CC0 1.0 (licences).