Writing Memorable Melodies and Counterpoint
Learning objectives
- learner can build melodies from motives using contour, variation and phrase structure
- learner can apply fugal transformations (inversion, retrograde, augmentation) to develop a motive
- learner can write independent contrapuntal and hocketed lines and redistribute a melody across timbres
Capstone — one whole task that evidences the objectives
Write a 16-bar lead melody from one or two motives with balanced contour and clear phrases, generate at least one variation using a named fugal transformation (inversion, retrograde, or augmentation), add a rhythmically independent counter-line, then re-orchestrate one phrase using hocket or klangfarbenmelodie across two timbres.
Prerequisite modules
In a live-coded or DAW-based electronic set, the lead line is what the room remembers — the bass and drums carry the body, but a motive-driven melody is the hook people hum on the way home. This module builds toward writing that lead as a craftsperson: a 16-bar melody grown from one or two cells, developed through fugal transformation, backed by a counter-line that stands on its own, and re-voiced across two synth timbres so the melody itself seems to change colour mid-air.
The arc starts small and supported. First, steal with intent: dissect a track you admire into its motives (“melodies built from one or two short motives achieve coherence through variation”) and drill short rhythmic cells until inventing a “rhythmic motive” is reflex. Then grow a cell into phrases using question-and-answer structure and check its shape against the contour principles — balance ascent with descent, resolve leaps by step. When variation stalls, reach for the rule-based toolkit: “transposition, inversion, retrograde, and pitch rotation” and the fugal transformations give you systematic ways to say the same thing differently — the same operations your pattern library implements in code. The capstone asks for at least one named fugal transformation (inversion, retrograde, or augmentation) applied to the main motive, making transformation technique a required deliverable rather than optional background. Finally, layer: write a counter-line that passes the rhythmic-independence test, then split or crossfade one phrase between two instruments using hocket (fast, alternating) or klangfarbenmelodie (slow, dissolving).
The required atoms are exactly what the capstone cannot survive without — motive construction, contour, transformation technique, counterpoint conditions, and the two re-orchestration techniques. The supporting atoms on lyric scansion, postminimalist timbre, and silence-as-texture widen the aesthetic frame: lyric scansion transfers the rhythm skills to vocal lines (useful context even in an instrumental module), while the postminimalist and texture atoms suggest why a timbre-shifting melody over sparse material can carry a whole track.
Runnable examples
Generated from the context/ instrument corpus by concept (redistributable idioms only). Do not edit — regenerate with gen-module-examples.mjs.
scale-constraint
n("0 2 4 6").scale("c:minor")
strudel-0009 · CC0
play (scale :c4, :minor).tick; sleep 0.25
sonicpi-0012 · CC0
call-and-response
cat(s("bd sd"), s("~ cp ~ cp"))
strudel-0025 · CC0
d1 $ cat [sound "bd sn", sound "~ cp ~ cp"]
tidal-0024 · CC0
random-walk-melody
Pbind(\degree, Pbrown(0, 7, 1, inf), \dur, 0.25).play
supercollider-0027 · CC0
@n = (@n || 0) + [-1, 0, 1].choose; play (scale :e3, :minor)[@n % 8]; sleep 0.25
sonicpi-0019 · CC0
motif-development
d1 $ n (run 8) # sound "arpy" # room 0.3
tidal-0043 · CC0
play (scale :e3, :minor_pentatonic).tick + (ring 0, 12, 7).look; sleep 0.25
sonicpi-0021 · CC0
counter-melody
d1 $ superimpose (|+ note 12) $ n "0 3 5" # sound "arpy"
tidal-0049 · CC0
live_loop :lead do
play (scale :e4, :minor).tick, release: 0.2
sleep 0.5
end
live_loop :counter, sync: :lead do
play (scale :e3, :minor).mirror.tick, release: 0.3, amp: 0.5
sleep 0.5
end
sonicpi-0055 · CC0
Atoms in this module
Required — these gate the capstone
Supporting — enrichment, not gating
Part of curricula
- Electronic Music Producer — from raw sound to a released track — Write and arrange a full track required
Unlocks — modules that require this one