how can merge two audio files to a single file in android platform. that is if i have two audio files namely A and B.Please give me the code to create a new audio file C that is appended by B after A. Is there any need to convert the audio files to byte/short array ??...
i did like this but it plays 1st file only.
File firstFile=new File("/mnt/sdcard/Android/data/Dictation/Audio/Dict136.3gp");
File secondFile=new File("/mnt/sdcard/Android/data/Dictation/Audio/Dict139.3gp");
System.out.println("1 file:::::"+firstFile+"\n 2nd file::"+secondFile);
FileInputStream fistream1;
try {
fistream1 = new FileInputStream(firstFile);
FileInputStream fistream2 = new FileInputStream(secondFile);//second source file
SequenceInputStream sistream = new SequenceInputStream(fistream1, fistream2);
FileOutputStream fostream = new FileOutputStream("/mnt/sdcard/Android/data/Dictation/Audio/merged.3gp");//destinationfile
int temp;
while( ( temp = sistream.read() ) != -1)
{
System.out.print( (char) temp ); // to print at DOS prompt
fostream.write(temp); // to write to file
}
filePath="/mnt/sdcard/Android/data/Dictation/Audio/merged.3gp";
playAudio(filePath);
fostream.close();
fistream1.close();
fistream2.close();
thanks in advance.