Classical Piano GPT
This is a gpt style neural net trained on classical piano music. You can listen to some samples of the music it can generate here.
About this project
Here is a simplified summary of how this project was done.
First off, we need a music dataset. Midi files are lightweight and easy to work with. I found a website where a kind german hosts a bunch of them. I parsed those midi files into sequences of notes and produced a dataset.
A useful preprocessing step before training the model is tokenizing the dataset. Not only does it compress the data but it makes the data easier to learn. The legend Andrej Karpathy has a nice youtube video explaining it well.
Now we are ready to build and train the model. Current state of the art for training/modeling sequences is still the Transformer architecture introduced in the landmark paper from 2017: Attention is all you need but with some improvements over the years.
Anyway, this is what chat-GPT uses, and it is open source so anyone can look at the code. So I did that: adapted it to my use case, trained a model and generated some samples.
The last step was building a website and using Web Audio Api to play those samples. The generated music is incredibly lightweight in size: Around 0.001 MB per minute of music. They are fetched, unpacked and then played on each button click.
You can find some of my other project at andyfx.net