ref: 4a43d182871839c02b55046b8f525f14ea6a6899
parent: ba9c7a44430bfb074f58d3e974f583a6e24f7105
author: cbagwell <cbagwell>
date: Fri Aug 6 13:45:31 EDT 2004
avg bugfix for -f/-b/-l/-r in quad files. doc update for avg effect.
--- a/sox.1
+++ b/sox.1
@@ -645,12 +645,12 @@
\fI-1\fR, \fI-2\fR, \fI-3\fR, \fI-4\fR, options to select only
the left, right, front, back channel(s) or specific channel
for the output instead of averaging the channels.
-The \fI-l\fR, \fI-r\fR, \fI-f\fR, and \fI-b\fR options will do averaging
+The \fI-l\fR, and \fI-r\fR options will do averaging
in quad-channel files so select the exact channel to prevent this.
The avg effect can also be invoked with up to 16 double-precision
-numbers, which specify the proportion of each input channel that is
-to be mixed into each output channel.
+numbers, which specify the proportion (0.0 = 0% and 1.0 = 100%)
+of each input channel that is to be mixed into each output channel.
In two-channel mode, 4 numbers are given: l->l, l->r, r->l, and r->r,
respectively.
In four-channel mode, the first 4 numbers give the proportions for the
@@ -661,9 +661,28 @@
It is also possible to use the 16 numbers to expand or reduce the
channel count; just specify 0 for unused channels.
-Finally, if fewer than 4 numbers are given, certain special
-abbreviations may be
-invoked; see the source code for details.
+
+Finally, certain reduced combination of numbers can be specified
+for certain input/output channel combinations.
+
+
+In Ch Out Ch Num Mappings
+.br
+_____ ______ ___ _____________________________
+.b4
+ 2 1 2 l->l, r->l
+.br
+ 2 2 1 adjust balance
+.br
+ 4 1 4 lf->l, rf->l, lb->l, rb-l
+.br
+ 4 2 2 lf->l&rf->r, lb->l&rb->r
+.br
+ 4 4 1 adjust balance
+.br
+ 4 4 2 front balance, back balance
+.br
+
.TP 10
band \fB[ \fI-n \fB] \fIcenter \fB[ \fIwidth\fB ]
Apply a band-pass filter.
--- a/src/avg.c
+++ b/src/avg.c
@@ -168,7 +168,7 @@
4) 2->2 fully general mix (4 numbers)
5) 2->4 duplication (0 numbers)
6) 4->1 mixdown (0 or 4 numbers)
- 7) 4->2 mixdown (0 or 2 numbers)
+ 7) 4->2 mixdown (0, or 2 numbers)
8) 4->4 balance (1 or 2 numbers)
The above has one ambiguity: n->n volume change conflicts with
@@ -214,7 +214,7 @@
pans[1] = 0.0;
avg->num_pans = 2;
}
- else if (ichan == 4 && ochan == 2)
+ else if (ichan == 4 && ochan == 1)
{
pans[0] = 0.5;
pans[1] = 0.0;
@@ -236,7 +236,7 @@
pans[1] = 1.0;
avg->num_pans = 2;
}
- else if (ichan == 4 && ochan == 2)
+ else if (ichan == 4 && ochan == 1)
{
pans[0] = 0.0;
pans[1] = 0.5;
@@ -255,10 +255,8 @@
if (ichan == 4 && ochan == 2)
{
pans[0] = 1.0;
- pans[1] = 1.0;
- pans[2] = 0.0;
- pans[3] = 0.0;
- avg->num_pans = 4;
+ pans[1] = 0.0;
+ avg->num_pans = 2;
}
else
{
@@ -270,10 +268,8 @@
if (ichan == 4 && ochan == 2)
{
pans[0] = 0.0;
- pans[1] = 0.0;
- pans[2] = 1.0;
- pans[3] = 1.0;
- avg->num_pans = 4;
+ pans[1] = 1.0;
+ avg->num_pans = 2;
}
else
{