Name: gm110360 Date: 07/08/2003
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java Hotspot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows XP 5.1.2600
ADDITIONAL OPERATING SYSTEMS : Windows 98 4.10.2222
A DESCRIPTION OF THE PROBLEM :
Custom (RMF) soundbanks do not work, if soundbank.gm is not
available. If soundbank.gm is not available, hardware
synthesis is always used, even if the instruments are
available in a custom soundbank.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Play midi file using instruments from custom soundbank
when soundbank.gm is installed -> plays correctly
(uses software synthesis with custom soundbank)
2. Play midi file using instruments from custom soundbank
when soundbank.gm is not installed -> plays incorrectly
(uses hardware synthesis and ignores the custom soundbank)
EXPECTED VERSUS ACTUAL BEHAVIOR :
Custom soundbanks should always work, no matter if
soundbank.gm is installed or not, if the instruments from
soundbank.gm are not used.
Currently this is not the case; hardware synthesis is
always used if soundbank.gm is not installed, no matter if
I have all the instruments I need in a custom soundbank.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages, it just sounds bad
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Before trying out the code, COPY c:\jdk14\jre\lib\audio\soundbank.gm as c:\jdk14
\jre\lib\audio\custombank.gm, to simulate a custom soundbank.
When both soundbank.gm and custombank.gm are available, the midi player will
play test.mid correctly with software synthesis. When you delete soundbank.gm,
the midi player will NOT play the test.mid with instruments from custombank.gm,
it will use hardware synthesis instead.
import java.net.URL;
import java.io.*;
import javax.sound.midi.*;
public class MidiPlayer {
public static void main(String[] args) {
new MidiPlayer();
}
public MidiPlayer() {
try {
FileInputStream is = new FileInputStream(new File("c:\\jdk14
\\jre\\lib\\audio\\custombank.gm"));
Soundbank sb = MidiSystem.getSoundbank(is);
Sequencer seq = MidiSystem.getSequencer();
Synthesizer synth = MidiSystem.getSynthesizer();
URL midiFile = getClass().getResource("test.mid");
synth.open();
BufferedInputStream sequenceStream = new BufferedInputStream
(midiFile.openStream());
seq.open();
seq.setSequence(sequenceStream);
seq.start();
}
catch (Exception e) { }
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Rename your custom soundbank as soundbank.gm, and place it
to the same directory where your application is and it will
be loaded automatically and correctly. Note: do not put
soundbank.gm in a jar, or the work around will not work.
Other option is to ask the users to install (the real)
soundbank.gm, but this is rather stupid if you are not
using a single instrument from it.
(Review ID: 153945)
======================================================================