I'm trying to retrieve the tempo of a midi file through the javax.midi
library.
MidiMessage message = event.getMessage();
if(message instanceof MetaMessage)
MetaMessage mm = (MetaMessage) message;
System.out.println(Arrays.toString(mm.getData()));
}
What I am expected to receive is an array of three ex, because the Set Tempo meta message (which is this case, has just 3 bytes specifying a miliseconds amount. This is how the midi event returns
0x07 0xA1 0x20
So if you join them you have 0x07A120 which is 500,000 ms, but Java returns in the print
[7, -95, 32]
First of all it is parsing it to decimal, and then I need to get this 500,000 number. I don't know how to do it because first I need to join all the hex, and then I will have the number, but I don't know how to do it.
Anyone can help me, please?