输出wav文件主要格式在于文件头WaveHeader header = new WaveHeader(sun);//sun为文件字节数
//length field = size of the content (PCMSize) + size of the header field (excluding the first 4 bytes of the identifier RIFF and the fileLength itself 4 bytes)
header.fileLength = sun + (44 - 8);
header.FmtHdrLeth = 16;
header.BitsPerSample = 16;
header.Channels = 6;//通道数
header.FormatTag = 0x0001;
header.SamplesPerSec = 4000000; //采样率
header.BlockAlign = (short)(header.Channels * header.BitsPerSample / 8);
header.AvgBytesPerSec = header.BlockAlign * header.SamplesPerSec;
header.DataHdrLeth = sun;
byte[] h = header.getHeader();
assert h.length == 44; //WAV standard, the header should be 44 bytes 去掉44就是pcm
其次输出多个通道数据数据格式for(int i=0;i
out.write(byte1,i,i+2);//1号通道 数据为2个字节数据
out.writ