• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

javax.sound.midi compatibility with JMF

Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting a MidiUnavailableException : MIDI OUT transmitter not available
The code is the MiniMusicApp from the Head First Java book
The program was working great until I installed JMF 2.1.1e. Since then I get the above error. I am running JDK 1.6.06 and JRE 1.6.06 on Windows XP. I can play MIDI files through Windows Media Player - no problem.
javax.sound.sampled is working fine


import javax.sound.midi.*;

public class MiniMusicApp { // this is the first one

public static void main(String[] args) {
MiniMusicApp mini = new MiniMusicApp();

public void play() {

try {

// make (and open) a sequencer, make a sequence and track

Sequencer sequencer = MidiSystem.getSequencer(); //***** Blows up here ********

Sequence seq = new Sequence(Sequence.PPQ, 4);
Track track = seq.createTrack();

// now make two midi events (containing a midi message)
MidiEvent event = null;

// first make the message
// then stick the message into a midi event
// and add the event to the track

ShortMessage first = new ShortMessage();
first.setMessage(192, 1, 102, 0);
MidiEvent setIns = new MidiEvent(first, 0);

ShortMessage a = new ShortMessage();
a.setMessage(144, 1, 82, 120);
MidiEvent noteOn = new MidiEvent(a, 1); // <-- means at tick one, the above event happens

ShortMessage b = new ShortMessage();
b.setMessage(128, 1, 82, 120);
MidiEvent noteOff = new MidiEvent(b, 64); // <-- means at tick one, the above event happens

// add the events to the track

// add the sequence to the sequencer, set timing, and start

// new
} catch (Exception ex) {ex.printStackTrace();}
} // close play

} // close class

I noticed a similar issue was filed in 2005 but that was never answered, hence my request again for info. If Sun continues to make JMF available for download then it should be supported?
Further, if this a known problem with no solution, then the book or their website should warn you not to install JMF
John Calson
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This solution assumes:
- Windows XP SP3
- JDK 1.6+
- JRE 1.6+

The problem is the file sound.jar
Find it in 3 places and delete it.

C:\Program Files\JMF2.1.1e\lib\sound.jar
C:\Program Files\Java\jdk1.6.0_07\jre\lib\ext\sound.jar
C:\Program Files\Java\jre1.6.0_07\lib\ext\sound.jar

Also, remove sound.jar reference from PATH and CLASSPATH

This is an old sound.jar that messes up the new sound API in the new versions of Java.
    Bookmark Topic Watch Topic
  • New Topic