Java midi sound is weird

Hi @all,

2 days ago java did something, that I don’t understand at all.
I have a little program that plays music with javax.midi
and the
which I loaded by:

soundbank = MidiSystem.getSoundbank(new File(soundbankFile));
sequencer = MidiSystem.getSequencer();
trans = sequencer.getTransmitter();
synth = MidiSystem.getSynthesizer();
rcvr = synth.getReceiver();

On my computer it works quite well,
but 2 days ago a friend of mine called me and said,
that my tool has something like an echo.
It plays normal notes and with some milliseconds delay
something different, which sounds awful.
We have the exact same program, both the same
OS (XP) and the same java version (Build 1.6.0_15-b03).
Without loading the soundbank the problem doesn’t occur
on her pc. I don’t know what to do, this is completely strange.
As I said the problem seems to be down to loading a different soundbank,
but what difference could there be between my pc and hers?

If somehow two instruments are being associated with the same id (because the initial sound bank isn’t unloading), you could try out


Or do some checks with synth.getLoadedInstruments() to see if something strange is going on.

I acted on your advice but
it didn’t help.
Actually the synthesizer has 0 instruments loaded from the default soundbank.
It’s empty… ???
Also as I said, it seems really weird to me because the program
is working on my pc.
And in the past it worked on my friends pc as well, so it
can’t depend on the hardware, which hasn’t changed.
It’s also not the code.
I don’t know what to do, I
can’t even think of anything I could try out to examine this more.

If you try playing without loading the soundbank on the problem machine, does anything play? I’ve had situations in the past where the default synthesizer indicates that it doesn’t have any instruments, when in fact it does.

Yeah, you’re right, here as well without loading the soundbank
the program plays the default soundbank although the getLoadedInstruments()
method returns an emty array…
I tried something else:


Info [] dat = MidiSystem.getMidiDeviceInfo();
for (Info q : dat) {

the output is:

When I compiled the code
with 1.5 (done by changing the used JRE in eclipse)
the “error” disappeared and on all machines the sound was correct.

Maybe that helps you to help me :wink:

Someone here seems to have had the same problem, with the default soundbank playing at the same time as the new one:

Their “solved” reply doesn’t give much info though. Something to do with the location of their new soundbank’s .gm file. :-\

If I understand correctly the user there put
his soundbank into the JRE directory to replace the default one.
That solves the problem on a really low level,
because everybody has to do the same in their own
installation. One should not need to change the JRE package I think.
And that is also just a way around the actual problem.

Is this maybe a new bug in 1.6 ?