Soundovia

Melody Generator

The melody generator writes a random melody in any key and scale, plays it over chords from the key, and lets you edit it on a piano roll and save it as a MIDI file.

Tap the piano roll to edit: tap an empty spot to add a note, tap above or below a note to move it, tap a note to remove it. Keyboard: R makes a new melody, Space plays and stops.

How to use the melody generator

This melody generator writes a new random melody in any key and scale, plays it on piano over chords from the key, and lets you edit the notes on a piano roll and download the result as a MIDI file, so it works as a small music maker online for sketching ideas. The melody generator makes a new melody each time you press New melody (or R). Choose the Key and Scale first: major, natural, harmonic and melodic minor, the major and minor pentatonic, blues and the modes from Dorian to Locrian. Then set how long it is (Bars: 1, 2, 4 or 8) and the Time signature: 4/4, 3/4, 2/4 or 6/8.

Sparse, Medium and Busy set how many notes there are: sparse uses quarter and half notes, busy adds eighths and sixteenths. Range sets how far the tune can travel (one octave up to two), Register moves it low, middle or high, and the Steps to Leaps slider decides how often it jumps instead of moving to the next scale note.

Press Play (or Space) to hear it on piano. With Chords underneath on, each bar also plays a chord from the key, and the chord names appear in square brackets before the notes of each bar. The tempo slider counts quarter notes per minute. Changing a setting rewrites the melody with the same random seed, so you can compare the same idea in another key or scale.

The rules that make it sound like a tune

A melody made of purely random notes wanders. This one follows a few habits of simple melodies:

Rests appear now and then, never on the first note and never in the last bar.

The chords underneath

The chords are the triads of the key: a chord built on each note of the scale by stacking every other note, the same way the chord progression generator builds them. In C major that gives C, Dm, Em, F, G, Am and Bdim. Pentatonic and blues scales have too few notes to stack, so they borrow the chords of the major or natural minor key with the same tonic. Each melody picks a short progression that starts on I and ends on I, such as I, IV, V, I.

Edit on the piano roll

The piano roll shows time from left to right and pitch from bottom to top. Shaded rows are notes outside the scale, the darker vertical lines are bar lines and the note names on the left mark the tonic and each C. Tap an empty spot to add a short note, tap above or below a note to move it to that pitch, and tap a note to remove it. The note names under the roll update as you edit. To try notes by ear first, the online piano and the piano scales page are one click away.

Download the melody as a MIDI file

Download MIDI saves a .mid file you can open in a DAW, notation program or phone music app to change the sound, add parts or print it as sheet music. A MIDI file is not a recording: it is a set of instructions such as pitch and tempo. This one is a type 0 file, the kind that holds the whole performance on a single track, with the melody on MIDI channel 1, the chords (if they are on) on channel 2, and the tempo and time signature you chose.

Questions

How does a random melody generator work?

It picks notes from a scale using rules instead of pure chance: mostly steps, leaps followed by a step back, chord tones on strong beats and an ending on the key note. The rhythm is built beat by beat so every bar adds up to the time signature.

What is the difference between 6/8 and 3/4?

Both have six eighth notes in a bar. In 3/4 they are grouped as three quarter-note beats; in 6/8 they are grouped as two beats of three eighth notes each. The generator builds its rhythms on those beats, so the two sound different.

Why does my melody end on the same note it started?

It ends on the tonic, the note the key is named after, because that is what makes a phrase sound finished. It often starts there too, though it can start on another note of the first chord.

How do I get fewer jumps in the melody?

Move the Steps to Leaps slider to the left. At the far left almost every move is to the next note of the scale; to the right it leaps more often, and each leap is still followed by a step back.

Can I open the MIDI file in GarageBand or a DAW?

Yes. It is a Standard MIDI File (.mid), which music software can import. The melody and chords come in as notes you can reassign to any instrument.

More tools