Endless Music Generator — Free Lofi, Ambient and Study Music in Your Browser
Press play and it starts writing music, bar by bar, and it does not stop. Chords that follow real harmony rather than a random walk, a melody over the top, a bass line and — depending on the mood — drums. Every piece grows out of a seed number, so the same link always plays the same music, and you can take any stretch of it away as a WAV or a MIDI file. It is algorithmic, not AI: no account, no credits, no queue, nothing uploaded. The whole composer is about thirty kilobytes of JavaScript running in this tab.
# What this actually is
An endless music generator is a program that writes music while you listen to it. This one runs entirely in your browser tab. There is no model, no server, no queue and no credits: the whole composer is a few hundred lines of JavaScript that chooses a key, walks a chord progression, draws a melody over each chord and hands the result to a synthesiser built out of Web Audio oscillators. It produces a bar of music roughly every three seconds and it will keep doing that until you close the tab.
Nothing is uploaded, because there is nothing to upload. Nothing is downloaded either, apart from the page itself — there are no samples, no soundfonts and no audio files. If you turn off your wi-fi after the page has loaded, it carries on composing exactly as before.
# Algorithmic, not AI
Almost everything that calls itself a music generator today is a machine-learning service: you type a prompt, a server somewhere renders audio, and you get back a file — after an account, a credit balance and a wait. Those tools can do things this one cannot, and if you want a full arrangement with vocals from a sentence of description, you want one of those and not this.
This is the older idea, and for background music it is the better one. Music that comes out of explicit rules can be endless, instant, free and reproducible at the same time. There is no cost per minute, so it never has to stop. There is no inference step, so the first bar plays the moment you press the button. And because a single random seed drives every decision, the piece is a number: share the number and the music comes back, note for note, on any machine.
# How the music is put together
The harmony is not a random walk
The most obvious way to generate chords — pick one from the key at random, repeat — sounds immediately wrong, and it is worth understanding why. Music in a key has a pull towards home. The dominant chord wants to resolve to the tonic; the subdominant wants to move to the dominant; the relative minor works as a substitute for the tonic. A uniform random choice throws all of that away, and what comes out is recognisably a computer: every chord is plausible, and no sequence of them goes anywhere.
So the chords here come from a weighted transition table — an ordinary Markov chain, but with the weights written to match functional harmony rather than filled in evenly. From the dominant, the tonic is five times as likely as anything else. From the tonic, five different moves are all reasonable. On top of that sits cadence pressure: once the harmony has been away from home for longer than the mood allows, the table is overruled, the next chord is steered towards a dominant, and the one after that resolves. That single rule is most of the difference between music that wanders and music that breathes.
The melody follows the chord
Each bar, the generator decides on each sixteenth whether to place a note. Strong beats are more likely than weak ones, and strong beats prefer chord tones while weaker positions can use any note of the scale. The next note is usually a step from the last one, with an occasional leap, because a line made entirely of leaps sounds exactly like the random number generator it is. Rests are deliberately frequent: the ambient mood plays a note about once every eight beats, and the restraint is what makes it usable as background rather than as something you have to listen to.
Bass, voicing and drums
The bass follows the root of the chord, in a pattern chosen by the mood — a drone for ambient, root and fifth for lo-fi, a walking line for jazz. Chord voicings are chosen by voice leading: of all the inversions in a sensible register, the generator picks the one whose notes move the least from the previous chord, so the pad never jumps an octave between bars. Drums, where a mood has them, are sixteen-step patterns with probabilistic steps, so two passes through the same loop are never quite identical.
# The eight moods
| Mood | Tempo | Scales | Drums | Good for |
|---|---|---|---|---|
| Lo-fi | 68–86 | minor, dorian | lo-fi kit | working, reading, a stream |
| Study | 74–90 | major, dorian | brushes | revision, deep work |
| Ambient | 50–64 | lydian, major | none | sleep, meditation, writing |
| Drift | 60–76 | dorian, minor | soft pulse | long focus sessions |
| Cinematic | 58–72 | minor, phrygian | soft pulse | video beds, trailers |
| Jazz café | 96–132 | dorian, minor | brushes | a room that needs noise |
| Piano & rain | 54–70 | major, minor | none | sleep, anxiety, rain sounds |
| Chiptune | 120–156 | major, mixolydian | chip kit | game prototypes |
A mood is a set of ranges, not a set of fixed values. Two lo-fi pieces are recognisably the same genre without being the same music: the tempo, the key, the scale, the chord rhythm and the harmonic path are all drawn fresh from the seed inside the bounds the mood sets.
# What the seed is for
Every decision the generator makes comes from one seeded pseudo-random number generator — a small function called mulberry32 that turns a number into an endless, repeatable stream of randomness. Feed it the same seed and it gives you the same stream, in the same order, forever. That is why the share link works, why the WAV export sounds like what you were listening to, and why you can write down a seven-digit number today and get the same piece back next year.
There are just over four billion seeds. If you hear something you want to keep, copy the link before you press
NEW PIECE — you will not find it again by chance.
# Using the music
Nothing generated here is copyrighted by anyone, and none of it is watermarked. Use it in a video, a podcast, a Twitch stream, a game, a shop, a waiting room or a school project. You do not need to credit this page (though it is always welcome), you do not need a licence, and there is no rights-management system waiting to strike your upload — the audio was synthesised in your own browser from arithmetic, a few seconds ago.
For anything longer than a few minutes, export a WAV and loop it, or leave the tab open and record your system audio. For scoring to picture, take the MIDI instead: it arrives as four tracks — chords, melody, bass and drums on channel 10 — so you can swap in real instruments, stretch the tempo and edit the notes in any DAW.
# If it is not quite right
- Too busy? Pull melody density down, or mute the melody entirely and leave chords and bass. Ambient with the melody muted is close to a pure drone.
- Too static? Push density up, switch to jazz café, or press
SKIPto force the harmony on. - Wrong tempo for what you are doing? The tempo slider is independent of the piece — the notes do not change, they just arrive faster or slower.
- Too clean? Vinyl crackle and tape wobble are what make the lo-fi moods sound like lo-fi. Turn them up. Wobble is real pitch modulation, not an EQ curve.
- Falling asleep to it? Set the sleep timer. It fades out over the last twenty seconds rather than stopping dead, which is much less likely to wake you.