1. Home
  2. Docs
  3. sox
  4. sox examples
  5. upmixing a stereo file to 5.1 audio with sox

upmixing a stereo file to 5.1 audio with sox

Input: a stereo audio file (L+R)

Output: a 6-channel audio file in 5.1(side) layout (FL+FR+FC+LFE+SL+SR)

This is a simplified process, using just sox command line, to generate a 5.1 audio file.

Step 1: Front left & right channel

  • we just copy the left and right channel into the first two channels FR + FL.
    sox input.wav temp_flfr.wav
  • Optionally, we could normalize the volume, use 24 bit sampling at 48KHz
    sox input.wav temp_flfr.wav -b 24 -r 48000 gain -n -3 (normalize to -3 dB)

Step 2: LFE channel (Low frequency/subwoofer)

  • we take only the frequencies under 120 Hz for the subwoofer
    sox temp_flfr.wav temp_lfr.wav remix 1,2 lowpass 120

Step 3: center channel (voice)

  • there are sophisticated ways to take only the voice out of a recording, but since we only have sox at our disposal, we will just filter out the human voice frequencies 300-3500 Hz
    sox temp_flfr.wav temp_c.wav remix 1,2 highpass 300 lowpass 3500

Step 4: surround channels

  • the simplest solution is to just use the L+R input but less loud
    sox temp_flfr.wav temp_slsr.wav gain -6
  • a more sophisticated version would use a bit of the ‘oops’ effect and add some delay
    sox temp_flfr.wav temp_slsr.wav remix 1v-0.8718,2v0.4898 1v0.4898,2v-0.8718 delay 0.15

Step 5: merge all channels together

  • sox has a very simple merge syntax
    sox -M temp_flfr.wav temp_c.wav temp_lfr.wav temp_slsr.wav output51.wav

 

 

Inspiration: forum.videohelp.com