我正在使用打击代码来产生回声效果,但输出文件始终损坏,相同的速率将是输入文件的速率。
public static void filter(File file_input, File file_output, int sampleRate) throws IOException {
byte[] samples = readFile(file_input);
byte[] delayBuffer = new byte[samples.length];
RandomAccessFile randomAccessFile = new RandomAccessFile(file_output, "rw");
//seek to skip 44 bytes
randomAccessFile.seek(44);
int N = sampleRate / 8;
for (int n = N + 1; n < delayBuffer.length; n++) {
delayBuffer[n] = (byte) (samples[n] + samples[n - N]);
}
randomAccessFile.write(delayBuffer);
}
谢谢