Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to add additional tracks using sox using the command line

Example: I have several different stereo tracks a drum track, vocal track, effects track, etc.

Can I add additional stereo tracks with sox? I don't want to append to the end of the tracks or mix them all together. I want to add additional stereo tracks to the audio file.

Example:
Stereo Track1-Vocals
Stereo Track2-Effects
Stereo Track3-Drums

Ps: the stereo tracks can't be split into individual mono files since I have specific sounds going into to the left and right channels and splitting them into all mono files negates that

I have a total of 12 stereo tracks I would like to add is this possible? If not is there another application that will do this using the command line? I'm using Ubuntu 13.04 Linux 64bit.

share|improve this question

2 Answers 2

sox --combine merge Track1-Vocals.wav Track2-Effects.wav Track3-Drums.wav my-combined-output-file.wav

If the source files each have two stereo tracks, the resulting file will have six mono tracks.

share|improve this answer
    
the files need to remain as stereo since the left and right channels have specific sounds. Changing them to Mono will not work for me. –  Rick T Jun 17 '13 at 19:23
    
I don't think sox can do this job for you then - its options are fairly well geared toward standard mono/stereo/quadraphonic formats. You could use audacity to recombine each pair of mono tracks into one stereo track by selecting the desired pair, then clicking the black downpointing triangle and selecting "make stereo track". –  Nate from Kalamazoo Jun 18 '13 at 2:13
    
@Rick T: What do you mean when you say that the tracks should “remain as stereo”? –  chirlu Jun 18 '13 at 14:40
    
@chirlu I mean that they can't be split into individual mono files since I have specific sounds going into to the left and right channels and splitting them into all mono files negates that. –  Rick T Jun 18 '13 at 14:53

You could try using ffmpeg (or avconv -- the syntax should be the same, since it's a fork of the ffmpeg project, but I can't guarantee that as I only use mainline ffmpeg).

ffmpeg -i Track1-Vocals.wav -i Track2-Effects.wav -i Track3-Drums.wav \
-map 0 -map 1 -map 2 -c:a copy output.mka

The -maps tell ffmpeg to use all three inputs in the output. -c copy tells ffmpeg to do an exact copy of the audio (rather than re-encoding).

AFAIK, WAV doesn't support multiple streams (tracks), so in that example I used Matroska audio (just a renamed MKV). You could also losslessly encode to FLAC and put the streams in an OGG:

ffmpeg -i Track1-Vocals.wav -i Track2-Effects.wav -i Track3-Drums.wav \
-map 0 -map 1 -map 2 -c:a flac output.ogg

...or to MP3/AAC inside an MP4, but that would be lossy.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.