Melody Sketch Generator
Pick one of 12 keys and 9 scales (major, natural and harmonic minor, Dorian, Phrygian, Lydian, Mixolydian, and major and minor pentatonic), then set up to 128 notes, the note lengths the rhythm may use, a range between A0 and C8, a seed and a tempo. The generator walks through the notes of that scale by rules it states: it opens on the tonic, third or fifth where the range allows, moves mostly by step, steps back after a leap of three or more scale steps and ends on the tonic when the range includes one. The same settings and seed always give the same melody. Drag a note up or down, or use the arrow keys and the edit buttons, to change pitch, length and order. Hear it on a simple built-in synth, then download a MIDI file for your DAW or a project JSON that reopens here.
Settings
Focus a note: Up and Down move it a scale step, with Shift a semitone; Left and Right pick the next note, with Shift shorter or longer; Delete removes it and Enter plays it. Drag a note up or down to change its pitch.
Text equivalent: Piano roll, pitch rows C4 to C5; rows outside C major or the chosen range are shaded, and notes there are drawn in coral. Notes in order: C4 for 0.5 beats, D4 for 0.5 beats, F4 for 0.5 beats, D4 for 0.5 beats, C4 for 1 beat, D4 for 0.5 beats, F4 for 0.5 beats, C4 for 2 beats.
Note 1 of 8: C4, MIDI 60, eighth, 0.5 beats, bar 1 beat 1
- Notes
- 8
- In scale and range
- 8 of 8
- Length
- 6 beats, 3.0 s
- Lowest to highest
- C4 to F4
Worked cases
- 60 62 64 65 67 69 71 72 (8 MIDI notes)
- 57 59 60 62 64 65 67 69 (8 MIDI notes)
- tempo 500000 microseconds per quarter; note-on to note-off 960 ticks
Generated and played in this browser, with nothing uploaded and no account. Your last melody, its settings and its tempo are kept on this device, and the Start over button above the tool forgets them.
Common questions
- How does the melody generator pick the notes?
- It lists every note of your key and scale between the lowest and highest note you set, and only those notes can appear. The first note is the tonic, third or fifth in the lower half of that range when one is there. From there it mostly moves one scale step at a time, sometimes repeats a note or skips one, and occasionally leaps three or four scale steps. After a leap of three or more steps the next note steps back the other way, the note before the close moves by a step or a skip, no pitch sounds three times in a row while another note is available, and the further the line drifts from the middle of the range, the more likely it turns back toward it. A melody of two or more notes ends on the tonic nearest the note before it when the range contains a tonic, and a range with only one note of the scale repeats that note. Lengths come from your rhythm pool: off the beat, a length that lands on the next beat or stays inside the current one is chosen whenever the pool has one, and the last note takes the longest length in the pool. There is no AI model and no library of existing tunes behind it.
- Will the same seed give me the same melody again?
- Yes. The same key, scale, note count, rhythm pool, range and seed always produce the same notes, so writing down the seed is enough to get a melody back. Tempo does not change the notes. Pitches and rhythm come from separate streams of the seed: changing only the rhythm pool keeps the pitches and changes the lengths, and a longer melody from the same seed starts with the same notes as a shorter one, apart from the shorter one's last two notes, which lead into its close. New seed draws a random seed from 0 to 999,999 and generates straight away. Your edits are not part of the seed, so save a project JSON to keep an edited version.
- How do I edit notes in the piano roll?
- Click or tap a note to select it, and drag it up or down to change its pitch by semitones. With a note focused, Up and Down move it one scale step, Shift with Up or Down moves it a semitone, Left and Right select the previous or next note, Shift with Left or Right makes it shorter or longer, Delete removes it and Enter plays it. The buttons under the roll do the same, and can also move a note earlier or later or duplicate it. A melody holds 1 to 128 notes, lengths run from a sixteenth to a whole note, and pitches from A0 to C8. Notes you move outside the key or the range are drawn in coral, and the readout shows how many notes are still inside both.
- What is in the MIDI file?
- A Standard MIDI File, format 0, with one track at 480 ticks per quarter note. It holds a track name, your tempo (500,000 microseconds per quarter note at 120 BPM), a 4/4 time signature, and a note-on and note-off for every note in order on channel 1 at velocity 100, so a half note spans 960 ticks. There is no program change, so the program you open it in chooses the instrument. Middle C is MIDI note 60, written C4 on this page.
- Can I save a melody and keep working on it later?
- Save project JSON downloads the settings, the tempo and every note, including your edits. Open project JSON loads such a file back after checking all of it, and a file that fails the check leaves your current melody as it was. After you generate, edit, open a project or change the tempo, the page also keeps that melody, its settings and the tempo in this browser, and the Start over button above the tool clears them. Copy note list puts the melody on the clipboard as text: a heading line, then one line per note with its name, MIDI number, length and position in the bar.
- Does playback use real instrument sounds?
- No. Play sounds each note on a plain triangle-wave oscillator through the browser's Web Audio, at the tempo you set, with no instrument samples. Stop silences it at once, and changing a note or the tempo, hiding the tab or leaving the page stops it too. The MIDI file carries no sound of its own: the program you open it in plays it with its own instruments.
- Is the melody original, and will it sound good?
- Each melody is drawn from your settings by the rules above, not copied from a collection of existing songs. Short stepwise lines in a common scale can still resemble phrases that already exist, and nothing here checks for that. The rules keep the notes in your scale and range and give the line a shape; they make no judgement about whether it sounds good, so treat the result as a sketch to edit.
Rule-based music sketch, not AI composition or a quality guarantee. No copied melody corpus or instrument samples.