2

I have 2 WAV files (mono) I would like to merge.

I want to merge them into a stereo WAV file where the first file will use the left channel while the second file will use the right channel (if possible, I would also like to control the volume and lower the second file a bit).

I've tried to use AVAssetReaderAudioMixOutput, but got the following error:

[AVAssetReaderAudioMixOutput initWithAudioTracks:audioSettings:] tracks must all be part of the same AVAsset

I'm not sure how to merge 2 different files.

AVAssetReaderOutput* reader=[AVAssetReaderAudioMixOutput assetReaderAudioMixOutputWithAudioTracks:[NSArray arrayWithObjects:
                                                                       [[AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:[documentDirectory stringByAppendingPathComponent:@"left.wav"]] options:nil].tracks lastObject],
                                                                       [[AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:[documentDirectory stringByAppendingPathComponent:@"right.wav"]] options:nil].tracks lastObject],
                                                                       nil] audioSettings:nil];
Jonas
  • 121,568
  • 97
  • 310
  • 388
Gilad Novik
  • 4,546
  • 4
  • 41
  • 58

0 Answers0