I have two stereo file: 1.mp3, 2.mp3
I want to merge this two audio files in the special way
I mean I want 3.mp3 to be a stereo file that has 1.mp3 in it's left channel and 2.mp3 in it's right channel
I have two stereo file: 1.mp3, 2.mp3
I want to merge this two audio files in the special way
I mean I want 3.mp3 to be a stereo file that has 1.mp3 in it's left channel and 2.mp3 in it's right channel
You can achieve that by following these steps:
Decode 1.mp3 and 2.mp3 files
Save decoded raw data (in different WAVE formatted files or in memory)
Replace of 1.mp3 decoded raw data's first or second channel values with 2.mp3 decoded raw data's first or second channel values one by one (note that this causes quality loss of audio)
Construct WAVE(raw audio data format) header based on the merged audio data features
Create WAVE formated 3.wav file using constructed WAVE header and merged audio data
Convert 3.wav file to 3.mp3 file format
Doing these steps requires you to know:
How to decode mp3 files to get raw data
How to manipulate on data bytes in buffer
WAVE soundfile format
How to convert wav to mp3
For decoding and encoding audio files in different formats you can use some appropriate sound library(for example BASS) - this helps you to do 1 and 6 steps. For constructing WAVE formated audio data you should be familiar with WAVE File Format and how audio data channels is aligned in buffer - this helps you to do 3, 4 and 5 steps
mp3 is compressed audio data. you can not directly mix them using file operations. one thing you can do is use ffmpeg library to convert the mp3 to raw PCM, mix the channels and then converting it back to mp3.