Customize loss function for Music Generation LSTM (?)
That's not a good way to represent symbolic monophonic music.
The biggest problem is that time should be modelled as a discrete and not a continuous variable. The reason for that is that music with notes that are off the beat sounds like crap. E.g if the tempo indicates that one beat is 250 ms long and one beat randomly is only 200 ms long it will sound very bad.
Instead, fix the tempo so that, say one quarter note is 125 ms long and have your time variable be an integer factor of that. You could cut the range to [1, 16] so that the shortest note is 125 ms long and the longest 2 000 ms (125 * 16).
Then I would skip the velocity because it is very hard to model. I don't think even state-of-the-art models incorporates it and most music sound fine even without it.
For pitches, I would cut down their range to three or four octaves. Most MIDI songs doesn't use more scales than that and it makes it much easier for your model to generalize.
So with four octaves, you are left with two variables $t \in [1,16]$ for time and $p \in [1,48]$ for pitch. You can either assume these are independent (which they aren't, but the generated music might still sound good!) and model them separately, giving you a sequence of pairs of discreete values:
$$
(t_1, p_1), (t_2, p_2), ...
$$
Or you could multiply $t$ and $p$ so that each input to the network is an integer in the range [1,16*48]:
$$
t_1p_1, t_2p_2, ...
$$
You could also interleave the input so that every other item in the sequence contains timing and pitch information:
$$
t_1, p_1, t_2, p_2, ...
$$
I don't know which way is the best - you'll have to experimetn.
I'm fairly certain it won't matter which loss function you choose. But I would go with crossentropy because it usually works well with discrete variables.