您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何在Java中将Wav文件拆分为通道?

如何在Java中将Wav文件拆分为通道?

找到了一种非常简单的方法,但不确定它的计算效率如何…

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位单声道)。

java 2022/1/1 18:26:59 有586人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