def compand(self, attack_time=<NUM_LIT>, decay_time=<NUM_LIT>, soft_knee_db=<NUM_LIT>,<EOL>tf_points=[(-<NUM_LIT>, -<NUM_LIT>), (-<NUM_LIT>, -<NUM_LIT:20>), (<NUM_LIT:0>, <NUM_LIT:0>)],<EOL>):
if not is_number(attack_time) or attack_time <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(decay_time) or decay_time <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if attack_time > decay_time:<EOL><INDENT>logger.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not (is_number(soft_knee_db) or soft_knee_db is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(tf_points, list):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if len(tf_points) == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any(not isinstance(pair, tuple) for pair in tf_points):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any(len(pair) != <NUM_LIT:2> for pair in tf_points):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any(not (is_number(p[<NUM_LIT:0>]) and is_number(p[<NUM_LIT:1>])) for p in tf_points):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((p[<NUM_LIT:0>] > <NUM_LIT:0> or p[<NUM_LIT:1>] > <NUM_LIT:0>) for p in tf_points):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(tf_points) > len(set([p[<NUM_LIT:0>] for p in tf_points])):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>tf_points = sorted(<EOL>tf_points,<EOL>key=lambda tf_points: tf_points[<NUM_LIT:0>]<EOL>)<EOL>transfer_list = []<EOL>for point in tf_points:<EOL><INDENT>transfer_list.extend([<EOL>"<STR_LIT>".format(point[<NUM_LIT:0>]), "<STR_LIT>".format(point[<NUM_LIT:1>])<EOL>])<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>"<STR_LIT>".format(attack_time, decay_time)<EOL>]<EOL>if soft_knee_db is not None:<EOL><INDENT>effect_args.append(<EOL>"<STR_LIT>".format(soft_knee_db, "<STR_LIT:U+002C>".join(transfer_list))<EOL>)<EOL><DEDENT>else:<EOL><INDENT>effect_args.append("<STR_LIT:U+002C>".join(transfer_list))<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>
Compand (compress or expand) the dynamic range of the audio.

        Parameters
        ----------
        attack_time : float, default=0.3
            The time in seconds over which the instantaneous level of the input
            signal is averaged to determine increases in volume.
        decay_time : float, default=0.8
            The time in seconds over which the instantaneous level of the input
            signal is averaged to determine decreases in volume.
        soft_knee_db : float or None, default=6.0
            The ammount (in dB) for which the points at where adjacent line
            segments on the transfer function meet will be rounded.
            If None, no soft_knee is applied.
        tf_points : list of tuples
            Transfer function points as a list of tuples corresponding to
            points in (dB, dB) defining the compander's transfer function.

        See Also
        --------
        mcompand, contrast