Nuno Trocado

Automatic variations

2020-12-14

Generate a pdf with melodic variations on a theme

Enter a short musical phrase in the input box above, choose the complexity level, push the button and wait (it might take a few seconds). You'll get an automatically generated pdf with a bunch of melodic variations on the original phrase. This can be useful to discover new ideas for composing and improvising, to overcome the blank page syndrome, to practice reading, etc.

To input the theme, use the following syntax:

  • Notes are separated by spaces.
  • Each note starts with a pitch letter (a-g), or r for a rest.
  • Add s for sharp, b for flat (eg, cs is C-sharp, bb is B-flat).
  • Add one or more quotes (') to indicate octaves above middle C, commas (,) indicate octaves below middle C. For example: c' is the C above middle C (C5, as it is also usually called); ab,, is the A-flat two octaves below middle C (A2).
  • Add the rhythmic value in number of beats. Examples: c1 is a quarter-note C; d.5 is an eighth-note D (.5=half a beat); e1.75 is a double-dotted quarter-note E, or a quarter-note tied to a dotted eight-note… (the exact notation is set by the computer); fs4 is a whole-note F-sharp.
  • One more thing about octaves: all the octaves are relative to the first note. If you type g,,1 a1 b1 c'1, the first three notes are two octaves below middle-C, and the last one one octave below (G2 A2 B2 C3).
  • One more thing about rhythms: If you don't enter a rhythmic value, the preceding one is assumed. So you could write the last example like this: g,,1 a b c'.

Some more examples of valid phrases:

  • f1 r.5 f'1 d'.5 e'1 (Moose The Mooche)
  • r.5 g g g eb2 r.5 f f f d2 (Beethoven's fifth)
  • d2 a f d cs d1 e f2.5 g.5 f e d1 (Bach's Art of the Fugue)
  • cs'.5 e gs b as1.5 gs.5 fs ds b,1 (Coltrane's solo on Giant Steps)
  • d.5 e f g e1 c.5 d1.5 (The Lick)

Limitations (for now…)

  • Everything is in 4/4.
  • No tuplets.
  • Everything is in treble clef.
  • No key signatures.
  • The spelling of pitches and the notation of rhythms are not very rigorous… These are not trivial problems, and I've put significant work on the respective algorithms, but there's definitively room for improvement.
  • Maximum 13 notes in the input phrase.

Coming up…

After dealing with all above: more algorithms, fine-tuning parameters, midi file download.

Bugs, suggestions

Contact me or head to the issue tracker. Also, I'd love to know how you use this and whether it finds a place in your next magnus opus.