Music can be generated even with the help of artificial intelligence. The following model uses LSTM to train our model on music dataset. Further it generates its own music using some random seed.
https://www.kaggle.com/chetanmj23/pop-music-collection
- The model used is sequential
- The model uses two layers of LSTM with two layers of Dropout(All alternatively)
- The last layer is ofcourse a Dense Layer with linear activation
- Reading midi files using mido library functions.
- Data preparation for feeding our model: Data_Preparation.ipynb does the same, by converting midi files in required numpy arrays.
- Trainig the model on above dataset
- Generating a song for random seed and saving it as midi file.
The machine was able to generate the music, although it does not sound as much good (nor too bad). But it might be possible that in near future, with the help of new innovations, machines can do so.
There may be various ways of playing midi/mid files, The easiest one according to me is summarized below: Open the terminal and enter:
sudo apt-get install timidity timidity-interfaces-extra
Enter your password, another prompt may appear type, Y and hit enter.
Go to your menu, you should now have an application called TiMidity++ launch it.