Is there a way to compress a .wav file so that it works in Java?

I have a 400k .wav sound file that I want to compress to use in my Java application.  

I tried MP3 but borland JBuilder doesn't recognise mp3s as sound files (as far as I can tell).  

Can anyone suggest a way to compress a .wav file so that it will work in Java?  Here is how I am using it:

private static AudioClip SIMULATION_END = Applet.newAudioClip(Sounds.class.getResource(DIR+"scifi.mp3"));
DawkinsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
objectsCommented:
you could try zipping it.
0
objectsCommented:
If you include the audio in your jar then it will get compressed along with the rest of the jar so you don't need to worry about it.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

sciuriwareCommented:
Forget about zipping: .wav is like white noise: uncompressible.
The only solution is .mp3
Btw.: mp3 is not a compression but a kind of reduction (you will even loose some quality).
<*>
0
DawkinsAuthor Commented:
Yes I've noticed it doesn't compress very much using winzip or into the jar.  Mp3 got it from 400k to 80k.

So, Java doesn't recognise mp3 without using 3rd party classes?  In that case I think the best option is to find a different sound to use because I want this done by tomorrow!
0
sciuriwareCommented:
You can download the MP3 library in 5 minutes (I did it on 33KBAUD).
Just follow http://www.javazoom.net/javalayer/javalayer.html
like I did.
<*>
0
sciuriwareCommented:
Btw., CEHJ : congratulations with the 2 000 000 !
<*>
0
CEHJCommented:

>>Java doesn't recognise mp3 without using 3rd party classes?  

No

>>Btw., CEHJ : congratulations with the 2 000 000 !

Thanks
0
DawkinsAuthor Commented:
ok I've found a smaller wav to use instead so problem solved.

>If you include the audio in your jar then it will get compressed along with the rest of the jar

There is an option to compress but it is not ticked by default.  I tried it and it decreases the .jar size by 50% so thanks for mentioning it! :)  

But are there any drawbacks to compressing the jar (other than taking slightly more time to compile and build)?
0
CEHJCommented:
>>But are there any drawbacks to compressing the jar

Well, the overhead of uncompressing it of course ...;-)
0
objectsCommented:
> But are there any drawbacks to compressing the jar (other than taking slightly more time to compile and build)?

no
0
javazoomCommented:
If you plan to use JLayer from :
http://www.javazoom.net/javalayer/javalayer.html

Then MP3SPI should fit better to your need because you don't have to modify your JavaSound code to play MP3 and WAV. It's a MP3 plugin. It relies on JLayer :
http://www.javazoom.net/mp3spi/mp3spi.html

I hope it helps.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.