Random Melody Generator
Drawing notes at random from a scale gives you something that is in the key and unusable — it leaps about, has no shape, and stops wherever the last draw landed. All three of those are properties of the sequence rather than of any note in it, so this constrains the sequence: the largest step it may take, the shape it follows, and whether it comes to rest.
What this generator does
Produces a sequence of notes, all within the scale you chose, obeying the constraints you set. The constraints are the point: a maximum step of one produces a stepwise line that a singer can pitch, a maximum of five produces something that only works on an instrument, and the shape setting decides whether the line rises, falls, arches or wanders. It gives you the note names and the scale degrees, because the degrees are what make a line transposable and are how most people actually think about melody.
How to use this tool
- Choose a key and a scale type — major, minor, one of the modes, pentatonic or blues.
- Set the largest step, in scale degrees. One gives you stepwise motion; four or more gives you a line full of leaps.
- Choose a shape and how many notes you want.
- Press Generate, then play it. Generate again for a different line under the same rules.
Understanding the controls
- Key and scale type
- Sets which notes are available. The modes are included and are genuinely different: Dorian and Aeolian differ by one note and sound very unlike each other. Pentatonic and blues scales have fewer notes, which makes large steps more common because the scale itself is more spread out.
- Largest step
- Measured in scale degrees rather than semitones, so it means the same thing in every key. One is stepwise motion. Two allows thirds. Four or more produces a line that leaps, which is harder to sing and often more interesting to play.
- Shape
- Ascending, descending, arch, valley and wave bias the line's direction. It is a bias rather than a rule on purpose — forcing every step of an ascending line upwards just produces a scale, and a melody needs to be able to turn back on itself while still going somewhere.
- Start and end on the tonic
- Ending on the tonic is what makes a phrase sound finished; ending elsewhere leaves it hanging, which is what you want if it is the first half of something. Some combinations are impossible — see the limitations — and the tool says so rather than quietly ignoring the request.
Worked examples
- Stepwise in C major
- C D E F E D C B C — a line a singer can pitch, every step one degree.
- Leaping, arch shape
- C E A G E C A F C — the same key with a maximum step of three, rising to a peak and coming back.
- Blues scale
- Fewer notes means larger gaps, so a maximum step of two in a blues scale already sounds like leaps.
- An impossible request
- Four notes, stepwise, starting and ending on the tonic is three steps of one degree — which can never return to where it started. The tool says so.
Common use cases
- Sight-reading practice at a level you control, without buying another book
- A starting phrase to develop when you are stuck writing
- Composition exercises with a stated constraint, as set in most theory courses
- Testing an instrument's range or a new fingering pattern on material you have not memorised
- Generating material for a student that is genuinely unfamiliar to both of you
How this generator works
The line is built as a walk along the scale, one step at a time, where each step is chosen from those within the limit and weighted towards smaller intervals and towards whatever direction the shape wants. Small steps are favoured because that is what makes a line singable rather than a series of jumps. Landing on the tonic is handled by solving the last few steps exactly rather than by overwriting the final note, which matters more than it sounds: at a maximum step of one the line has a strict parity, so whether the tonic is even reachable depends on whether the number of steps is odd or even.
Randomness and fairness
The randomness chooses between the steps the constraints allow, weighted towards small intervals and towards the shape you asked for. Everything the constraints require is guaranteed rather than sampled: the line never leaves the scale, never exceeds the step limit and never repeats a note in place, because those are enforced when each step is chosen. A seed makes a line reproducible so a teacher can set the same exercise for several students; that mode uses a deterministic, non-cryptographic generator, which is the only way the same line can come back twice.
For how randomness is produced across the whole site, see how Generate Random works.
Assumptions this tool makes
- The line is a single voice with no accompaniment implied.
- Steps are measured in scale degrees, so a step of two is a third in any key.
Limitations and good to know
- There is no rhythm. Every note is the same length until you give it one, and the site's rhythm generator is the tool for that half.
- It has no sense of phrasing, cadence or harmony. A line that satisfies the constraints is not the same thing as a good tune.
- Some combinations are arithmetically impossible — a stepwise line cannot return to the tonic in an odd number of steps — and the tool reports these rather than silently returning something else.
- There is no notation or audio. The output is note names and scale degrees, which is what fits in a notebook.
- Chromatic notes are never used, because the line stays inside the chosen scale by construction.
Common mistakes
- Expecting a tune
- This produces material, not music. A generated line is a starting point to develop, and the useful question is what you would change about it rather than whether it is good.
- Setting a large step limit and finding the result unsingable
- That is the constraint working. Lines that leap more than a third repeatedly are hard for voices and easy for keyboards — set the limit to match what will actually play it.
- Reading the note names and ignoring the degrees
- The degrees are the transposable part. A line remembered as 1-3-5-3 works in every key; the same line remembered as C-E-G-E works in one.
Practical tips
- Generate a line, then write a rhythm for it separately. Deciding the two independently produces better results than trying to hear both at once, and it is how a lot of composers actually work.
- Use a short line with a tight step limit for sight-singing and a longer one with leaps for instrumental reading. They train different things.
- If a generated line has one phrase you like, keep that and regenerate. Nothing says you have to use all of it.
Troubleshooting
- It says the line cannot end on the tonic
- With a step limit of one, returning to the tonic needs an even number of steps — so a four-note line starting on the tonic cannot manage it. Change the length by one, or allow a larger step.
- The line barely moves
- Small steps are weighted heavily on purpose, because that is what makes a line singable. Raise the step limit, or choose a shape rather than leaving it free.
Privacy and your data
Nothing is entered and nothing is stored. Melodies are generated in your browser, nothing is uploaded or written into the page address, and analytics records only that the tool was used along with the scale type and length — never a melody.
Frequently asked questions
- Will this write a melody for me?
- No, and it does not claim to. It produces a note sequence that satisfies constraints you set. Whether that is a melody depends on what you do with it — the rhythm, the phrasing and the harmony are all still yours, and they are most of what makes a tune.
- Why measure steps in scale degrees rather than semitones?
- Because a step of two degrees is a third in every key, whereas two semitones is a second in some contexts and something else in others. Degrees are also how players think — you move up the scale, not up the keyboard.
- Can I use a generated melody in my own music?
- Yes. It is produced by arithmetic in your browser rather than taken from any existing work, and short sequences of notes in a scale are not the kind of thing anybody owns. What you build on top of it is entirely yours.
- Why does the line never use notes outside the scale?
- Because staying in the scale is one of the constraints. Chromatic notes are what a composer adds deliberately, for a reason the tool has no way to know — so it produces the diatonic material and leaves that decision to you.
Related generators
- Improvisation Constraint GeneratorA rule to improvise under — three notes only, no repeated rhythms, start on the fifth — because a constraint produces more ideas than a blank page.
- Random Scale GeneratorDraw a random scale to practise — major, minor, modal, pentatonic or blues — correctly spelled, with its key signature and degree numbers.
- Random Rhythm GeneratorGenerate bars of rhythm to clap or play, in any time signature, with counting written underneath and every bar adding up exactly.