前言:请各大网友尊重本人原创知识分享,谨记本人博客:南国以南i
音频解析方法:
public static int toInt(byte[] b) {
return ((b[3] << 24) + (b[2] << 16) + (b[1] << 8) + (b[0] << 0));
}
public static short toShort(byte[] b) {
return (short)((b[1] << 8) + (b[0] << 0));
}
public static byte[] read(RandomAccessFile rdf, int pos, int length) throws IOException {
rdf.seek(pos);
byte result[] = new byte[length];
for (int i = 0; i < length; i++) {
result[i] = rdf.readByte();
}
return result;
}
音频解析方法调用:
public static void main(String[] args) throws IOException {
File f = new File("E:/zmj-3011-32779/audio.wav");
RandomAccessFile rdf = null;
rdf = new Random