It seems that what you want to change is not the synthesizer but the patch, or more specifically, do a 'program change'.
Probably something like:
1 2 3
| ShortMessage msg = new ShortMessage(); msg.setMessage(ShortMessage.ROGRAM_CHANGE, 1, 2); MidiSystem.getReceiver().send(msg, -1); |
This will set program 2 on midi channel 1.
Or have a look at MidiChannel.programChange(int bank, int program) or MidiChannel.programChange(int program).
Mind you, I've never used MIDI using JavaSound and I didn't actually test this but maybe this will point you in the right direction
