Results 1 to 2 of 2
  1. #1
    Gousia is offline Member
    Join Date
    Feb 2011
    Posts
    38
    Rep Power
    0

    Default MidiApplication Error

    Hi experts,

    I have one small sound player app the code for which is given below but when i am trying to run it ,
    there are some errors like cannot find the symbol play(),start().

    Can anybody please help to find out what is wrong with this code
    Java Code:
    import javax.sound.midi.*;
    
    public class MiniMiniMusicApp
    {
    
    	public static void main(String[] args)
    	{
    		MiniMiniMusicApp mini = new MiniMiniMusicApp();
    		mini.play();
    	} //closes the main method
    	
    	public void play()
    	{
    		try
    		{
    			Sequence player = MidiSystem.getSequencer();
    			player.open();
    			
    			Sequence 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();
    			a.setMessage(128,1,44,100);
    			MidiEvent noteOff = new MidiEvent(b,16);
    			track.add(noteOff);
    			
    			player.setSequence(seq);
    			
    			player.start();
    		}
    		catch(Exception ex)
    		{
    			ex.printStackTrace();
    		
    		}
    	}
    }
    Last edited by JosAH; 10-24-2011 at 11:47 AM. Reason: added [code] ... [/code] tags

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: MidiApplication Error

    1. When seeking help with an error, always quote the exact error (no paraphrasing) and indicate the associated code line.
    2. An error of 'cannot find symbol' would arise at compile time, not
    when i am trying to run it
    3. MidiSystem.getSequencer() returns a Sequencer, not a Sequence.

    db

Similar Threads

  1. java out of memory error-heap space error
    By elsanthosh in forum NetBeans
    Replies: 4
    Last Post: 06-15-2010, 09:31 AM
  2. Replies: 1
    Last Post: 03-10-2010, 01:53 PM
  3. Replies: 1
    Last Post: 12-05-2009, 07:28 AM
  4. Replies: 1
    Last Post: 10-26-2009, 04:38 PM
  5. Replies: 3
    Last Post: 01-23-2009, 08:53 AM

Posting Permissions

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