This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Headfirst Book - No Output of this program

 
Zakir Hosain
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
}
}
}
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no audio output?
please use the CODE tags,
there's prob'ly a more appropriate forum,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic