Machines can’t do ART…

But they are very good at learning patterns and reproduce them, so let’s try to build an “AI” (or whatever you want to call it…) that can produce (originals) parts of music !
And like always, everything starts with data…
While computers are not that good to deal with audio, midi format fits perfectly for the job (for non musicians, midi files are like text files where you write the notes/lenghts/velocities/etc as successives numbers). So we take a bunch of piano solo midi files, put them all together, before we split them in chunks of N notes …
We will give those successive chunks of notes to an Artificial Neural Network, that will have to predict the next single note, knowing the N past notes.

In order to do so, we compute the midi files so the Neural Net can read them, and, with the help of several LSTM (Long SHort Term Memory) layers, after approx 10 epochs of learning (100 time the whole dataset), we achieved the result you can ear from here :
These 3 piano parts have been integrally improvised by the Neural Network, no post processing have been done except we used a piano patch to make it sound better…
Not that bad for a machine !
But one of these songs turned out to be a perfect copy of the original (a beautyfull example of “overfiting”), can you gess wich one ?
As usual, you can find all code on my GitHub !