Re: Play .wav music file
- From: "Andrew Thompson" <andrewthommo@xxxxxxxxx>
- Date: 14 Jul 2006 12:32:21 -0700
yingjian.ma1955@xxxxxxxxx wrote:
....
I have a program to play a .wav music. But it plays a broken music.
No it does not.*
When I play it using Real Player, it is OK. How can I fix it and why
does it play a broken music? You can use your .wav file to try it.
Before I get back into it, I just want to comment that was a nice
code example you put, if you'd allowed a text field to name the
..WAV it would have been even better, but otherwise it did
compile and run first go. Excellent!
Now to get back to the problem..
* I tried your code with a WAV that I have here, and it played
just fine. I suspect the problem is not your code but the
WAV file itself.
The fact that RealPlayer can play your WAV OK does
/not/ confirm that the WAV is of a correct format.
Most general purpose sound players have all kinds of
smarts to correct common problems in sound files,
because many sound file editors write ..crappy files -
basically.
Java, on the other hand, assumes the sound files are written
correctly (which requires a lot less coding). This is necessary
to avoid API bloat, but it means some sound files (WAV, AU
& MID) just cannot cannot be played using core Java.
The JMF might have a bit more smarts, but that is
another story. **
You might try a variety of things to fix the problem.
If you control all the sound files that you want to play, it
is easier if you reload them in a better sound editor and
save them as a new name - the sound editor might
correct the problem and give you a file that Java can read.
** If you want to be able to play many WAV types, you first
might look at JMStudio from the JMF - more to check that
the JMF can load and play the files of interest (though even
it does not handle all formats or encodings).
If JMF can play the sound files that core Java cannot -
use JMF instead.
HTH
Andrew T.
.
- Follow-Ups:
- Re: Play .wav music file
- From: yingjian . ma1955
- Re: Play .wav music file
- From: yingjian . ma1955
- Re: Play .wav music file
- References:
- Play .wav music file
- From: yingjian . ma1955
- Play .wav music file
- Prev by Date: Webservice from a servlet
- Next by Date: Re: Landscape
- Previous by thread: Play .wav music file
- Next by thread: Re: Play .wav music file
- Index(es):
Relevant Pages
|