   [java] Best way to add music to game? Its a large clip
  Hey well I have like a 4:30 long music file I would really like to use as background music for my game. Right now I have another thread running it, but it still takes forever to run (if it ever will). Is there a better way to add a background music, or sound clip without a large amount of lag or waiting time before hand?   
  I'm not sure if this is the actual solution or not, but have you looked up Java drivers for playing the audio format?   ;  How are you currently playing the track? Are you Applet.newAudioClip? This works even if your program isn't an applet because it's a static method.   ;  public void run() {try {URL url= Class.forName("TestClass").getResource("MainTheme.wav");AudioClip ac = Applet.newAudioClip(url);ac.play();}catch (ClassNotFoundException e) {System.out.println("NOPE!");}}that is basictly my method I have to run the code. my class is implementing Runnable so run is in its own thread... and Imeant he code works and runs, but on the computers at school it never gets out of the CMD window, it just locks up basictly... and here at my house where I have a high end gaming machine, I can not move my ship yet because I guess the file is not done loading (eventhough I can hear it playing)   ;  The best way is to stream it: you can either use the basic API for that (check out the javax.sound package for midi support), or spare a bit of work for a better solution integrating one of the several sound APIs available for Java. A quick look on sourceforge might be worth.I personally am very fond of OpenAL, it is by far one of the best solutions a game might wish to use. Also, if you support Ogg withing OpenAL, I guess you won't find better performance/quality relation.Son Of Cain   ;  do you have any other specific suggestions? this is for a school project in High School, so it doesn't need to be like indepth, just something that would work   ;  If that is the case, stick with the AudioClip class examples already provided. It's simple, fast and reliable.Still, if you wish better support, do a bit of search for a sound lib (there are some for MP3 and Ogg), you're sure to find good, easy to use, working code.   ;  I suggest using OpenAL and an uncompressed audio format (becuse these dont need to be uncompressed before they are played, they are slightly faster).   ;  alright I'll see what I can find, I don't know exactly what I'm lookin for but we'll see what happens. I just basictly need to see if there is a better way without lag, to play music files   