# Teaching an LSTM to Play Beethoven

DevFeed: [Teaching an LSTM to Play Beethoven](<https://devfeed.tech/articles/teaching-an-lstm-to-play-beethoven-40104.md>)

Original publisher: [Read original article](<https://korbonits.com/blog/2015-07-01-lstm-beethoven/>)

Published: 2015-07-01T00:00:00Z

Content type: tutorial

Language: en

Sources: [Alex Korbonits](<https://devfeed.tech/sources/alex-korbonits.md>)

Topics: [MIDI](<https://devfeed.tech/topics/midi.md>), [Code](<https://devfeed.tech/topics/code.md>), [Lua](<https://devfeed.tech/topics/lua.md>), [GPU](<https://devfeed.tech/topics/gpu.md>)

Tags: [audio](<https://devfeed.tech/tags/audio.md>), [channel](<https://devfeed.tech/tags/channel.md>), [code](<https://devfeed.tech/tags/code.md>), [experiment](<https://devfeed.tech/tags/experiment.md>), [format](<https://devfeed.tech/tags/format.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [lstm](<https://devfeed.tech/tags/lstm.md>), [lua](<https://devfeed.tech/tags/lua.md>), [music](<https://devfeed.tech/tags/music.md>), [structure](<https://devfeed.tech/tags/structure.md>), [timing](<https://devfeed.tech/tags/timing.md>), [torch](<https://devfeed.tech/tags/torch.md>), [training](<https://devfeed.tech/tags/training.md>), [types](<https://devfeed.tech/tags/types.md>), [velocity](<https://devfeed.tech/tags/velocity.md>)

## AI overview

An experiment trains Karpathy's char-rnn LSTM on Beethoven piano sonata MIDI files, treating the raw MIDI bytes as a sequence. The author describes prepending a shared MIDI header to generated output so players could interpret it, and reports imperfect results containing occasional phrase-like and melodic fragments.

## Source excerpt

In June 2015, I trained Karpathy's char-rnn on a corpus of Beethoven piano sonata MIDI files. Here's what it sounds like -- and how I got it to play.