I have a user recording and another mp3 file in my app, and I want the user to be able to export both of these as one, meaning the two files will be merged or laid over each other in some way.
In case that wasn’t understood, both mp3 files are to be played at the same time just as any app where a user can record say, a song, over an instrumental.
The recording and the instrumental are two separate mp3 files that need to be exported as one.
How do I go about doing this? From what I’ve read, I can’t find the solution. I see a lot on concatenating the two audio files, but I don’t want them to play one after another, but rather at the same time.
Thanks.
EDIT: I know this is late, but in case anyone stumbles by this and was looking for sample code, it’s in my answer here: How can I overlap audio files and combine for iPhone in Xcode?
If I get you right, you are asking for a audio mixer feature. This is not a trivial task.
Take a look at Core Audio. A good book to start with is this one.
One solution would be, to create a GUI-less Audio Unit (mixer unit) that plays, mixes and renders both signal (mp3s).
Besides the programming aspect, there is also an audio engineering aspect here: you should take care of the level of the signals. Imagine you have 2 identical mp3s at a level of 0dB. If you sum them up, your level will be +3dB. This don’t exist in the digital world (0dB ist the maximum). Because of that, you would have to reduce the input levels before mixing.
EDIT: sorry for the late input, but maybe this helps someone in the future: Apple has an example for the Audio Mixer that I just stumpled upon.