I want merge multiple mp3 file in android but for example I just do this with two file :
FileInputStream fileInputStream = new FileInputStream(soundFile.getAbsolutePath() + 0);
FileInputStream fileInputStream1 = new FileInputStream(soundFile.getAbsolutePath() + 1);
SequenceInputStream sequenceInputStream = new SequenceInputStream(fileInputStream, fileInputStream1);
FileOutputStream fileOutputStream = new FileOutputStream(soundFile.getAbsolutePath());
int temp;
while ((temp = sequenceInputStream.read()) != -1) {
fileOutputStream.write(temp);
}
fileInputStream.close();
fileInputStream1.close();
sequenceInputStream.close();
fileOutputStream.close();
I recorded two sound with "ttt.mp30" and "ttt.mp31" file. then I want to merge it to "ttt.mp3"
but when I use this code for merge, it just create the ttt.mp3 witch play ttt.mp30 but it doesn't play ttt.mp31 file
whats the problem ?
thanks
EDIT :
if I use :
SequenceInputStream sequenceInputStream = new SequenceInputStream(fileInputStream1, fileInputStream);
insted of :
SequenceInputStream sequenceInputStream = new SequenceInputStream(fileInputStream, fileInputStream1);
the ttt.mp3 just play ttt.mp31 file
Edit :
the record option :
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);