Hello,
I build an applet that plays midi files from a server. The problem is when I start playing the file (MidiSystem.getSequencer()).. it gives me this error in the java console and nothing plays:

SEVERE: null
javax.sound.midi.MidiUnavailableException: MIDI OUT transmitter not available
	at com.sun.media.sound.AbstractMidiDevice.createTransmitter(Unknown Source)
	at com.sun.media.sound.AbstractMidiDevice.getTransmitter(Unknown Source)
	at javax.sound.midi.MidiSystem.getSequencer(Unknown Source)
	at javax.sound.midi.MidiSystem.getSequencer(Unknown Source)
	at pdcPanel.play(pdcPanel.java:130)
	at pdcPanel.jButton1ActionPerformed(pdcPanel.java:245)
	at pdcPanel.access$000(pdcPanel.java:32)
	at pdcPanel$2.actionPerformed(pdcPanel.java:185)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Here is the code to play the file from URL:

if(sequencer!=null)   sequencer.stop();

        sequence = MidiSystem.getSequence(new URL(songURL));

        // Create a sequencer for the sequence - here I get the Exception
        sequencer = MidiSystem.getSequencer(true);

        sequencer.open();
        sequencer.setSequence(sequence);

        sequencer.start();

How can be mid out transmitter not available? Is there a way to make this work?
Thanks.

Dani AI

Generated

A few practical notes for — signing the JAR fixed the security exception, so silence now usually means the Sequencer isn’t actually driving a Synthesizer (or the synth has no soundbank/volume). The default call MidiSystem.getSequencer(true) will try to connect the sequencer to the default synthesizer, but that connection can be missing or use a device with no instruments. See the MidiSystem docs for how that default connection is handled. MidiSystem.getSequencer docs. (docs.oracle.com)

Do these checks in order: enumerate devices/mixers, then try an explicit wiring of sequencer→synth, then check soundbank/volumes and OS mixer. Example device listing:

for (MidiDevice.Info info : MidiSystem.getMidiDeviceInfo()) {
    System.out.println(info.getName() + " - " + info.getDescription());
}
for (Mixer.Info m : AudioSystem.getMixerInfo()) {
    System.out.println("Mixer: " + m.getName());
}

If a Synthesizer exists, explicitly connect it instead of relying on the automatic wiring:

Sequencer seq = MidiSystem.getSequencer(false);
Synthesizer synth = MidiSystem.getSynthesizer();
seq.open();
synth.open();
seq.getTransmitter().setReceiver(synth.getReceiver());
seq.setSequence(sequence);
seq.start();

This manual wiring is the recommended pattern in the Java Sound guide. Programmer Guide: connecting transmitter/receiver. (docs.oracle.com)

If you hear nothing after that, check the synthesizer’s default soundbank and loaded instruments (some implementations don’t auto-load instruments), and force channel volume up:

for (MidiChannel ch : synth.getChannels()) ch.controlChange(7, 127);

See Synthesizer docs for getDefaultSoundbank() and instrument loading. Synthesizer API. (docs.oracle.com)

Also verify the Java console for warnings, browser/plugin audio settings, and the OS mixer — those commonly hide the sound even when Java thinks it’s playing.

Hi, I figured this out by signing the JAR file. Now the problem is I play the midi file but hear nothing. What now? No error in the console, all seems ok but I have no sound.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.