Results 1 to 2 of 2
  1. #1
    AWPtic is offline Member
    Join Date
    Mar 2009
    Rep Power

    Default Music in Java Program

    Hi, I have been searching all over Google on how to add music to a Java game that I created. I'm wanting it to be like background. I was hoping for some simple code, but have yet to find any. I have the songs selected and have also found out that I probably have to use a .wav file rather than a
    .mp3 file (which is perfectly fine since I have a .wav converter). If anyone could help me out a little bit then that would be great and I'd really appreciate it. Thanks.

  2. #2
    neilcoffey is offline Senior Member
    Join Date
    Nov 2008
    Rep Power


    There are essentially two routes:
    - the JavaSound API is part of the standard JDK (in other words, anyone with a recent version of Java will have it); you're effectively limited to WAV format, or else writing the decoder yourself (there must be a free Java implementation of an Ogg Vorbis decoder); if you're writing an Applet, this is really the only option;
    - the Java Media Framework (JMF) does support MP3, among other things, but it means your users have to download and install this extra component.

    Note that the other problem with MP3 is that it's not a free format: in principle, if you write some software that decodes MP3-- or in any way embed an MP3 decoder in your application-- you're supposed to pay an extortionate licence for the privilege. (Clarification: if you use JMF, I think you're OK.)

Similar Threads

  1. adding music to a applet.
    By ramsrocker in forum New To Java
    Replies: 1
    Last Post: 02-14-2009, 04:31 AM
  2. Please recommend music to ringtone converter
    By hyang in forum Sun Java Wireless Toolkit
    Replies: 2
    Last Post: 01-26-2009, 05:15 PM
  3. Play music
    By carderne in forum New To Java
    Replies: 4
    Last Post: 08-05-2008, 01:09 PM
  4. Music File Conversion
    By Dave Almighty in forum Advanced Java
    Replies: 11
    Last Post: 04-21-2008, 03:30 AM
  5. printing MIDI notes on a music staff
    By kbyrne in forum AWT / Swing
    Replies: 0
    Last Post: 12-29-2007, 05:30 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