gain~ slider question
How might I use a single gain~ slider to control the output levels of a
stereo pair? The gain~ object takes only one audio input, so I am
trying to figure out some sort of work-around.
The right outlet of [gain~] outputs the current slider position as an
int, and the left inlet of [gain~] takes an int to specify its
current position. So, you can just hook up the left outlet of one
[gain~] to the right inlet of the other to connect them into a stereo
pair (or multi-channel) set with one acting as the ‘master’ fader.
See this patch for example:
#N vpatcher 10 59 610 459;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 293 82 61 196617 cycle~ 442;
#P user gain~ 293 164 24 100 158 0 1.071519 7.94321 10.;
#P user gain~ 259 164 24 100 158 0 1.071519 7.94321 10.;
#P user ezdac~ 259 341 303 374 0;
#P newex 259 60 61 196617 cycle~ 440;
#P connect 0 0 2 0;
#P connect 2 0 1 0;
#P connect 4 0 3 0;
#P connect 2 1 3 0;
#P connect 3 0 1 1;
On Jan 1, 2007, at 3:04 PM, Tim Flood wrote:
> How might I use a single gain~ slider to control the output levels
> of a stereo pair? The gain~ object takes only one audio input, so I
> am trying to figure out some sort of work-around.
> Thank you,
Steven M. Miller
Associate Professor of Contemporary Music
College of Santa Fe
Contemporary Music Program
1600 St. Michaels Drive
Santa Fe NM 87505
Atrium Sound Space
*opportunities for composers & sound artists*
As mentioned, one slider can control two with their additional outlets. I usually have a middle fader between the L / R to do just this during testing (connect right outlet to left inlets of the L/R).
Better yet, I usually have a L / R pair independent of each other, then a master fader below that, so one controls the *relative* levels of both, so the balanced mix can be scaled. This master fader won’t change the levels of the L / R, it will just scale the overall result (after the L/R).
Remember that you can use gain faders to smooth out jumps of other (numerical) sliders (to avoid audio clicks). These faders can even be hidden from the user if desired. This way you can use other sliders (i.e., non-logarithmic) to control the volume. And the slew inlet (right one) is settable for the milliseconds of time it takes to go from one setting to the next, which not only avoids clicks but can be a nice portamento effect for volume–and it settable by the user too.