我试图根据这个答案在android中合并两个amr文件: Merge AMR audio file in java or android ideny first 6 byte from second file 然后写入第一个amr文件...输出文件正在合并两个文件,但它有噪音就在第二个连接上。这是我的代码:
soundFile.createNewFile();
FileInputStream inputStream1 = new FileInputStream(soundFile.getAbsolutePath()+0);
FileInputStream inputStream2 = new FileInputStream(soundFile.getAbsolutePath()+1);
FileOutputStream outputStream = new FileOutputStream(new File(soundFile.getAbsolutePath()+"w"));
int temp = 0;
inputStream2.read();
inputStream2.read();
inputStream2.read();
inputStream2.read();
inputStream2.read();
inputStream2.read();
while( (temp = inputStream2.read()) != -1 )
{
outputStream.write(temp);
}
outputStream.close();
inputStream2.close();
inputStream2 = new FileInputStream(soundFile.getAbsolutePath()+"w");
SequenceInputStream inputStream3 = new SequenceInputStream(inputStream1, inputStream2);
outputStream = new FileOutputStream(soundFile);
//FileWriter fileWriter = new FileWriter(soundFile, true);
while( (temp = inputStream3.read()) != -1 )
{
outputStream.write(temp);
}
outputStream.close();
inputStream1.close();
inputStream2.close();
inputStream3.close();
//fileWriter.close();
//fileWriter.flush();
} catch (IOException e) {
}
这是我的第一个 amr 文件: http ://www.filedropper.com/aaaa_2
这是第二个 amr 文件:www.filedropper.com/aaaa_3
这是我的合并 amr 文件:www.filedropper.com/aaaa_4
any1可以帮助我吗?
thx 和 sry 为我的英语...