找到了一种非常简单的方法,但不确定它的计算效率如何…
public void splitByteArray (byte [] fileContent, byte [] fileContentLeft, byte [] fileContentRight) {
for (int i = 0; i < fileContent.length; i += 4) {
fileContentLeft[i] = fileContent[i];
fileContentLeft[i + 1] = fileContent[i + 1];
fileContentRight[i + 2] = fileContent[i + 2];
fileContentRight[i + 3] = fileContent[i + 3];
}
}
这适用于16位wav PCM,其中立体声阵列中的0和1索引是左声道,而2&3是右声道(均为8位单声道)。