corynguyen19 / midi-lstm-gan

Using LSTMs and GANs to Generate Music from MIDI Files (APM Fall 2018)
82 stars 30 forks source link

What is the meaning of 242 ? #3

Open buzem opened 4 years ago

buzem commented 4 years ago

In this line : pred_notes = [x*242+242 for x in predictions[0]]

Hanyman8 commented 4 years ago

Hello, I tried to figure it out too. And it seems, that the dimension of midi file or n_vocab in file was 242.. You can try to use.

pred_notes = [((x+1)*(n_vocab)/2) for x in predictions[0]]
pred_notes = [int_to_note[int(x)] for x in pred_notes]

It's because the data for learning is normalised between -1 and 1 and to save it prediction to midi, zou have to strech the data back.