Friday, September 24, 2010

JAVA : Music Player

JAVA Music Player

Java Code Spot has come up with a small Music Player Java application that plays wave sound clips. Playing sounds clips in java can be done using the "javax.sound" pakages.

Java Sound supports the following audio file formats: AIFF, AU and WAV.


!!!!!!!!!!....Applet may take some time to load....!!!!!!!!!!

Instruction:
1)play button will paly the selected sound clip once.
2)Loop Button will play the selected sound clip continuesly.
3)Stop Button will stop the playing sound.
Note: It takes some time to load sound clip before playing according to your internet speed.

JAVA AudioInputStream:
For playing a sound file in Java application we need to create a object of AudioInputStream. AudioInputStream is input stream for audio files like DataInputStream are for data files. An audio input stream is an input stream with a specified audio format and length.

public void selectFile(){

   try {

      URL u = new URL(getCodeBase()+""+playlist.getSelectedItem());
           AudioInputStream  ai = AudioSystem.getAudioInputStream(u);

      } catch (Exception e) {
           e.printStackTrace();
     }
}



JAVA Clip Interface:
As AudioInputStream is just an input stream, we cannot directly play them. For playing these java AudioInputStream, Java has a interface Clip in Javax.sound.sampled package.
The Clip interface represents a special kind of data line whose audio data can be loaded prior to playback, instead of being streamed in real time.


             Clip c =  AudioSystem.getClip();
          c.open(ai);
          c.start();
          c.loop(Clip.LOOP_CONTINUOUSLY);
          c.stop();
          c.close();
        
The Clip interface has some functions which can be use to paly audio files.

open() : Java's Clip interface has a open function that takes AudioInputStream as parameter and opens the clip with the format and audio data present in the provided audio input stream. Opening a clip means that it should acquire any required system resources and become operational.

start() : Java's Clip interface has a start function that starts playing the AudioInputStream which is currently open.

loop() : Java's Clip interface has a loop function that continously plays the AudioInputStream which is currently open.

stop() : Java's Clip interface has a stop function that stops the playing AudioInputStream.

close() : Java's Clip interface has a close function that Closes the line and releasese any system resources in use by the line.

Download Files Here:

