Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8054798

Java Sound Synthesizer stucks after receiving certain amount of MIDI-Events on M

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_31"
      Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646)
      Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.7.4

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      This problem exists since Mac OS X Lion in general.

      A DESCRIPTION OF THE PROBLEM :
      Since the Lion version of Mac OS X, the behavior is the following:

      After sending a certain amount of MIDI Events (approx. 100-300) into the Java Sound Synthesizer, it doesn't accept any events any more (Note ON, Note OFF,..). Notes, which are ON are still audible because OFF Notes are not accepted, new ON Note - Events are not played. No Error-Message.

      It seems, a MIDI-Event buffer overflows. After sending even more events into the Java Sound Synthesizer, it starts playing again, while pending notes go on playing (Notes, which couldn't get turned off during the problem phase.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to play a MIDI-File with lots of notes. In this case it doesn't take long and all notes will stuck. Keep sending MIDI messages and the synth will start working again. Keep sending MIDI messages, the synth will again stuck,..

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The synth will stuck.
      ACTUAL -
      The synth will stuck.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      no error is thrown.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.sound.midi.*;
      import java.io.InputStream;
      import java.io.IOException;
      import java.io.FileInputStream;
      import java.io.FileNotFoundException;

      public class MidiPlayer {

        public static void main(String[] args) {
            try {
                Sequencer sequencer = MidiSystem.getSequencer();
                if (sequencer == null)
                    throw new MidiUnavailableException();
                sequencer.open();
                FileInputStream is = new FileInputStream("sample.mid");
                Sequence mySeq = MidiSystem.getSequence(is);
                sequencer.setSequence(mySeq);
                sequencer.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Route MIDI-Data to another Synthesizer, e.g. Logic, Garage Band, Pro Tools, Cubase. This is complicated and not appropriate for most of applications.

        Attachments

          Activity

            People

            • Assignee:
              serb Sergey Bylokhov
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: