JDK-4887447 : custom soundbanks don't work if soundbank.gm is not available
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-07-08
  • Updated: 2003-09-27
  • Resolved: 2003-09-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Description

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) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b22
14-06-2004

PUBLIC COMMENTS custom soundbanks don't work if soundbank.gm is not available
10-06-2004

EVALUATION ###@###.### 2003-08-07 Probably an internal logic that deactivates the synthesizer completely if the standard soundbank cannot be found.
07-08-2003