[英]Play back 24-bit wav with AudioPlayer in java
When I play 24-bit wav files in java they don't play. 当我在java中播放24位wav文件时,它们不能播放。 16-bit files work fine.
16位文件工作正常。
I am using: 我在用:
InputStream audioInputStream = new FileInputStream(soundFile);
AudioStream audioStream = new AudioStream(audioInputStream);
AudioPlayer.player.start(audioStream);
I realise this method is depreciated, but I am using it for other reasons (reading changeable files from a jar for instance). 我意识到这种方法是折旧的,但我出于其他原因使用它(例如从jar中读取可更改的文件)。
Is there any way of playing 24-bit files on java (perhaps internally converting them?). 有没有办法在java上播放24位文件(也许内部转换它们?)。 I am using linux, but this needs to work cross-platform.
我正在使用linux,但这需要跨平台工作。
It doesn't seem possible in java on my linux. 在我的linux上java中似乎不可能。
So I bulk converted the files with this script: 所以我用这个脚本批量转换文件:
for f in $(find ./ -name '*.wav'); do
ffmpeg -i $f -acodec pcm_s16le -ar 44100 ${f%.wav}z.wav;
rm $f;
mv ${f%.wav}z.wav $f;
done
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.