Most imporvisation networks are pretty heavy and use Sequence to sequence models.Here,midi library in pythonn is used to convert the notes into musical information such as Note on ,Set tempo and Control Change. This text file is later used by LSTM network to train.We use this network to predict the next feature.
Demo (Original MP3) | Demo (Generated MP3)
- Keras
- TensorFlow
- Python MIDI
- Numpy
Python Midi library is not available for pip install.It is maintained here:https://github.com/vishnubob/python-midi
Midi supports total 27 events.We have used 3:
1."Note On"
2."Set Tempo"
3."Control Change"
These are sufficient for Beethoven Classical Piano midi files.http://www.piano-midi.de/beeth.htm
For other types of music please use other events this library supports.
python3 parse_midi_to_text.py
python3 training.py
This is done on Nvidia Jetson TX2. But any GPU is fine.The aim to record files on fly and improvise them.
python generate_music.py
- Change the file
original_song.mid
to the file you want.We added an USB microphone to record on Jetson - You may have to choose track as index of the pattern in
parse_midi_to_text.py
.However,the midi library does have this feature.
*Siddharth Bhonge https://github.com/siddharthbhonge
Sequnce to Sequnce Model from Andrew Ng's Deep Learning Specialization.
But personally this is a better one.