← all repositories
danieldjohnson/biaxial-rnn-music-composition

Neural network writes classical music, still needs a human page-turner

A 2015 LSTM project that generates MIDI compositions by predicting notes across two axes of time and pitch.

1.9k stars Python Image · Video · Audio
biaxial-rnn-music-composition
Velocity · 7d
+0.5
★ / day
Trend
steady
star history

What it does

This is a Python implementation of a biaxial recurrent neural network that learns from MIDI files and generates new classical-style music. It uses LSTM layers arranged in a grid-like structure inspired by convolutional networks—one axis tracks time, the other tracks which notes sound together. Feed it a folder of 4/4 MIDI files, train for 10,000 batches, and it spits out a composition with a built-in safeguard against awkward silences.

The interesting bit

The “biaxial” architecture is the clever part: instead of treating a musical score as a simple sequence, the model processes both the horizontal flow of time and the vertical stack of simultaneous notes. The gen_adaptive function also nudges the network to keep playing if it starts drifting into long rests—essentially a mechanical elbow to keep the muse awake.

Key highlights

  • Dual-axis LSTM design: separate hidden layers for temporal and harmonic dimensions ([300,300] and [100,50] by default)
  • Trained on eight-measure segments with dropout regularization (0.5)
  • gen_adaptive generation with anti-silence probability boosting
  • Weight saving/loading via pickle dumps
  • Includes EC2 setup scripts from the original 2015 training environment

Caveats

  • Built on Theano, which is now defunct; getting this running in 2024 is archaeological work
  • No validation set—the author explicitly prioritized “interesting music” over measurable accuracy
  • Hidden activation inspection is “still a work in progress” per the README
  • Requires MIDI files with notes quantized to beats; sloppy input yields sloppy output

Verdict

Worth studying if you’re curious about early deep-learning music generation or LSTM architecture experiments. Skip it if you want something trainable this decade; modern transformers and diffusion models have left this approach behind, but the biaxial concept still has pedagogical charm.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.