ablx.directory

Melody Generator

v0.5.0

Ableton Live 12 extension with three generators behind one dialog:

saarsenamanifest author: saarsenaNo ratings yet
README · rendered from GitHubView source

Melody Generator

Ableton Live 12 extension with three generators behind one dialog:

  • Markov chain — a constrained chain in the key/scale already set in Live, driven by a degree-to-degree transition matrix. It can follow a chord progression, land on notes you pin to specific bars, and repeat motifs.
  • Strange attractor — orbits of chaotic dynamical systems (Lorenz, Thomas, Rössler, Hénon, De Jong) mapped to notes: x → pitch, y → velocity, z (or jump distance for the 2D maps) → rests and note length.
  • Drums — the same constrained chain over combinations of drum voices, so the kit interlocks rather than each pad firing independently. Pads are read from the track's Drum Rack.

Usage

Right-click a MIDI clip → Extensions → Melody Generator… (or Drum Generator…)

The dialog opens pre-set to Live's global root note and scale. The Generator dropdown switches between the two engines and their config panels; root, scale, register, seed, preview, and Apply are shared.

Shared controls

  • Register — octave range (Ableton convention, C3 = MIDI 60).
  • Grid — the step grid starts from Live's own, shown in the readout. Note that the SDK only exposes Live's Arrangement grid, so it can differ from the ruler above the piano roll; the value seeds the chooser and you can change it. 1/4 down to 1/32, plus 1/8T and 1/16T.
  • Gate — note length as a percentage of a step (of the drawn duration, for the melodic generator). Over 100% the notes overlap into the next step.
  • Seed — identical seed + settings always reproduce the same output; 🎲 rerolls (for attractors this jitters the orbit's initial conditions — sensitive dependence makes every reroll a genuinely new melody).
  • Variations A-D — four seed slots for the same settings. Click a letter to audition that variation, use 🎲 to reroll the active slot, or Shuffle All to refresh the whole bank.
  • Name clip — enabled by default; applied clips are renamed with compact metadata such as MG Lorenz C Dorian s12345 so the generator, key, scale, and seed stay visible in Live.
  • Preview — piano-roll strip plus WebAudio playback (▶ Play / Space). Preview audio is a simple triangle-wave synth; Live itself has no audition API for extensions.
  • Apply — replaces the clip's notes (length = the clip's loop length). Live's undo restores the previous notes. Cancel/Escape leaves the clip untouched.

