Merge multiple audio files into a single file
I want to merge audio files into a single file and then play that file. I have tried number of ways ...
playedFilesSequenceList
is the arraylist which has audio files from the R.raw
folder.
for(int k=0; k<playedFilesSequenceList.size();k++) {
InputStream inputStream = getResources().openRawResource(playe开发者_如何学编程dFilesSequenceList.get(k));
try {
int size = inputStream.available();
byte []buffer = new byte[size];
inputStream.read(buffer);
//File destination = new File(getFilesDir(),"mycopy.wav");
fos.write(buffer);
} catch(Exception e) {
e.printStackTrace();
}
//readFile(inputStream,destination);
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
精彩评论