I have recorded audio using AudioRecorder. I need to merge the recorded files into a single file. Any suggestion.
getAudioPath() -- the path of the audiofiles. getCo
If you're using AudioRecord.read()
, I'm assuming you have the PCM data in a short or byte array. If that's the case, all you need to do is create a new array as large as both of the originals, and copy the data over, one after the other. Something like this:
short[] newData = new short[dataOne.length + dataTwo.length];
for(int i=0;i<dataOne.length;i++)
newData[i] = dataOne[i];
for(int i=0;i<dataTwo.length;i++)
newData[i+dataOne.length] = dataTwo[i];
Then you have one array with all the PCM data, and you can do with that what you will.