Markov chain panel

  • Pitch transition matrix — row = current scale degree, column = next degree, weights 0–10. Fill it from a style preset (Stepwise, Arpeggiated, Jumpy, Drone) or edit cells directly (flips to "Custom").
  • Rhythm — a second Markov chain over note durations (1/16 … 1/2) driven by per-duration weights plus an inertia slider (tendency to repeat the same duration) and a rest-probability slider, plus velocity humanization.
  • Shortest — the smallest duration the melody may use, seeded from Live's grid. Anything below it leaves the alphabet and its weight slider dims. The melodic rhythm is free-running rather than stepped, so a grid can only tell it how finely to cut.
  • Progression — roman numerals the melody follows: ii7 V7 Imaj7, or Imaj7:2 V7:1 vi:1 to weight how long each chord lasts. Counts are ratios, so the progression always fills the loop exactly. Accidentals (bVII, #iv), case for quality (vi vs VI) and suffixes (maj7, m7b5, sus4, o7) all work; a bare numeral takes its quality from the key.
  • Anchors — pin a pitch class to a bar: 1:C 3:G makes the melody land on C at bar 1 and G at bar 3. The whole run-up is re-weighted so it arrives there rather than jumping.
  • Chord weight — how strongly the current chord's own tones are favoured. Chord tones only restricts the melody to them outright.
  • Voice leading — how much small melodic intervals and a settled register are preferred. At 0 the melody roams the whole register freely.
  • Déjà vu — chance of repeating a pitch drawn from the last few notes, so melodies form recurring cells instead of wandering. The window slider sets how far back it reaches.

Settings that cannot be satisfied — an anchor outside its chord, an unparseable numeral — are reported in the dialog and relaxed, never silently obeyed.

Rhythm and pitch run off separate random streams, so changing the harmony controls leaves the groove exactly as it was, and vice versa.

Strange attractor panel

  • System — Lorenz, Thomas, Rössler (continuous flows), Hénon, De Jong (discrete maps), with a live drawing of the actual orbit.
  • Step grid — 1/4 to 1/32 notes plus triplets; the orbit is sampled once per step.
  • Density — gate threshold on the z-channel; rests cluster where the dynamics are quiet.
  • Snap to scale — snaps pitches to the root/scale selected in the toolbar.

Drums panel

Reached from Extensions → Drum Generator…. The pads come from the Drum Rack on the clip's track — up to six of them, chosen by name (kick, snare, hats, clap, cymbal) and then by lowest note. A track without a Drum Rack falls back to the General MIDI map, which the panel says explicitly.

  • Voices — density (how present a voice is in the pattern) and probability (a gate on the output that leaves the underlying pattern alone) per pad.
  • Accents — click a cell to force a hit on, again to force it off, again to free it. Forcing a kick on 1 and a snare on 2 and 4 reshapes the whole bar around them rather than stamping them on top.
  • Metrical pull — how strongly hits favour beats over offbeats. At 0 the pattern is an even wash across every step, which is occasionally what you want.
  • Cohesion — how much each step resembles the one before. This is a texture control: high values give rolls and machine-gun runs, not a tighter groove.
  • Fill — extra density over the last bar of the pattern.
  • Déjà vu — recurrence of earlier hit states; set the window near the pattern length to make one bar echo another.
  • Length / Grid — the pattern cycles if it is shorter than the clip, and each repeat is redrawn unless Repeat pattern exactly is ticked.
  • Let Live roll probability — write the gates as Live note probability so they re-roll on every pass, instead of baking them in. Baked is the default, because it matches the preview and stays reproducible from the seed.

Regenerate

Right-click a previously generated clip → Extensions → Regenerate rerolls it instantly (new seed, same settings and generator type — melody, attractor or drums) without opening the dialog. Settings are stored per generation in the extension's storage directory, keyed by a fingerprint of the clip's exact notes — so it survives Live restarts and works on duplicated clips, but a clip whose notes were hand-edited (or never generated) is refused with a message. Each regeneration re-stores its settings, so you can keep rerolling, and the clip's current loop length is used each time.

Development

npm install
npm run build     # type-check + bundle to dist/extension.js
npm test          # smoke-test both generation engines
npm run check     # build + test
npm run package   # build + create a distributable .ablx
npm start         # build + load into a running Live (Developer Mode required)
  • Enable Developer Mode in Live: Preferences → Extensions.
  • .env must point EXTENSION_HOST_PATH at the Live install you're running (currently Live 12 Beta); for Suite use C:\ProgramData\Ableton\Live 12 Suite\Program\ExtensionHost\ExtensionHostNodeModule.node or pass extensions-cli run --live <path>.
  • For an installed .ablx, turn Developer Mode off and restart Live. Developer Mode is for npm start; installed packages are loaded by Live's managed extension host.
  • CATALOG_CHECKLIST.md has the release QA pass for GitHub/catalog builds.

Layout

  • src/engine.ts — the Markov engine (scales, presets, seeded PRNG, generation) in three passes: rhythm, then the constrained model, then the pitch walk.
  • src/chain.ts — the constrained non-homogeneous Markov core. Alphabet- agnostic; randomness is injected so generation stays seed-reproducible.
  • src/harmony.ts — roman-numeral chord parsing, progressions to timed segments, anchor parsing.
  • src/grid.ts — the step grid table, shared so the dialog, the host and the tests agree on what "1/16" is in beats.
  • src/drums.ts — the drum engine: hit-state bitmask alphabet over up to six voices, metrical/density/cohesion weighting, accents, pad selection.
  • src/attractors.ts — the strange-attractor engine (systems, orbit sampling, orbit→notes mapping, seeded initial conditions).
  • src/engines.ts — re-exports both; shared by both sides: imported normally by the host, and bundled by build.ts into the dialog HTML as the MelodyEngine global.
  • src/extension.ts — thin host: context-menu registration, reads root/scale/tempo/clip length, injects window._INIT into the dialog HTML, validates the returned notes, writes clip.notes. Also the Regenerate command (dispatches on the stored generator type) and the fingerprint-keyed settings store (generations.json in context.environment.storageDirectory).
  • src/interface.html — the dialog: generator dropdown, matrix UI, orbit preview, canvas piano roll, WebAudio preview (vanilla JS; the SDK webview has no framework support). Returns notes and the generation settings on Apply.

Rate this extension

One rating per account; you can change it any time.

No ratings yet — be the first

Comments

Sign in to join the discussion.Sign in

No comments yet.