Index: ChangeLog =================================================================== RCS file: /cvsroot/mplayer/main/ChangeLog,v retrieving revision 1.246 diff -u -r1.246 ChangeLog --- ChangeLog 13 Sep 2005 21:04:44 -0000 1.246 +++ ChangeLog 15 Sep 2005 02:54:42 -0000 @@ -69,6 +69,7 @@ * remove_logo filter * lavcresample now used by default (-af-adv force=0 gives old behavior) * vf_expand and vf_dsize now support aspect and round parameters + * af_pan can mix channels in proportions between -512 and 512 * screenshot filter MEncoder: Index: DOCS/man/en/mplayer.1 =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v retrieving revision 1.1101 diff -u -r1.1101 mplayer.1 --- DOCS/man/en/mplayer.1 14 Sep 2005 22:08:03 -0000 1.1101 +++ DOCS/man/en/mplayer.1 15 Sep 2005 02:54:44 -0000 @@ -3988,7 +3988,19 @@ .IPs \ \ number of input channels (1\-6) .IPs -How much of input channel j is mixed into output channel i (0\-1). +The multiple of input channel j that is to be mixed into output channel +i (-512 \- 512, including decimals). +Negative multiples will invert the phase of a channel before mixing and +can be used to "subtract" one channel from another. +Be aware that when mixing channels you can can end up with an output +signal that contains values outside of the range your sound card +accepts. +This is particularly likely to happen when mixing with multiples greater +than 1 or smaller than -1, which can be quite loud. +If you hear any painful-sounding pops or clicks, either use multiples +closer to 0 or follow pan with ",volume" so the volume filter will clip +out-of-range values. +Clipping damages sound quality so use it sparingly. .RE .sp 1 .RS Index: DOCS/xml/en/usage.xml =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/xml/en/usage.xml,v retrieving revision 1.32 diff -u -r1.32 usage.xml --- DOCS/xml/en/usage.xml 14 Sep 2005 21:15:38 -0000 1.32 +++ DOCS/xml/en/usage.xml 15 Sep 2005 02:54:44 -0000 @@ -988,11 +988,75 @@ +Example: Playing the difference between two channels + + +If you want to hear how different two channels are, you can subtract the +first from the second. The result will be mono sound that has only the +differences. Audio that is exactly the same in each source channel will +be silent; audio that is only in one channel will be just as loud; audio +that is partly in one channel will be reduced in volume. + + + +For this example, we only need to work with two channels, so it is not +necessary to specifiy . + will only be outputting a single channel, however, +so should be appended afterward. + + + will use both channels, so the first suboption will +be "2". + + +For the single output channel, the right channel should be subtracted +from the left, giving suboptions "1:-1". Actually, it does not matter +which input channel is subtracted from the other. Reversing the order +will invert the phase, but since is only outputting +one channel it will not be able to interfere with another channel. + + + +Combining the suboptions yields: +mplayer stereo.file -af pan=2:1:-1,channels=1 +You may hear more audio than you expected, particularly music. Often +stereo music that sounds the same in both channels actually has some +components out of phase. This gives more depth to the sound and results +in each channel seeming almost the same but actually being quite +different. In fact, if one channel is exactly out of phase with the +other, then subtracting them will actually double the volume. + + + +Phase inversion + +For a clear explanation of audio phase, read +this document. +MPlayer's filter will +invert the phase of one or more channels when directed to use a negative +amount of a source channel. See the +channel mixing section +for a more thorough explanation of . + + +Example: invert phase of a stereo signal + +mplayer stereo.file -af pan=2:-1:0:0:-1 + + +Example: invert phase of only the left channel + +mplayer stereo.file -af pan=2:-1:0:0:1 + + + + + Software Volume adjustment Index: libaf/af_pan.c =================================================================== RCS file: /cvsroot/mplayer/main/libaf/af_pan.c,v retrieving revision 1.6 diff -u -r1.6 af_pan.c --- libaf/af_pan.c 8 Jan 2005 21:34:06 -0000 1.6 +++ libaf/af_pan.c 15 Sep 2005 02:54:44 -0000 @@ -20,6 +20,8 @@ #include "af.h" +#define MAX_LVL 512 + // Data for specific instances of this filter typedef struct af_pan_s { @@ -65,7 +67,7 @@ j = 0; k = 0; while((*cp == ':') && (k < AF_NCH)){ sscanf(cp, ":%f%n" , &s->level[k][j], &n); - s->level[k][j] = clamp(s->level[k][j],0.0,1.0); + s->level[k][j] = clamp(s->level[k][j],-MAX_LVL,MAX_LVL); af_msg(AF_MSG_VERBOSE,"[pan] Pan level from channel %i to" " channel %i = %f\n",j,k,s->level[k][j]); cp =&cp[n]; @@ -82,7 +84,7 @@ int ch = ((af_control_ext_t*)arg)->ch; float* level = ((af_control_ext_t*)arg)->arg; for(i=0;ilevel[ch][i] = clamp(level[i],0.0,1.0); + s->level[ch][i] = clamp(level[i],-MAX_LVL,MAX_LVL); return AF_OK; } case AF_CONTROL_PAN_LEVEL | AF_CONTROL_GET:{