Results 1 to 4 of 4
  1. #1
    satyaram435 is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Post Sample music application stuck in the middle of running the programm..

    import javax.sound.midi.*;
    class MiniMusicPlayer1
    {


    public static void main(String[] args)
    {
    try
    {
    Sequencer sequencer=MidiSystem.getSequencer();
    sequencer.open();

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

    for(int i=5;i<61;i+=4)
    {
    track.add(makeEvent(144,1,i,100,i));
    track.add(makeEvent(128,1,i,100,i+2));
    }

    sequencer.setSequence(seq);
    sequencer.setTempoInBPM(220);
    sequencer.start();

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

    public static MidiEvent makeEvent(int cmd,int chan,int one,int two,int tick)
    {
    MidiEvent event=null;
    try
    {
    ShortMessage a=new ShortMessage();
    a.setMessage(cmd,chan,one,two);
    event=new MidiEvent(a,tick);
    }
    catch(Exception ex)
    {
    ex.printStackTrace();
    }
    return event;
    }//cloe makeevent

    }//close class

  2. #2
    satyaram435 is offline Member
    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0

    Default

    please help me........

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You have posted code but did not ask a coherent question. How about telling us what errors or problems you are having. Also, you bumped your post after one minute -- why?

    Please check out the second link in my signature -- how to ask smart questions -- as it will help you to formulate questions that we can and want to answer.

    Best of luck!
    Last edited by Fubarable; 04-05-2010 at 11:16 PM.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    From your double-post:
    Quote Originally Posted by satyaram435 View Post
    It is giving the output but it unable to come out of the running process...

    Please address these issues in a single thread rather than ask the same question over again. Double post was locked. You'll also might want to add code tags and fill in more detail regarding your question. Thank you for your cooperation.

Similar Threads

  1. Reg: AWT sample application
    By b_srinath_b in forum AWT / Swing
    Replies: 0
    Last Post: 02-15-2010, 01:06 PM
  2. Web application to manage music
    By Thomasheen in forum New To Java
    Replies: 2
    Last Post: 09-01-2009, 12:20 AM
  3. sample rolebased application
    By 435.mahesh in forum Web Frameworks
    Replies: 1
    Last Post: 05-04-2009, 08:17 AM
  4. Sample Spring Application
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-29-2008, 12:41 PM
  5. A Sample spring Application
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 09-26-2007, 08:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •