Other than the usual

AudioInputStream stream = AudioSystem.getAudioInputStream(ClassLoader.getSystemClassLoader().getResource("____.wav"));      
					DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat());      
					Clip clip = (Clip) AudioSystem.getLine(info);         
					 clip.open(stream);
					 clip.start();

Since the buffer limit is 2mb for an UNCOMPRESSED wav file so... it's pretty obvious how crappy that is... and that's about all I found on the net since the rest that are floating around don't work anymore(such as using sun's audioplayer, which is now restricted). Any ideas or nudges in the right direction? I'm not making a media player, just playing the clip in the background so I would most likely run this on a separate thread. Any ideas what method would be best for that? especially if I might put a wait()/notify() for it to end the clip prematurely if needed. Thanks in advance!

Recommended Answers

All 6 Replies

already said... using that sun audio thing doesn't work anymore if I'm correct... Eclipse gives me the restricted codes error thing... also, working with clips is bad unless I can increase the buffer size, since it only accepts UNCOMPRESSED wav files up to 2mb(uncompressed meaning my 1:37 192kbps mp3 at 2.5mb turns into 22mb at 128kbps... had to make it run at 8kbps at 11000hz on mono just for it to work) so I don't think that's the best

Anyone at all who can help please? :(

there are different ways, you can also add a package that can play .mp3 's and use that :)

for instance the jmf (java media framework) or the framework used in JavaZoom.

I'll try looking up jmf, thanks.. though how do you install that into eclipse?

don't know, never used that one. I did however used the JavaZoom package, that's just a .jar file you need to add to your application, after which you just call the right methods

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.