I have this code:
Synthesizer synthesizer = MidiSystem.getSynthesizer();
synthesizer.open();
Instrument[] instrument = synthesizer.getDefaultSoundbank().getI
Sometimes you have some volume events in the midi file so you cannot change channel volume. After getting the sequence, remove these events :
Track[] tracks = sequence.getTracks();
for (Track track : tracks){
for(int i = 0; i < track.size(); i++){
if(!track.remove(track.get(i))){
System.out.println("MIDI Event not removed");
}
}}