MIDIT – symbolic music infilling

MIDIT is a BERT-style masked language model for multi-track MIDI (code). Pick an 8-bar window, choose bars to remove, and the model rewrites what is played in them (pitch, velocity, duration, instrument) from the music before and after the gap.

Results vary a lot from song to song; see the thesis for averages over 50 validation windows.

MIDIT was trained only on files with at least 50 notes, at least 15 s of music and non-constant velocities. Files that fail these checks are rejected, as in the command-line tool; enable this to try them anyway (outside the training distribution).

Upload a MIDI file or load an example.

0 1
Bars of the window to mask (1–8)

Masks only the pitch, velocity and duration of the notes of one instrument in the selected bars and keeps everything else, including that instrument's Program tokens. Outside the training protocol (BarFillMasking masks all instruments in a bar); quality not evaluated.

Instrument

What the model does. It sees an 8-bar window of REMI+ tokens. In the masked bars the note content (pitch, velocity, duration, instrument) is replaced by [MASK]; the rhythmic scaffold (bars, onsets, tempo, time signature, rests) is kept, so the model predicts what to play, not when. All masked tokens are predicted in one pass with argmax decoding: the same input always gives the same output, identical to the command-line tool scripts/inference/infer_from_midi.py.

What it does not do. It does not generate new rhythms or new bars, does not see beyond the 8-bar window, and does not sample alternatives. Simultaneous masked notes are predicted independently, so duplicate notes can occur.

GitHub repository · Errata · Checkpoints · Example files: Lakh MIDI Dataset (CC BY 4.0)