I am writing some code that includes the capability to play sound. After reading many tutorials I have some interesting stuff going. However, we tried changing a file recorded in a slightly different format for the file played in the demo I copied from and it gave a javax.sound.sampled.UnsupportedAudioFileException that said that it only supported 44100 kHz, 16 bit, mono, Windows PCM format audio. Why is that? I thought javax.sound.sampled was supposed to support several variations. At least, that's what it seems to say in the javadocs. There is a getFormat method that tells you about the format, so I would assume that you could set it to play various formats. How do you do that?
Also, what could I use to play a VOX file? Thanks to whoever is a sound guru.
posted 13 years ago
Okay, I am replying to my own message since no one else is. I did yet more research and I found out that there likely is no magical way to play VOX files in Java. You'd have to convert to something Java can handle, then play that. Some people in a listserv said:
> I've been working on some telephony project and I am new to java sound API. Could someone give me some tips how could I convert a vox file to wave file for web display purpose? Many thanks.
Probably it's simplest to do all by yourself: use a RandomAccessFile or similar to open the vox file, parse the headers, etc. You need to know the vox file format, you can find many documents specifying it on the Internet. To create a wave file from that, create a AudioFileFormat instance with the format read from the vox-header and supply an InputStream with the audi data of the vox file. You can then use AudioSystem.write to write a wav file.
That sounds really complicated. Does anybody know what they're talking about? How would I even go about figuring out how to do that?
If this isn't the best place to post, does anyone know any place that is better? I tried some forums that are linked to jsresources.com but for some reason I either can't post or just can't log in. Who knows. Thanks for any thoughts.
Originally posted by Joe Ess: Seb, please do not wake up old threads. You've already posted this question once on JavaRanch, woken up another old thread here and posted it to the Sun Java forums. You are going to cause a lot of wasted effort and confusion as people read all these posts and try to help you out. CarefullyChooseOneForum