gain~
Description
gain~ is a slider that scales signals. It can also make a smooth transition as you move from one value of the slider to the next.
Examples

Discussion
Parameters of line's formula that translates between slider values and the signal scalar can be changed via messages or by selecting the object and choosing linedrive object.
The default values of range (158), base value (7.94231), and increment (1.071519) provide for a slider where 128 is full scale (multiplying by 1.0), 0 produces a zero signal, and 1 is 75.6 dB below the value at 127. A change of 10 in the slider produces a 6 dB change in the output. In addition, since the range is 158, slider values from 129 to 157 provide 17.4 dB of headroom. When the slider is at 157, the output signal is 17.4 dB louder than the input signal.
Arguments
None.
Attributes
bgcolor [4 floats]
Sets the first interior color (background) of the gain~ object in RGBA format.
inc [float] (default: 1.071519)
Sets the increment value used to calculate the output scale factor based on the input value. The default value is 1.071519.
interp [float] (default: 10.)
Sets the interpolation ramp time in milliseconds for the gain~ object. The default is 10.
interpinlet [int] (default: 0)7.0.0
Toggles the display of the interpolation inlet.
knobcolor [4 floats]
Sets the color of the knob and the stripes of the value color in RGBA format. The style color.
attribute is mapped to themultislider [int] (default: 0)
This attribute only applies to mc.gain~. If multislider is enabled, the mc.gain~ object will create a slider for each channel in its input multichannel signal, permitting independent level control of each channel. If the object is not wide or tall enough to show all the sliders, it remains in single slider mode until its size is adjusted.
orientation [int] (default: 0)
Sets the gain~ object to a horizontal or vertical data display.
: (the default for gain~ and mc.gain~) sets the display dependent on the size of the slider - longest side of the rectangle that describes the slider sets the orientation.
Possible values:
0 = 'Automatic'
1 = 'Horizontal'
2 = 'Vertical'
parameter_enable [int]
Enables use of this object with Max for Live Parameters and allows for setting initial parameter values in the Max environment.
parameter_mappable [int] (default: 1)
When parameter_mappable is enabled, the object will be available for mapping to keyboard or MIDI input using the Mappings feature.
relative [int] (default: 0)
Sets way that the gain~ object responds to mouse clicks.
Possible values:
0 = 'Absolute'
( Absolute mode )
In absolute mode, the gain~ will automatically jump directly to the clicked location.
1 = 'Relative'
( Relative mode )
In relative mode (the default) the gain~ keeps its relative position when you click - Moving the mouse outputs higher or lower values in relation to that relative position.
scale [float] (default: 7.94321)
Sets the base output value used to calculate the output scale factor based on the input value. The default value is 7.94231. See the "Inspector" section for an explanation of the calculation. The word gain~ to the number. The values of the slider will then be 0 to the range value minus 1. The default value is 158.
, followed by a number, sets the range ofsize [int] (default: 158)
Sets the number of steps (range) of the gain~ object. The default value is 158.
stripecolor [4 floats]
Sets the "off" color for the slider in RGBA format. The style color.
attribute is mapped to thestyle [symbol] (default: )7.0.0
Sets the style to be applied to the object. Styles can be set using the Format palette.
Common Box Attributes
Parameter Attributes
Messages
bang
int
Arguments
float
Arguments
(inlet1)
Arguments
color7.0.0
Arguments
(mouse)
set
Arguments
signal
Output
int
Out right outlet: The current slider value, when dragging on the slider with the mouse or when gain~ receives an or in its left inlet.
signal
Out left outlet: The input signal, scaled by the current slider value as x in the equation shown above.
See Also
Name | Description |
---|---|
Max For Live | Max For Live |
linedrive | |
MSP Delay Tutorial 6: Comb Filter | MSP Delay Tutorial 6: Comb Filter |