-->

combine two .caf audio files into a single audio f

2019-02-26 04:32发布

问题:

I am using AVAudioRecorder for recording audio in .caf format. When the user will resume this recording the new recording must append with the old recording. So how can i combine two .caf audio files.

回答1:

You can do it using ExtAudioFileService. In ios developer library they had provided two examples to convert one audio file to another format. In these they are opening one audio file for reading and another file for writing (converted audio). You can change or updated code to read from two files and write them to one out put file in same format(caf) or compressed format. First you have open first audio file and read every packets from it and write it to a new audio file. After finishing first audio file, close the file and open second audio file for reading. Now read every packets from second audio file and write to newly created audio file and close second audio file and new audio file.

Please find the links(1,2) for these sample codes .... Hope this helps you...and good luck. :)