javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file when loading wav file

谁都会走 提交于 2019-11-27 09:19:39
Andrew Thompson

..any ideas how to fix this exception, ..

Since WAV is a container format, it might include any number of encoding internally.

..wav files can be encoded with a variety of codecs to reduce the file size (for example the GSM or MP3 codecs).

See the Java Sound info. page for details no how to add support for an extra encoding (using the SPI), and a lead on an MP3 SPI.

..or if there's another way to get file duration ?

Not really. With compressed formats, bit rate is variable and there is no way to know for sure how long a track takes short of converting it to PCM or similar formats, in which the bit rate is constant & the track time is completely resolved.

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