wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Headfirst Book - No Output of this program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Headfirst Book - No Output of this program" Watch "Headfirst Book - No Output of this program" New topic
Author

Headfirst Book - No Output of this program

Zakir Hosain
Greenhorn

Joined: Apr 28, 2007
Posts: 16
import javax.sound.midi.*;
public class MiniMiniMusicApp
{
public static void main (String [] args)
{
MiniMiniMusicApp mini = new MiniMiniMusicApp();
mini.play();
}
public void play()
{
try
{
Sequencer play = MidiSystem.getSequencer();
player.open();
Sequencer seq = new Sequence(Sequence.PPQ, 4);
Track track = seq.createTrack();

ShortMessage a = new ShortMessage();
a.setMessage(144, 1, 44, 100);
MidiEvent noteOn = new MidiEvent(a, 1);
track.add(noteOn);

ShortMessage b = new ShortMessage();
b.setMessage(128, 1, 44, 100);
MidiEvent noteOn = new MidiEvent(b,16);
track.add(noteOn);

player.setSequence(seq);
player.start();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}


"The Choices We Make, Dictates Our Life To Lead".
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
no audio output?
please use the CODE tags,
there's prob'ly a more appropriate forum,


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Headfirst Book - No Output of this program
 
Similar Threads
Head First Java Chapter 11 MiniMiniMusicApp
MiniMiniMusicApp? anyone else having issues with it?
Head First Java chapter 11 MiniMiniMusicApp
Application doesn't quit -- MiniMiniMusicApp sample from Head First Java
Head First : MiniMiniMusicApp