Downmixing 4 channel (mp2) audio for web playback

View: New views
6 Messages — Rating Filter:   Alert me  

Downmixing 4 channel (mp2) audio for web playback

by Terence Macdonald :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

Pretty new to this game so apologies if I sound dumb at any point. 

In a nutshell I have audio that has been recorded over 4 channels resulting in 4 separate mp2 encoded audio files - 1 for each channel.

What I want to do is to offer this audio for playback on a web page and I am guessing that I will have to 'downmix' it to a single audio file and serve that file to the client's browser.

I need to do this on demand and therefore need a CLI based program to to the transformation.

Can sox do this?
Am I going about this is in the wrong way? if so what is the best way to approach the problem and solve it!  ;3)

Many thanks in advance for any help


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sox-users mailing list
Sox-users@...
https://lists.sourceforge.net/lists/listinfo/sox-users

Re: Downmixing 4 channel (mp2) audio for web playback

by Pascal Giard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, May 20, 2008 at 8:56 AM, Terence Macdonald
<terencemacdonald@...> wrote:
>
> In a nutshell I have audio that has been recorded over 4 channels resulting
> in 4 separate mp2 encoded audio files - 1 for each channel.
>
> What I want to do is to offer this audio for playback on a web page and I am
> guessing that I will have to 'downmix' it to a single audio file and serve
> that file to the client's browser.

Hello Terence,

It depends on what you want...
Do you want to merge (-M) or mix (-m) your inputs? Perhaps a bit of both?

Please correct me if i'm wrong, but here's what i would try if i'd
want a stereo output...
1) mix 1 and 2: sox -m in1.mp2 in2.mp2 1mix2.ogg
2) mix 3 and 4: sox -m in3.mp2 in4.mp2 3mix4.ogg
3) merge 1mix2 3mix4: sox -M 1mix2.ogg 3mix4.ogg result.ogg

Hope this helps,

