我使用mp3spi读取音频文件,然后将它们转换为字节数组
ByteArrayOutputStream baout = new ByteArrayOutputStream();
AudioInputStream sound = AudioSystem.getAudioInputStream(file);
byte[] buffer = new byte[4096];
int c;
while ((c = sound.read(buffer, 0, buffer.length)) != -1) {
baout.write(buffer, 0, c);
break; // i read only first 4096 bytes, to make my other stuff faster
}
sound.close();
baout.close();
byte[] data = baout.toByteArray();
如果我用以下数据读取音频
frame rate: 38.28125
frame length: -1
frame size: -1
sample rate: 44100.0
channels: 2
bitrate: 320000
我收到一个超过3900零值的数组
int countZero = 0;
for(byte b: data){
if(b == 0){
countZero++;
}
}
System.out.println("count zero values " + countZero); // 3900 - 4000
这个零值的含义是什么? 有些traks有85而不是0。
这个相等值的不同比特率之间的差异是什么? 有没有办法计算,通过了解比特率,这些值之间的数量是多少?