I'm trying to get the number of Tracks of a MIDI sequence:
File file = new File(strSource);
Sequence sequence = MidiSystem.getSequence(file);
int numTracks = sequence.getTracks().length;
... where strSource is the full path+file name of my .mid file. numTracks is 1, but the .mid file has 16 tracks (as i can see when i open it in another MIDI editor). The file type is 0.
I read somewhere that type-0 files can't have multiple tracks for the same channel. In this case all tracks are forced into a single track. Is that correct? How can I avoid that?
It seems you're right, type-0 files hold multiple tracks in just one. Here you have some info.
Isn't possible to extract each separate track from a type 0 file.
Check MIDI file type, if an external MIDI editor can detect multiple tracks, it can be a type 1 or type 2 file, even if extension doesn't match.