Workaround for UnsupportedAudioFileException?

风流意气都作罢 提交于 2019-12-02 04:43:32

One thing that needs to be recognized about WAV files are, is that it is a container format -- it can hold data in many different formats, including uncompressed PCM to MP3.

In this case, I am going to guess that the library that is being used is hooking into the Java Sound API, and the implementation of the API does not support the format of the data contained in the WAV file, leading to an UnsupportedAudioFileException exception.

The files can be played back just fine in Winamp or Foobar2000, so this means Java just don't recognize some variants of the file format.

The reason why Winamp and other programs can playback the WAV file is because it is probably using the Windows Audio Compression Manager or (if I understand correctly) DirectShow, which is used to manage different types of audio codecs.

Winamp itself does not need to know how to decode the audio data inside the WAV file; it asks ACM or DirectShow to return the raw audio data on which it can handle. (Or also possibly, the data is directly send to the audio output.)

What are my options at this point?

An alternative does seem to exist in the form of the Java Media Framework, which appears to have support many multimedia formats.

It says that it will hook into the Windows ACM when using the "JMF 2.1.1 Windows Performance Pack", so it might be able to playback the WAV files which can't be played back by the Java Sound API.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!