Sound & music

The Tune Finisher

Music is a string of notes. Robo learns which note likes to come after which, then makes up new tunes, one note at a time.

I don't know any songs yet! Press Teach me a song, and I'll listen and remember which notes follow which.

Piano roll ● you · ● Robo · ● songs

Robo's note map thick line = heard a lot

Next note: Robo's bets

Bets appear when Robo composes.

Checkpoints: tap to hear what Robo composed back then

A checkpoint is saved after each song Robo learns.

How it works

Notes are words

To Robo, a song is a list of notes, like a sentence is a list of words.

Listen and count

For every note, Robo writes down what came right before it. The lines on the note map grow thicker.

Bet on the next note

To continue a tune, Robo looks at the last notes and bets on what usually comes next.

One note at a time

It picks a note, adds it to the tune, then bets again. Note by note, a new song appears!

What just happened?

For grown-ups: what's really going on

This is a Markov chain / n-gram language model over musical tokens, trained by counting.

  • Tokens: each note is a token pitch:duration (e.g. E4:1, G4:2). The songs are traditional, public-domain melodies, simplified.
  • Model: for context length k (the “notes Robo remembers” slider), it stores counts c(context → next). Prediction is P(next | last k) = c / Σc, with backoff to shorter contexts when a context was never seen.
  • Sampling: probabilities are reshaped with a temperature T: pi ∝ pi1/T. Low T → greedy and repetitive; high T → random.
  • Memorisation vs generalisation: with k = 3 most contexts appear in only one song, so the model reproduces that song verbatim. With k = 1 it mixes songs freely but loses structure.

Real music models use the same next-token idea at scale. MusicGen (Meta) and MusicLM (Google) compress raw audio into discrete tokens with a neural audio codec (EnCodec / SoundStream), then a transformer predicts the next audio token, conditioned on a text description. Instead of counting, a transformer learns smooth, long-range patterns (rhythm, harmony, repetition), so it generalises far beyond the songs it heard.