-Pascal
--
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)
LACIME: École de technologie supérieure (http://lacime.etsmtl.ca)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sox-users mailing list
Sox-users@...
https://lists.sourceforge.net/lists/listinfo/sox-users

Parent Message unknown Re: Downmixing 4 channel (mp2) audio for web playback

by Pascal Giard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, May 22, 2008 at 2:56 AM, Terence Macdonald
<terencemacdonald@...> wrote:

> Pascal,
>
> Thankyou for your response - very helpful
>
> couple of follow on questions, again, forgive my ignorance...
>
> what is the difference between Mixing and Merging?
>
> Can sox mix/merge to an mp3 result?
>
> and extrapolating your example is....
>
> sox -M in1.ogg in2.ogg in3.ogg in4.ogg result.ogg
>
> valid and would it result in 4 channel audio being 'merged' into a mono
> single file suitable for playback?

Hello Terence,

You've confused mix and merge...

 from sox manpage:
       If the `mix' combining method is selected (with -m) then  two  or  more
       input files must be given and will be mixed together to form the output
       file.  The number of channels in each input file need not be the  same,
       however,  SoX will issue a warning if they are not and some channels in
       the output file will not contain audio from every input file.  A  mixed
       audio file cannot be un-mixed.

       If the `merge' combining method is selected (with -M), then two or more
       input files must be given and will  be  merged  together  to  form  the
       output file.  The number of channels in each input file need not be the
       same.  A merged audio file comprises all of the channels  from  all  of
       the  input  files; un-merging is possible using multiple invocations of
       SoX with the mixer effect.  For example, two mono files could be merged
       to  form  one stereo file; the first and second mono files would become
       the left and right channels of the stereo file.

If you actually want a mono file as a result, you want to mix all four
channels together.
In the example I gave you, I mixed 2 pairs of channels then merged
them to obtain a stereo file.

Hope this clarifies.

-Pascal
PS: I my example I choose the OGG Vorbis format as an output, of
course this is an arbitrary choice.
--
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)
LACIME: École de technologie supérieure (http://lacime.etsmtl.ca)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sox-users mailing list
Sox-users@...
https://lists.sourceforge.net/lists/listinfo/sox-users

Re: Downmixing 4 channel (mp2) audio for web playback

by Terence Macdonald :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pascal, thanks for the reply most helpful again....

so there is no problem for sox to mix or merge 4 mp2 files and convert into an mp3 output file all in the same command then?


2008/5/22 Pascal Giard <evilynux@...>:
On Thu, May 22, 2008 at 2:56 AM, Terence Macdonald
<terencemacdonald@...> wrote:
> Pascal,
>
> Thankyou for your response - very helpful
>
> couple of follow on questions, again, forgive my ignorance...
>
> what is the difference between Mixing and Merging?
>
> Can sox mix/merge to an mp3 result?
>
> and extrapolating your example is....
>
> sox -M in1.ogg in2.ogg in3.ogg in4.ogg result.ogg
>
> valid and would it result in 4 channel audio being 'merged' into a mono
> single file suitable for playback?

Hello Terence,

You've confused mix and merge...

 from sox manpage:
      If the `mix' combining method is selected (with -m) then  two  or  more
      input files must be given and will be mixed together to form the output
      file.  The number of channels in each input file need not be the  same,
      however,  SoX will issue a warning if they are not and some channels in
      the output file will not contain audio from every input file.  A  mixed
      audio file cannot be un-mixed.

      If the `merge' combining method is selected (with -M), then two or more
      input files must be given and will  be  merged  together  to  form  the
      output file.  The number of channels in each input file need not be the
      same.  A merged audio file comprises all of the channels  from  all  of
      the  input  files; un-merging is possible using multiple invocations of
      SoX with the mixer effect.  For example, two mono files could be merged
      to  form  one stereo file; the first and second mono files would become
      the left and right channels of the stereo file.

If you actually want a mono file as a result, you want to mix all four
channels together.
In the example I gave you, I mixed 2 pairs of channels then merged
them to obtain a stereo file.

Hope this clarifies.

-Pascal
PS: I my example I choose the OGG Vorbis format as an output, of
course this is an arbitrary choice.
--
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)
LACIME: École de technologie supérieure (http://lacime.etsmtl.ca)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sox-users mailing list
Sox-users@...
https://lists.sourceforge.net/lists/listinfo/sox-users

Re: Downmixing 4 channel (mp2) audio for web playback

by Pascal Giard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, May 22, 2008 at 11:15 AM, Terence Macdonald
<terencemacdonald@...> wrote:
> Pascal, thanks for the reply most helpful again....
>
> so there is no problem for sox to mix or merge 4 mp2 files and convert into
> an mp3 output file all in the same command then?

Terence, most likely not.

Firstly, do you have mp3 encoding support compiled in your copy of
SoX? Unless you've compiled SoX yourself this is very unlikely as we
can't provide binaries with mp3 encoding support¹.

Secondly, as far as i know, only one multiple-inputs "command" can be
used per invocation. Meaning that if you want to both mix and merge
you'll need invoke sox more than once².
If you only want to mix or merge, one command will do it.

Cheers,

-Pascal
¹ If you're under MS Windows, see this procedure written by EnterAG to
compile SoX with mp3 encoding support:
http://www.enterag.ch/enterag/downloads/EnterAGSoX.pdf
² You can have another look at my very first reply. Note that i invoke
sox three times in order to obtain the desired result.
--
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)
LACIME: École de technologie supérieure (http://lacime.etsmtl.ca)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sox-users mailing list
Sox-users@...
https://lists.sourceforge.net/lists/listinfo/sox-users

Re: Downmixing 4 channel (mp2) audio for web playback

by Terence Macdonald :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for that, thinking about it I don't really need mp3 support because players can, I believe, natively playback mp2 anyway

2008/5/22 Pascal Giard <evilynux@...>:
On Thu, May 22, 2008 at 11:15 AM, Terence Macdonald
<terencemacdonald@...> wrote:
> Pascal, thanks for the reply most helpful again....
>
> so there is no problem for sox to mix or merge 4 mp2 files and convert into
> an mp3 output file all in the same command then?

Terence, most likely not.

Firstly, do you have mp3 encoding support compiled in your copy of
SoX? Unless you've compiled SoX yourself this is very unlikely as we
can't provide binaries with mp3 encoding support¹.

Secondly, as far as i know, only one multiple-inputs "command" can be
used per invocation. Meaning that if you want to both mix and merge
you'll need invoke sox more than once².
If you only want to mix or merge, one command will do it.

Cheers,

-Pascal
¹ If you're under MS Windows, see this procedure written by EnterAG to
compile SoX with mp3 encoding support:
http://www.enterag.ch/enterag/downloads/EnterAGSoX.pdf
² You can have another look at my very first reply. Note that i invoke
sox three times in order to obtain the desired result.
--
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)
LACIME: École de technologie supérieure (http://lacime.etsmtl.ca)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sox-users mailing list
Sox-users@...
https://lists.sourceforge.net/lists/listinfo/sox-users
LightInTheBox - Buy quality products at wholesale price