my dog learned polymorphism*
The moose likes Beginning Java and the fly likes JavaSound Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JavaSound" Watch "JavaSound" New topic


Charanjeet dhaliwal

Joined: Feb 21, 2013
Posts: 2
Hi Everyone!

I am new to Java and learning through HeadFirst.

MidiSystem.getSequencer() is throwing exception.

Even my system is having four MidiDevices(software implemented).

The exception is:
javax.sound.midi.MidiUnavailableException: MIDI OUT transmitter not available

How to solve the issue?

Please help!

Thanks and Regards,
Charanjeet singh
Charanjeet dhaliwal

Joined: Feb 21, 2013
Posts: 2
This problem is solved.

But now the program is not making any sound?

import javax.sound.midi.*;

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

public void play(){

MidiDevice.Info[] deviceInfo = MidiSystem.getMidiDeviceInfo();


MidiDevice md = null;

for(int i = 0;i < deviceInfo.length;i++){
md = MidiSystem.getMidiDevice(deviceInfo[i]);
System.out.println(deviceInfo[i].getName() + " : " + deviceInfo[i].getVendor());

Sequencer player = (Sequencer)md;;

Sequence seq = new Sequence(Sequence.PPQ,4);

Track track = seq.createTrack();

ShortMessage a = new ShortMessage();
MidiEvent noteOn = new MidiEvent(a,1);

ShortMessage b = new ShortMessage();
MidiEvent noteOff = new MidiEvent(b,1);


catch(Exception e){

Please Help...
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Welcome to JavaRanch Charanjeet. I would suggest you study the "OCJP for java 6" book by Kathy Sierra and Bert Bates if you are new to the language. It is written in lay man language and easy to understand. You need to get the fundamentals crystal clear.

~ Mansukh
jQuery in Action, 2nd edition
subject: JavaSound
Similar Threads
WA #1.....word association
counting algorithm
void return type in JSP expression
why JMX can not stop
Java ranch rules roundup