Random MIDI Riff
Generate a short pentatonic-scale MIDI riff as bytes/base64.
Overview
The Random MIDI Riff generator emits a short pentatonic-scale melody as a downloadable Standard MIDI File (and as a base64 payload for embedding). Click generate and you get a 4-8 bar riff in a randomly picked key, tempo and rhythm — useful as a quick demo idea, a placeholder soundtrack or a starting point for further composition.
The generator is aimed at indie game developers wiring up placeholder audio, songwriters hunting for a melodic prompt, music teachers demoing scale theory and content creators needing royalty-free filler. Long-tail searches like "random midi melody generator pentatonic", "midi riff seed online" and "free placeholder midi loop" all resolve here.
How it works
Pentatonic scales (five notes per octave) avoid the dissonant intervals of the full diatonic scale, so any sequence of pentatonic notes sounds vaguely "musical". The tool picks a root note uniformly at random, decides between major and minor pentatonic, then samples 16-32 notes from the scale. Note durations come from a small palette of rhythmic values (eighths, quarters, dotted eighths) weighted to produce a danceable feel. Tempo is drawn from the 80-140 BPM range.
The riff is serialised as a Standard MIDI File: a 14-byte header, a tempo meta-event, instrument program-change and a sequence of note-on/note-off events with delta-time encoding. The result is bytes that any DAW, MIDI player or browser-based synth (via Web MIDI or Tone.js) can play immediately. Randomness comes from the OS cryptographic source.
Examples
Key C major pentatonic, 120 BPM → cheerful 8-bar riff
Key A minor pentatonic, 90 BPM → bluesy slow riff
Key F# major pentatonic, 140 BPM → upbeat dance lick
Output → 287 bytes of valid SMF, base64 ready for embedding
FAQ
Will the riff sound good?
Pentatonic scales avoid harsh intervals, so the riffs are pleasant if not always melodically inspired. Use them as a starting point and iterate.
Can I edit it in a DAW?
Yes. The SMF file imports into Ableton, Logic, FL Studio, MuseScore and anywhere else that reads General MIDI.
Why MIDI rather than WAV?
MIDI is tiny (a few hundred bytes), instrument-agnostic and trivial to remix. Render to audio in your DAW with whatever synth you like.
Is the output royalty-free?
Yes. The melody is generated locally from public-domain scale theory; you own whatever you produce.
Can I lock the seed?
Currently the riff is drawn fresh on each click. Copy the base64 if you want to preserve a particular riff.