40 comments:

  1. Undeniably consider that which you stated. Your favorite justification
    seemed to be on the internet the simplest thing to take into accout of.
    I say to you, I certainly get irked at the same time as folks think
    about issues that they just don't recognize about. You managed to hit the nail upon the highest and also defined out the entire thing without having side effect , folks can take a signal. Will probably be again to get more. Thank you

    my web site :: Free downloading

    ReplyDelete
  2. Hello, Neat post. There is an issue together with
    your web site in web explorer, could check this? IE
    still is the marketplace chief and a huge section
    of people will pass over your wonderful writing due to this problem.


    My web page: 8560 phaser

    ReplyDelete
  3. Nice operate, Aaron. I took care of to keep my Lexmark E210 printer (an ML-1210 clone) operating along, now in Home windows 8.


    Take a look at my web site; xerox phaser 8560

    ReplyDelete
  4. Sir,In that program can continues music player start....

    ReplyDelete
  5. Very shortly this website will be famous among all blogging and site-building visitors,
    due to it's pleasant articles

    Also visit my webpage; White Kidney Bean

    ReplyDelete
  6. That was worthy of much more deeper attention and I'll deal with them in separate blog site posts: 3D printing, and mobile app.

    my web site xerox phaser 8560n

    ReplyDelete
  7. I drop a comment each time I appreciate a post on a site or if I have something to valuable to contribute
    to the conversation. It's caused by the fire communicated in the article I looked at. And after this article "JAVA : Music Player". I was actually excited enough to post a comment ;) I actually do have 2 questions for you if you don't mind.
    Is it simply me or do a few of these comments appear like they are
    left by brain dead individuals? :-P And, if you are writing at additional online sites, I would
    like to follow anything fresh you have to post. Could you list the complete
    urls of your communal sites like your Facebook page, twitter feed,
    or linkedin profile?

    Here is my web-site Raspberry Ketone Plus Diet

    ReplyDelete
  8. Good day! I could have sworn I've visited this website before but after going through many of the posts I realized it's new to me.
    Anyways, I'm certainly delighted I discovered it and I'll be bookmarking
    it and checking back often!

    My web page :: click the following internet page

    ReplyDelete
  9. You really make it seem so easy together with your presentation however I find
    this topic to be actually something which I believe I'd never understand. It seems too complex and extremely extensive for me. I am having a look forward to your next put up, I'll try to get the hold of it!


    Review my web-site - Vydox Male Enhancement Reviews

    ReplyDelete
  10. Good answers in return of this question with solid
    arguments and describing the whole thing about that.


    Check out my blog ... best eye wrinkles

    ReplyDelete
  11. Hi there, just wanted to tell you, I liked this post. It was inspiring.
    Keep on posting!

    My website :: Veluminous Reviews

    ReplyDelete
  12. hey there and thank you for your info – I have certainly picked up something new from right here.
    I did however expertise several technical points using this
    site, since I experienced to reload the site many times previous to I could get it to load properly.
    I had been wondering if your web host is OK?
    Not that I'm complaining, but sluggish loading instances times will sometimes affect your placement in google and could damage your high-quality score if advertising and marketing with Adwords. Anyway I'm adding this RSS to my e-mail and can look out for much more of your respective exciting content.
    Ensure that you update this again very soon.

    My web-site: best cheap web hosting uk

    ReplyDelete
  13. Wow! Numerous interesting little details to observe in Grainne's home. I just a have a look at her work and adore it! I emailed the url to my hubby being a big hint for Christmas (worth trying!!. Appreciate sharing Sania. Jo x

    Also visit my webpage :: silver jewellery

    ReplyDelete
  14. Everyone loves what you guys are up too. This sort of clever work and exposure!

    Keep up the awesome works guys I've included you guys to my blogroll.

    Visit my site ... best domain and web hosting uk

    ReplyDelete
  15. Hello there! I could have sworn I've been to this website before but after reading through some of the post I realized it's new to me.
    Anyways, I'm definitely glad I found it and I'll be bookmarking and
    checking back frequently!

    Also visit my weblog - acai ultra lean review

    ReplyDelete
  16. Oh my goodness! Amazing article dude! Thank you so much, However
    I am having troubles with your RSS. I don't understand why I cannot join it. Is there anybody having identical RSS problems? Anyone who knows the solution will you kindly respond? Thanks!!

    Feel free to surf to my homepage Elevate GF facts

    ReplyDelete
  17. I think this is among the most important information for me.
    And i'm glad reading your article. But wanna remark on some general things, The website style is wonderful, the articles is really great : D. Good job, cheers

    Also visit my web-site ... Ultra SLim Patch Review

    ReplyDelete
  18. Greate article. Keep writing such kind of info on your page.
    Im really impressed by your blog.
    Hello there, You have performed a fantastic job. I will definitely digg it and in my view recommend
    to my friends. I am confident they will be benefited from this web site.


    my weblog ... Costume Jewellery Bracelets

    ReplyDelete
  19. We are allergic to nickel and have absolutely pewter earrings.
    I've never had a concern using the posts.

    my homepage: www.swaggybook.com

    ReplyDelete
  20. Hey, Do you think its also fantastic to acquire an utilized inkjet
    for estate usage? Where can i discover Amazon or Best-Buy?



    Here is my webpage :: xerox phaser 8560 color printer

    ReplyDelete
  21. Truly nice, should attempt it today.

    Also visit my weblog - xerox Phaser 8560 service manual

    ReplyDelete
  22. Hi, I've just began to learn making jewellery and would wish to understand how to make rings. I truly love rings and would like to figure out how to make my own. Thanks!

    Feel free to surf to my weblog: http://infobc.uniud.it

    ReplyDelete
  23. Ηello there! This is my fіrst visіt to your blog!

    We are a group of volunteers and starting a new іnitiative in а communitу in the same niche.
    Your blog proviԁed us beneficial information to work on.

    You havе dοne a οutstandіng job!


    My web blog - auto insurance Quotes

    ReplyDelete
  24. Hеy therе, You've done an incredible job. I'll
    certainly dіgg it and рersonallу suggest to my fгiends.
    I am confidеnt they will bе benefited frοm this web site.



    Alѕo νisіt my hοmeрage :
    : bet365 tel number

    ReplyDelete
  25. Keep on working, great job!

    Also visit my blog ... Natural Cleanse

    ReplyDelete
  26. love the Llama Studs! Gorgeous

    Take a look at my weblog :: ,cheap earrings for teenage girls

    ReplyDelete
  27. Interesting blog! Is your theme custom made or did you download it from somewhere?
    A theme like yours with a few simple tweeks would really make my blog jump out.
    Please let me know where you got your theme. Cheers

    Feel free to surf to my site: home income profit system

    ReplyDelete
  28. great to uncover circuitstoday.com.

    My web site :: Katabudi.blogspot.Com

    ReplyDelete
  29. Thanks for creating my individual students gain access to
    your webpage post.

    Also visit my web page; Www.Faxremovalservice.Com

    ReplyDelete
  30. Hi would you mind letting me know which webhost you're working with? I've loaded your blog in 3 completely different browsers and I
    must say this blog loads a lot faster then most. Can
    you suggest a good internet hosting provider at a fair price?
    Kudos, I appreciate it!

    Feel free to visit my web site :: LG 42LS5600 review

    ReplyDelete
  31. It's amazing for me to have a website, which is beneficial in favor of my knowledge. thanks admin

    Also visit my web blog: Hultquist Jewellery Australia

    ReplyDelete
  32. The item I most covet with the Duke & Dutch range is anything with Africa!
    ! x

    My page http://submergedshooters.com/social/profile/PhoebeLas

    ReplyDelete
  33. I visit day-to-day a few websites and blogs to read posts,
    but this web site provides quality based content.

    Feel free to surf to my blog post - xerox 8560 drivers

    ReplyDelete
  34. Many thanks whole lots. Functions a surprise.


    Visit my blog post :: xerox phaser 8560 ink

    ReplyDelete
  35. Actually nice, wish to attempt it today.

    Here is my web site xerox phaser 8560 maintenance kit
    :: ::

    ReplyDelete
  36. I leave a response each time I appreciate a post on a
    website or if I have something to add to the conversation.

    Usually it is caused by the sincerness displayed in the post I read.
    And after this post "JAVA : Music Player". I was actually moved enough to drop a thought ;)
    I do have a couple of questions for you if you don't mind. Is it only me or do a few of these responses appear as if they are coming from brain dead visitors? :-P And, if you are writing at additional places, I would like to follow anything fresh you have to post. Would you make a list the complete urls of your social pages like your Facebook page, twitter feed, or linkedin profile?

    Feel free to visit my web site :: hultquist rings

    ReplyDelete
  37. Hello there! This post could not be written much better!
    Looking through this article reminds me of my previous roommate!
    He continually kept preaching about this. I most certainly will forward this article to
    him. Fairly certain he will have a great read.
    Thank you for sharing!

    Also visit my web page: xerox 8560dn

    ReplyDelete
  38. Lovely prize x

    Have a look at my blog post: danon jewellery uk

    ReplyDelete
  39. Hello, i think that i saw you visited my weblog so i came to “return the favor”.
    I'm trying to find things to enhance my web site!I suppose its ok to use some of your ideas!!

    Have a look at my homepage ... pilgrim jewellery bargains

    ReplyDelete