Skuldur / Classical-Piano-Composer

MIT License
602 stars 318 forks source link

Only one track, playing #28

Closed binary-person closed 4 years ago

binary-person commented 5 years ago

A normal piano midi has 2 tracks. One left and one right. When I trained it on some bach piano pieces, the loss went to around 0.1 and I ran the predict.py with the weights loaded. The results did sound like bach, but its only a mono track that's playing. I fed the network with 2 tracks for the piano. Is there something I didn't do?

SigurdurSkuli-CCP commented 5 years ago

Hi,

The network as it is on the master branch only supports a mono track. If you'd like to support 2 tracks you can try using a multi-input multi-output network where the inputs/outputs are notes/duration/offset. That should allow you to have as many tracks as you want.

Additionally, you can try using something like MuseGAN to create multi-track files.

binary-person commented 5 years ago

But it doesn’t make sense. It is obvious that a piano has two tracks and this repo’s name is self explanatory. Anyway, which branch has multi track support??

Skuldur commented 5 years ago

It does make sense. This is a single-track implementation. It only produces one note/chord for each offset so it would be difficult for it to be multi-track.

The multi-track support isn't ready. But it uses the multi-in/out method I detailed above.

jordan-bird commented 4 years ago

@binary-person you can merge the midi tracks into one single track using this: https://github.com/jordan-bird/Keras-LSTM-Music-Generator/blob/master/convertmidis.py Then use the new midis as your input to the network

The other way, like @Skuldur said is to have multiple inputs with the functional API but given that many midis have >2 tracks then it would eat resources and likely OOM

binary-person commented 4 years ago

The merging seems to provide a good effect on the result. I agree that by using multiple tracks, it would eat resources. I think that this repo should remain as is for the lessened complexity and easier understanding for future peeps.

Skuldur commented 4 years ago

That's exactly the point of this repo. :)

I've made a more complex version of this project that I've been debating whether to merge into the repo, but I feel like this should remain simple for people that are just getting their feet wet in music generation. I do need to do some refactoring in this repo when I find the time, though 😅

binary-person commented 4 years ago

@Skuldur I would love to see your multi-track implementation. Do you have the repo link?