I am trying to combine 2 audio files.
The main problem is that audio files are lossless .flac files.
I tried creating AVMutableComposition, then creating 2 AVURLAsset for each audio and use AVAssetExportSession to combine the audio files and it works, but the main problem in this case is that AVAssetExportSession doesn't support exporting to .flac and supports .m4a which is lossy compression and not suitable in my case.
Can anyone suggest how to get .flac audio files ?
I solved my problem and if someone is wondering, here is the solution:
Instead of
AVAssetExportSession, I usedAVAudioEngine, but for that to work you will have to connect at least 1AVAudioPlayerNodeto it. Then create 2AVAudioFilefrom the audio files that want to combine and schedule them to play on connectedAVAudioPlayerNodeone after another. After thatAVAudioPCMBufferis needed to render frames manually in awhileloop and store it on disk on some sort of a container (I used .mov temporary file for this). After everything is done you can just rename the file to a correct .flac file and it will work.