def gain(self, gain_db=<NUM_LIT:0.0>, normalize=True, limiter=False, balance=None):
if not is_number(gain_db):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(normalize, bool):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(limiter, bool):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if balance not in [None, '<STR_LIT:e>', '<STR_LIT:B>', '<STR_LIT:b>']:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>if balance is not None:<EOL><INDENT>effect_args.append('<STR_LIT>'.format(balance))<EOL><DEDENT>if normalize:<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>if limiter:<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>effect_args.append('<STR_LIT>'.format(gain_db))<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>
Apply amplification or attenuation to the audio signal.

        Parameters
        ----------
        gain_db : float, default=0.0
            Gain adjustment in decibels (dB).
        normalize : bool, default=True
            If True, audio is normalized to gain_db relative to full scale.
            If False, simply adjusts the audio power level by gain_db.
        limiter : bool, default=False
            If True, a simple limiter is invoked to prevent clipping.
        balance : str or None, default=None
            Balance gain across channels. Can be one of:
             * None applies no balancing (default)
             * 'e' applies gain to all channels other than that with the
                highest peak level, such that all channels attain the same
                peak level
             * 'B' applies gain to all channels other than that with the
                highest RMS level, such that all channels attain the same
                RMS level
             * 'b' applies gain with clipping protection to all channels other
                than that with the highest RMS level, such that all channels
                attain the same RMS level
            If normalize=True, 'B' and 'b' are equivalent.

        See Also
        --------
        loudness