n_inputs = len(input_filepath_list)<EOL>input_format_list = []<EOL>for _ in range(n_inputs):<EOL><INDENT>input_format_list.append([])<EOL><DEDENT>if input_volumes is None:<EOL><INDENT>vols = [<NUM_LIT:1>] * n_inputs<EOL><DEDENT>else:<EOL><INDENT>n_volumes = len(input_volumes)<EOL>if n_volumes < n_inputs:<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>n_volumes, n_inputs, n_inputs - n_volumes<EOL>)<EOL>vols = input_volumes + [<NUM_LIT:1>] * (n_inputs - n_volumes)<EOL><DEDENT>elif n_volumes > n_inputs:<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>n_volumes, n_inputs, n_volumes - n_inputs<EOL>)<EOL>vols = input_volumes[:n_inputs]<EOL><DEDENT>else:<EOL><INDENT>vols = [v for v in input_volumes]<EOL><DEDENT><DEDENT>if input_format is None:<EOL><INDENT>fmts = [[] for _ in range(n_inputs)]<EOL><DEDENT>else:<EOL><INDENT>n_fmts = len(input_format)<EOL>if n_fmts < n_inputs:<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>n_fmts, n_inputs, n_inputs - n_fmts<EOL>)<EOL>fmts = [f for f in input_format]<EOL>fmts.extend([[] for _ in range(n_inputs - n_fmts)])<EOL><DEDENT>elif n_fmts > n_inputs:<EOL><INDENT>logger.warning(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>n_fmts, n_inputs, n_fmts - n_inputs<EOL>)<EOL>fmts = input_format[:n_inputs]<EOL><DEDENT>else:<EOL><INDENT>fmts = [f for f in input_format]<EOL><DEDENT><DEDENT>for i, (vol, fmt) in enumerate(zip(vols, fmts)):<EOL><INDENT>input_format_list[i].extend(['<STR_LIT>', '<STR_LIT:{}>'.format(vol)])<EOL>input_format_list[i].extend(fmt)<EOL><DEDENT>return input_format_list<EOL>

Set input formats given input_volumes.

    Parameters
    ----------
    input_filepath_list : list of str
        List of input files
    input_volumes : list of float, default=None
        List of volumes to be applied upon combining input files. Volumes
        are applied to the input files in order.
        If None, input files will be combined at their original volumes.
    input_format : list of lists, default=None
        List of input formats to be applied to each input file. Formatting
        arguments are applied to the input files in order.
        If None, the input formats will be inferred from the file header.


if len(input_format_list) != len(input_filepath_list):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>input_args = []<EOL>zipped = zip(input_filepath_list, input_format_list)<EOL>for input_file, input_fmt in zipped:<EOL><INDENT>input_args.extend(input_fmt)<EOL>input_args.append(input_file)<EOL><DEDENT>return input_args<EOL>

Builds input arguments by stitching input filepaths and input
    formats together.


if combine_type not in COMBINE_VALS:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(<EOL>COMBINE_VALS)<EOL>)<EOL><DEDENT>

Check that the combine_type is valid.

    Parameters
    ----------
    combine_type : str
        Combine type.


if not (input_volumes is None or isinstance(input_volumes, list)):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if isinstance(input_volumes, list):<EOL><INDENT>for vol in input_volumes:<EOL><INDENT>if not core.is_number(vol):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>.format(vol)<EOL>)<EOL><DEDENT><DEDENT><DEDENT>

Check input_volumes contains a valid list of volumes.

    Parameters
    ----------
    input_volumes : list
        list of volume values. Castable to numbers.


def build(self, input_filepath_list, output_filepath, combine_type,<EOL>input_volumes=None):

file_info.validate_input_file_list(input_filepath_list)<EOL>file_info.validate_output_file(output_filepath)<EOL>_validate_combine_type(combine_type)<EOL>_validate_volumes(input_volumes)<EOL>input_format_list = _build_input_format_list(<EOL>input_filepath_list, input_volumes, self.input_format<EOL>)<EOL>try:<EOL><INDENT>_validate_file_formats(input_filepath_list, combine_type)<EOL><DEDENT>except SoxiError:<EOL><INDENT>logger.warning("<STR_LIT>")<EOL><DEDENT>args = []<EOL>args.extend(self.globals)<EOL>args.extend(['<STR_LIT>', combine_type])<EOL>input_args = _build_input_args(input_filepath_list, input_format_list)<EOL>args.extend(input_args)<EOL>args.extend(self.output_format)<EOL>args.append(output_filepath)<EOL>args.extend(self.effects)<EOL>status, out, err = sox(args)<EOL>if status != <NUM_LIT:0>:<EOL><INDENT>raise SoxError(<EOL>"<STR_LIT>".format(out, err)<EOL>)<EOL><DEDENT>else:<EOL><INDENT>logger.info(<EOL>"<STR_LIT>",<EOL>output_filepath,<EOL>combine_type,<EOL>"<STR_LIT:U+0020>".join(self.effects_log)<EOL>)<EOL>if out is not None:<EOL><INDENT>logger.info("<STR_LIT>".format(out))<EOL><DEDENT>return True<EOL><DEDENT>

Builds the output_file by executing the current set of commands.

        Parameters
        ----------
        input_filepath_list : list of str
            List of paths to input audio files.
        output_filepath : str
            Path to desired output file. If a file already exists at the given
            path, the file will be overwritten.
        combine_type : str
            Input file combining method. One of the following values:
                * concatenate : combine input files by concatenating in the
                    order given.
                * merge : combine input files by stacking each input file into
                    a new channel of the output file.
                * mix : combine input files by summing samples in corresponding
                    channels.
                * mix-power : combine input files with volume adjustments such
                    that the output volume is roughly equivlent to one of the
                    input signals.
                * multiply : combine input files by multiplying samples in
                    corresponding samples.
        input_volumes : list of float, default=None
            List of volumes to be applied upon combining input files. Volumes
            are applied to the input files in order.
            If None, input files will be combined at their original volumes.


def preview(self, input_filepath_list, combine_type, input_volumes=None):

args = ["<STR_LIT>", "<STR_LIT>"]<EOL>args.extend(self.globals)<EOL>args.extend(['<STR_LIT>', combine_type])<EOL>input_format_list = _build_input_format_list(<EOL>input_filepath_list, input_volumes, self.input_format<EOL>)<EOL>input_args = _build_input_args(input_filepath_list, input_format_list)<EOL>args.extend(input_args)<EOL>args.extend(self.effects)<EOL>play(args)<EOL>

Play a preview of the output with the current set of effects

        Parameters
        ----------
        input_filepath_list : list of str
            List of paths to input audio files.
        combine_type : str
            Input file combining method. One of the following values:
                * concatenate : combine input files by concatenating in the
                    order given.
                * merge : combine input files by stacking each input file into
                    a new channel of the output file.
                * mix : combine input files by summing samples in corresponding
                    channels.
                * mix-power : combine input files with volume adjustments such
                    that the output volume is roughly equivlent to one of the
                    input signals.
                * multiply : combine input files by multiplying samples in
                    corresponding samples.
        input_volumes : list of float, default=None
            List of volumes to be applied upon combining input files. Volumes
            are applied to the input files in order.
            If None, input files will be combined at their original volumes.


def set_input_format(self, file_type=None, rate=None, bits=None,<EOL>channels=None, encoding=None, ignore_length=None):

if file_type is not None and not isinstance(file_type, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if file_type is not None:<EOL><INDENT>if not all([f in VALID_FORMATS for f in file_type]):<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(VALID_FORMATS)<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>file_type = []<EOL><DEDENT>if rate is not None and not isinstance(rate, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if rate is not None:<EOL><INDENT>if not all([is_number(r) and r > <NUM_LIT:0> for r in rate]):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>rate = []<EOL><DEDENT>if bits is not None and not isinstance(bits, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if bits is not None:<EOL><INDENT>if not all([isinstance(b, int) and b > <NUM_LIT:0> for b in bits]):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>bits = []<EOL><DEDENT>if channels is not None and not isinstance(channels, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if channels is not None:<EOL><INDENT>if not all([isinstance(c, int) and c > <NUM_LIT:0> for c in channels]):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>channels = []<EOL><DEDENT>if encoding is not None and not isinstance(encoding, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if encoding is not None:<EOL><INDENT>if not all([e in ENCODING_VALS for e in encoding]):<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(ENCODING_VALS)<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>encoding = []<EOL><DEDENT>if ignore_length is not None and not isinstance(ignore_length, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if ignore_length is not None:<EOL><INDENT>if not all([isinstance(l, bool) for l in ignore_length]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>ignore_length = []<EOL><DEDENT>max_input_arg_len = max([<EOL>len(file_type), len(rate), len(bits), len(channels),<EOL>len(encoding), len(ignore_length)<EOL>])<EOL>input_format = []<EOL>for _ in range(max_input_arg_len):<EOL><INDENT>input_format.append([])<EOL><DEDENT>for i, f in enumerate(file_type):<EOL><INDENT>input_format[i].extend(['<STR_LIT>', '<STR_LIT:{}>'.format(f)])<EOL><DEDENT>for i, r in enumerate(rate):<EOL><INDENT>input_format[i].extend(['<STR_LIT>', '<STR_LIT:{}>'.format(r)])<EOL><DEDENT>for i, b in enumerate(bits):<EOL><INDENT>input_format[i].extend(['<STR_LIT>', '<STR_LIT:{}>'.format(b)])<EOL><DEDENT>for i, c in enumerate(channels):<EOL><INDENT>input_format[i].extend(['<STR_LIT:-c>', '<STR_LIT:{}>'.format(c)])<EOL><DEDENT>for i, e in enumerate(encoding):<EOL><INDENT>input_format[i].extend(['<STR_LIT>', '<STR_LIT:{}>'.format(e)])<EOL><DEDENT>for i, l in enumerate(ignore_length):<EOL><INDENT>if l is True:<EOL><INDENT>input_format[i].append('<STR_LIT>')<EOL><DEDENT><DEDENT>self.input_format = input_format<EOL>return self<EOL>

Sets input file format arguments. This is primarily useful when
        dealing with audio files without a file extension. Overwrites any
        previously set input file arguments.

        If this function is not explicity called the input format is inferred
        from the file extension or the file's header.

        Parameters
        ----------
        file_type : list of str or None, default=None
            The file type of the input audio file. Should be the same as what
            the file extension would be, for ex. 'mp3' or 'wav'.
        rate : list of float or None, default=None
            The sample rate of the input audio file. If None the sample rate
            is inferred.
        bits : list of int or None, default=None
            The number of bits per sample. If None, the number of bits per
            sample is inferred.
        channels : list of int or None, default=None
            The number of channels in the audio file. If None the number of
            channels is inferred.
        encoding : list of str or None, default=None
            The audio encoding type. Sometimes needed with file-types that
            support more than one encoding type. One of:
                * signed-integer : PCM data stored as signed (‘two’s
                    complement’) integers. Commonly used with a 16 or 24−bit
                    encoding size. A value of 0 represents minimum signal
                    power.
                * unsigned-integer : PCM data stored as unsigned integers.
                    Commonly used with an 8-bit encoding size. A value of 0
                    represents maximum signal power.
                * floating-point : PCM data stored as IEEE 753 single precision
                    (32-bit) or double precision (64-bit) floating-point
                    (‘real’) numbers. A value of 0 represents minimum signal
                    power.
                * a-law : International telephony standard for logarithmic
                    encoding to 8 bits per sample. It has a precision
                    equivalent to roughly 13-bit PCM and is sometimes encoded
                    with reversed bit-ordering.
                * u-law : North American telephony standard for logarithmic
                    encoding to 8 bits per sample. A.k.a. μ-law. It has a
                    precision equivalent to roughly 14-bit PCM and is sometimes
                    encoded with reversed bit-ordering.
                * oki-adpcm : OKI (a.k.a. VOX, Dialogic, or Intel) 4-bit ADPCM;
                    it has a precision equivalent to roughly 12-bit PCM. ADPCM
                    is a form of audio compression that has a good compromise
                    between audio quality and encoding/decoding speed.
                * ima-adpcm : IMA (a.k.a. DVI) 4-bit ADPCM; it has a precision
                    equivalent to roughly 13-bit PCM.
                * ms-adpcm : Microsoft 4-bit ADPCM; it has a precision
                    equivalent to roughly 14-bit PCM.
                * gsm-full-rate : GSM is currently used for the vast majority
                    of the world’s digital wireless telephone calls. It
                    utilises several audio formats with different bit-rates and
                    associated speech quality. SoX has support for GSM’s
                    original 13kbps ‘Full Rate’ audio format. It is usually
                    CPU-intensive to work with GSM audio.
        ignore_length : list of bool or None, default=None
            If True, overrides an (incorrect) audio length given in an audio
            file’s header. If this option is given then SoX will keep reading
            audio until it reaches the end of the input file.


self.input_format = []<EOL>self.output_format = []<EOL>self.effects = []<EOL>self.effects_log = []<EOL>self.globals = []<EOL>self.set_globals()<EOL>

Attributes
----------
input_format : list of str
    Input file format arguments that will be passed to SoX.
output_format : list of str
    Output file format arguments that will be bassed to SoX.
effects : list of str
    Effects arguments that will be passed to SoX.
effects_log : list of str
    Ordered sequence of effects applied.
globals : list of str
    Global arguments that will be passed to SoX.


def set_globals(self, dither=False, guard=False, multithread=False,<EOL>replay_gain=False, verbosity=<NUM_LIT:2>):

if not isinstance(dither, bool):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(guard, bool):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(multithread, bool):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(replay_gain, bool):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if verbosity not in VERBOSITY_VALS:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(<EOL>VERBOSITY_VALS)<EOL>)<EOL><DEDENT>global_args = []<EOL>if not dither:<EOL><INDENT>global_args.append('<STR_LIT>')<EOL><DEDENT>if guard:<EOL><INDENT>global_args.append('<STR_LIT>')<EOL><DEDENT>if multithread:<EOL><INDENT>global_args.append('<STR_LIT>')<EOL><DEDENT>if replay_gain:<EOL><INDENT>global_args.append('<STR_LIT>')<EOL>global_args.append('<STR_LIT>')<EOL><DEDENT>global_args.append('<STR_LIT>'.format(verbosity))<EOL>self.globals = global_args<EOL>return self<EOL>

Sets SoX's global arguments.
        Overwrites any previously set global arguments.
        If this function is not explicity called, globals are set to this
        function's defaults.

        Parameters
        ----------
        dither : bool, default=False
            If True, dithering is applied for low files with low bit rates.
        guard : bool, default=False
            If True, invokes the gain effect to guard against clipping.
        multithread : bool, default=False
            If True, each channel is processed in parallel.
        replay_gain : bool, default=False
            If True, applies replay-gain adjustment to input-files.
        verbosity : int, default=2
            SoX's verbosity level. One of:
                * 0 : No messages are shown at all
                * 1 : Only error messages are shown. These are generated if SoX
                    cannot complete the requested commands.
                * 2 : Warning messages are also shown. These are generated if
                    SoX can complete the requested commands, but not exactly
                    according to the requested command parameters, or if
                    clipping occurs.
                * 3 : Descriptions of SoX’s processing phases are also shown.
                    Useful for seeing exactly how SoX is processing your audio.
                * 4, >4 : Messages to help with debugging SoX are also shown.


def set_input_format(self, file_type=None, rate=None, bits=None,<EOL>channels=None, encoding=None, ignore_length=False):

if file_type not in VALID_FORMATS + [None]:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(VALID_FORMATS)<EOL>)<EOL><DEDENT>if not is_number(rate) and rate is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if rate is not None and rate <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(bits, int) and bits is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if bits is not None and bits <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(channels, int) and channels is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if channels is not None and channels <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if encoding not in ENCODING_VALS + [None]:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(ENCODING_VALS)<EOL>)<EOL><DEDENT>if not isinstance(ignore_length, bool):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>input_format = []<EOL>if file_type is not None:<EOL><INDENT>input_format.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(file_type)])<EOL><DEDENT>if rate is not None:<EOL><INDENT>input_format.extend(['<STR_LIT>', '<STR_LIT>'.format(rate)])<EOL><DEDENT>if bits is not None:<EOL><INDENT>input_format.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(bits)])<EOL><DEDENT>if channels is not None:<EOL><INDENT>input_format.extend(['<STR_LIT:-c>', '<STR_LIT:{}>'.format(channels)])<EOL><DEDENT>if encoding is not None:<EOL><INDENT>input_format.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(encoding)])<EOL><DEDENT>if ignore_length:<EOL><INDENT>input_format.append('<STR_LIT>')<EOL><DEDENT>self.input_format = input_format<EOL>return self<EOL>

Sets input file format arguments. This is primarily useful when
        dealing with audio files without a file extension. Overwrites any
        previously set input file arguments.

        If this function is not explicity called the input format is inferred
        from the file extension or the file's header.

        Parameters
        ----------
        file_type : str or None, default=None
            The file type of the input audio file. Should be the same as what
            the file extension would be, for ex. 'mp3' or 'wav'.
        rate : float or None, default=None
            The sample rate of the input audio file. If None the sample rate
            is inferred.
        bits : int or None, default=None
            The number of bits per sample. If None, the number of bits per
            sample is inferred.
        channels : int or None, default=None
            The number of channels in the audio file. If None the number of
            channels is inferred.
        encoding : str or None, default=None
            The audio encoding type. Sometimes needed with file-types that
            support more than one encoding type. One of:
                * signed-integer : PCM data stored as signed (‘two’s
                    complement’) integers. Commonly used with a 16 or 24−bit
                    encoding size. A value of 0 represents minimum signal
                    power.
                * unsigned-integer : PCM data stored as unsigned integers.
                    Commonly used with an 8-bit encoding size. A value of 0
                    represents maximum signal power.
                * floating-point : PCM data stored as IEEE 753 single precision
                    (32-bit) or double precision (64-bit) floating-point
                    (‘real’) numbers. A value of 0 represents minimum signal
                    power.
                * a-law : International telephony standard for logarithmic
                    encoding to 8 bits per sample. It has a precision
                    equivalent to roughly 13-bit PCM and is sometimes encoded
                    with reversed bit-ordering.
                * u-law : North American telephony standard for logarithmic
                    encoding to 8 bits per sample. A.k.a. μ-law. It has a
                    precision equivalent to roughly 14-bit PCM and is sometimes
                    encoded with reversed bit-ordering.
                * oki-adpcm : OKI (a.k.a. VOX, Dialogic, or Intel) 4-bit ADPCM;
                    it has a precision equivalent to roughly 12-bit PCM. ADPCM
                    is a form of audio compression that has a good compromise
                    between audio quality and encoding/decoding speed.
                * ima-adpcm : IMA (a.k.a. DVI) 4-bit ADPCM; it has a precision
                    equivalent to roughly 13-bit PCM.
                * ms-adpcm : Microsoft 4-bit ADPCM; it has a precision
                    equivalent to roughly 14-bit PCM.
                * gsm-full-rate : GSM is currently used for the vast majority
                    of the world’s digital wireless telephone calls. It
                    utilises several audio formats with different bit-rates and
                    associated speech quality. SoX has support for GSM’s
                    original 13kbps ‘Full Rate’ audio format. It is usually
                    CPU-intensive to work with GSM audio.
        ignore_length : bool, default=False
            If True, overrides an (incorrect) audio length given in an audio
            file’s header. If this option is given then SoX will keep reading
            audio until it reaches the end of the input file.


def set_output_format(self, file_type=None, rate=None, bits=None,<EOL>channels=None, encoding=None, comments=None,<EOL>append_comments=True):

if file_type not in VALID_FORMATS + [None]:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(VALID_FORMATS)<EOL>)<EOL><DEDENT>if not is_number(rate) and rate is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if rate is not None and rate <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(bits, int) and bits is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if bits is not None and bits <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(channels, int) and channels is not None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if channels is not None and channels <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if encoding not in ENCODING_VALS + [None]:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(ENCODING_VALS)<EOL>)<EOL><DEDENT>if comments is not None and not isinstance(comments, str):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(append_comments, bool):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>output_format = []<EOL>if file_type is not None:<EOL><INDENT>output_format.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(file_type)])<EOL><DEDENT>if rate is not None:<EOL><INDENT>output_format.extend(['<STR_LIT>', '<STR_LIT>'.format(rate)])<EOL><DEDENT>if bits is not None:<EOL><INDENT>output_format.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(bits)])<EOL><DEDENT>if channels is not None:<EOL><INDENT>output_format.extend(['<STR_LIT:-c>', '<STR_LIT:{}>'.format(channels)])<EOL><DEDENT>if encoding is not None:<EOL><INDENT>output_format.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(encoding)])<EOL><DEDENT>if comments is not None:<EOL><INDENT>if append_comments:<EOL><INDENT>output_format.extend(['<STR_LIT>', comments])<EOL><DEDENT>else:<EOL><INDENT>output_format.extend(['<STR_LIT>', comments])<EOL><DEDENT><DEDENT>self.output_format = output_format<EOL>return self<EOL>

Sets output file format arguments. These arguments will overwrite
        any format related arguments supplied by other effects (e.g. rate).

        If this function is not explicity called the output format is inferred
        from the file extension or the file's header.

        Parameters
        ----------
        file_type : str or None, default=None
            The file type of the output audio file. Should be the same as what
            the file extension would be, for ex. 'mp3' or 'wav'.
        rate : float or None, default=None
            The sample rate of the output audio file. If None the sample rate
            is inferred.
        bits : int or None, default=None
            The number of bits per sample. If None, the number of bits per
            sample is inferred.
        channels : int or None, default=None
            The number of channels in the audio file. If None the number of
            channels is inferred.
        encoding : str or None, default=None
            The audio encoding type. Sometimes needed with file-types that
            support more than one encoding type. One of:
                * signed-integer : PCM data stored as signed (‘two’s
                    complement’) integers. Commonly used with a 16 or 24−bit
                    encoding size. A value of 0 represents minimum signal
                    power.
                * unsigned-integer : PCM data stored as unsigned integers.
                    Commonly used with an 8-bit encoding size. A value of 0
                    represents maximum signal power.
                * floating-point : PCM data stored as IEEE 753 single precision
                    (32-bit) or double precision (64-bit) floating-point
                    (‘real’) numbers. A value of 0 represents minimum signal
                    power.
                * a-law : International telephony standard for logarithmic
                    encoding to 8 bits per sample. It has a precision
                    equivalent to roughly 13-bit PCM and is sometimes encoded
                    with reversed bit-ordering.
                * u-law : North American telephony standard for logarithmic
                    encoding to 8 bits per sample. A.k.a. μ-law. It has a
                    precision equivalent to roughly 14-bit PCM and is sometimes
                    encoded with reversed bit-ordering.
                * oki-adpcm : OKI (a.k.a. VOX, Dialogic, or Intel) 4-bit ADPCM;
                    it has a precision equivalent to roughly 12-bit PCM. ADPCM
                    is a form of audio compression that has a good compromise
                    between audio quality and encoding/decoding speed.
                * ima-adpcm : IMA (a.k.a. DVI) 4-bit ADPCM; it has a precision
                    equivalent to roughly 13-bit PCM.
                * ms-adpcm : Microsoft 4-bit ADPCM; it has a precision
                    equivalent to roughly 14-bit PCM.
                * gsm-full-rate : GSM is currently used for the vast majority
                    of the world’s digital wireless telephone calls. It
                    utilises several audio formats with different bit-rates and
                    associated speech quality. SoX has support for GSM’s
                    original 13kbps ‘Full Rate’ audio format. It is usually
                    CPU-intensive to work with GSM audio.
        comments : str or None, default=None
            If not None, the string is added as a comment in the header of the
            output audio file. If None, no comments are added.
        append_comments : bool, default=True
            If True, comment strings are appended to SoX's default comments. If
            False, the supplied comment replaces the existing comment.


self.effects = list()<EOL>self.effects_log = list()<EOL>return self<EOL>


def build(self, input_filepath, output_filepath, extra_args=None,<EOL>return_output=False):

file_info.validate_input_file(input_filepath)<EOL>if output_filepath is not None:<EOL><INDENT>file_info.validate_output_file(output_filepath)<EOL><DEDENT>else:<EOL><INDENT>output_filepath = '<STR_LIT>'<EOL><DEDENT>if input_filepath == output_filepath:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>args = []<EOL>args.extend(self.globals)<EOL>args.extend(self.input_format)<EOL>args.append(input_filepath)<EOL>args.extend(self.output_format)<EOL>args.append(output_filepath)<EOL>args.extend(self.effects)<EOL>if extra_args is not None:<EOL><INDENT>if not isinstance(extra_args, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>args.extend(extra_args)<EOL><DEDENT>status, out, err = sox(args)<EOL>if status != <NUM_LIT:0>:<EOL><INDENT>raise SoxError(<EOL>"<STR_LIT>".format(out, err)<EOL>)<EOL><DEDENT>else:<EOL><INDENT>logger.info(<EOL>"<STR_LIT>",<EOL>output_filepath,<EOL>"<STR_LIT:U+0020>".join(self.effects_log)<EOL>)<EOL>if out is not None:<EOL><INDENT>logger.info("<STR_LIT>".format(out))<EOL><DEDENT>if return_output:<EOL><INDENT>return status, out, err<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>

Builds the output_file by executing the current set of commands.

        Parameters
        ----------
        input_filepath : str
            Path to input audio file.
        output_filepath : str or None
            Path to desired output file. If a file already exists at the given
            path, the file will be overwritten.
            If None, no file will be created.
        extra_args : list or None, default=None
            If a list is given, these additional arguments are passed to SoX
            at the end of the list of effects.
            Don't use this argument unless you know exactly what you're doing!
        return_output : bool, default=False
            If True, returns the status and information sent to stderr and
            stdout as a tuple (status, stdout, stderr).
            Otherwise returns True on success.


args = ["<STR_LIT>", "<STR_LIT>"]<EOL>args.extend(self.globals)<EOL>args.extend(self.input_format)<EOL>args.append(input_filepath)<EOL>args.extend(self.effects)<EOL>play(args)<EOL>

Play a preview of the output with the current set of effects

        Parameters
        ----------
        input_filepath : str
            Path to input audio file.


def allpass(self, frequency, width_q=<NUM_LIT>):

if not is_number(frequency) or frequency <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(width_q) or width_q <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>', '<STR_LIT>'.format(frequency), '<STR_LIT>'.format(width_q)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a two-pole all-pass filter. An all-pass filter changes the
        audio’s frequency to phase relationship without changing its frequency
        to amplitude relationship. The filter is described in detail in at
        http://musicdsp.org/files/Audio-EQ-Cookbook.txt

        Parameters
        ----------
        frequency : float
            The filter's center frequency in Hz.
        width_q : float, default=2.0
            The filter's width as a Q-factor.

        See Also
        --------
        equalizer, highpass, lowpass, sinc


def bandpass(self, frequency, width_q=<NUM_LIT>, constant_skirt=False):

if not is_number(frequency) or frequency <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(width_q) or width_q <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(constant_skirt, bool):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>if constant_skirt:<EOL><INDENT>effect_args.append('<STR_LIT:-c>')<EOL><DEDENT>effect_args.extend(['<STR_LIT>'.format(frequency), '<STR_LIT>'.format(width_q)])<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a two-pole Butterworth band-pass filter with the given central
        frequency, and (3dB-point) band-width. The filter rolls off at 6dB per
        octave (20dB per decade) and is described in detail in
        http://musicdsp.org/files/Audio-EQ-Cookbook.txt

        Parameters
        ----------
        frequency : float
            The filter's center frequency in Hz.
        width_q : float, default=2.0
            The filter's width as a Q-factor.
        constant_skirt : bool, default=False
            If True, selects constant skirt gain (peak gain = width_q).
            If False, selects constant 0dB peak gain.

        See Also
        --------
        bandreject, sinc


def bandreject(self, frequency, width_q=<NUM_LIT>):

Apply a two-pole Butterworth band-reject filter with the given
        central frequency, and (3dB-point) band-width. The filter rolls off at
        6dB per octave (20dB per decade) and is described in detail in
        http://musicdsp.org/files/Audio-EQ-Cookbook.txt

        Parameters
        ----------
        frequency : float
            The filter's center frequency in Hz.
        width_q : float, default=2.0
            The filter's width as a Q-factor.
        constant_skirt : bool, default=False
            If True, selects constant skirt gain (peak gain = width_q).
            If False, selects constant 0dB peak gain.

        See Also
        --------
        bandreject, sinc


def bass(self, gain_db, frequency=<NUM_LIT>, slope=<NUM_LIT:0.5>):

if not is_number(gain_db):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(frequency) or frequency <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(slope) or slope <= <NUM_LIT:0> or slope > <NUM_LIT:1.0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>', '<STR_LIT>'.format(gain_db), '<STR_LIT>'.format(frequency),<EOL>'<STR_LIT>'.format(slope)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Boost or cut the bass (lower) frequencies of the audio using a
        two-pole shelving filter with a response similar to that of a standard
        hi-fi’s tone-controls. This is also known as shelving equalisation.

        The filters are described in detail in
        http://musicdsp.org/files/Audio-EQ-Cookbook.txt

        Parameters
        ----------
        gain_db : float
            The gain at 0 Hz.
            For a large cut use -20, for a large boost use 20.
        frequency : float, default=100.0
            The filter's cutoff frequency in Hz.
        slope : float, default=0.5
            The steepness of the filter's shelf transition.
            For a gentle slope use 0.3, and use 1.0 for a steep slope.

        See Also
        --------
        treble, equalizer


def bend(self, n_bends, start_times, end_times, cents, frame_rate=<NUM_LIT>,<EOL>oversample_rate=<NUM_LIT:16>):

if not isinstance(n_bends, int) or n_bends < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(start_times, list) or len(start_times) != n_bends:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([(not is_number(p) or p <= <NUM_LIT:0>) for p in start_times]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if sorted(start_times) != start_times:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(end_times, list) or len(end_times) != n_bends:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([(not is_number(p) or p <= <NUM_LIT:0>) for p in end_times]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if sorted(end_times) != end_times:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([e <= s for s, e in zip(start_times, end_times)]):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if any([e > s for s, e in zip(start_times[<NUM_LIT:1>:], end_times[:-<NUM_LIT:1>])]):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not isinstance(cents, list) or len(cents) != n_bends:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([not is_number(p) for p in cents]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (not isinstance(frame_rate, int) or<EOL>frame_rate < <NUM_LIT:10> or frame_rate > <NUM_LIT>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (not isinstance(oversample_rate, int) or<EOL>oversample_rate < <NUM_LIT:4> or oversample_rate > <NUM_LIT:32>):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT:{}>'.format(frame_rate),<EOL>'<STR_LIT>', '<STR_LIT:{}>'.format(oversample_rate)<EOL>]<EOL>last = <NUM_LIT:0><EOL>for i in range(n_bends):<EOL><INDENT>t_start = round(start_times[i] - last, <NUM_LIT:2>)<EOL>t_end = round(end_times[i] - start_times[i], <NUM_LIT:2>)<EOL>effect_args.append(<EOL>'<STR_LIT>'.format(t_start, cents[i], t_end)<EOL>)<EOL>last = end_times[i]<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Changes pitch by specified amounts at specified times.
        The pitch-bending algorithm utilises the Discrete Fourier Transform
        (DFT) at a particular frame rate and over-sampling rate.

        Parameters
        ----------
        n_bends : int
            The number of intervals to pitch shift
        start_times : list of floats
            A list of absolute start times (in seconds), in order
        end_times : list of floats
            A list of absolute end times (in seconds) in order.
            [start_time, end_time] intervals may not overlap!
        cents : list of floats
            A list of pitch shifts in cents. A positive value shifts the pitch
            up, a negative value shifts the pitch down.
        frame_rate : int, default=25
            The number of DFT frames to process per second, between 10 and 80
        oversample_rate: int, default=16
            The number of frames to over sample per second, between 4 and 32

        See Also
        --------
        pitch


if not isinstance(b, list):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not isinstance(a, list):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if len(b) != <NUM_LIT:3>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if len(a) != <NUM_LIT:3>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not all([is_number(b_val) for b_val in b]):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not all([is_number(a_val) for a_val in a]):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>', '<STR_LIT>'.format(b[<NUM_LIT:0>]), '<STR_LIT>'.format(b[<NUM_LIT:1>]),<EOL>'<STR_LIT>'.format(b[<NUM_LIT:2>]), '<STR_LIT>'.format(a[<NUM_LIT:0>]),<EOL>'<STR_LIT>'.format(a[<NUM_LIT:1>]), '<STR_LIT>'.format(a[<NUM_LIT:2>])<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a biquad IIR filter with the given coefficients.

        Parameters
        ----------
        b : list of floats
            Numerator coefficients. Must be length 3
        a : list of floats
            Denominator coefficients. Must be length 3

        See Also
        --------
        fir, treble, bass, equalizer


if not isinstance(n_channels, int) or n_channels <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = ['<STR_LIT>', '<STR_LIT:{}>'.format(n_channels)]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Change the number of channels in the audio signal. If decreasing the
        number of channels it mixes channels together, if increasing the number
        of channels it duplicates.

        Note: This overrides arguments used in the convert effect!

        Parameters
        ----------
        n_channels : int
            Desired number of channels.

        See Also
        --------
        convert


def chorus(self, gain_in=<NUM_LIT:0.5>, gain_out=<NUM_LIT>, n_voices=<NUM_LIT:3>, delays=None,<EOL>decays=None, speeds=None, depths=None, shapes=None):

if not is_number(gain_in) or gain_in <= <NUM_LIT:0> or gain_in > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(gain_out) or gain_out <= <NUM_LIT:0> or gain_out > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(n_voices, int) or n_voices <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not (delays is None or isinstance(delays, list)):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if delays is not None:<EOL><INDENT>if len(delays) != n_voices:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p < <NUM_LIT:20>) for p in delays):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>delays = [random.uniform(<NUM_LIT>, <NUM_LIT>) for _ in range(n_voices)]<EOL><DEDENT>if not (decays is None or isinstance(decays, list)):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if decays is not None:<EOL><INDENT>if len(decays) != n_voices:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p <= <NUM_LIT:0> or p > <NUM_LIT:1>) for p in decays):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>decays = [random.uniform(<NUM_LIT>, <NUM_LIT>) for _ in range(n_voices)]<EOL><DEDENT>if not (speeds is None or isinstance(speeds, list)):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if speeds is not None:<EOL><INDENT>if len(speeds) != n_voices:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p <= <NUM_LIT:0>) for p in speeds):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>speeds = [random.uniform(<NUM_LIT>, <NUM_LIT>) for _ in range(n_voices)]<EOL><DEDENT>if not (depths is None or isinstance(depths, list)):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if depths is not None:<EOL><INDENT>if len(depths) != n_voices:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p <= <NUM_LIT:0>) for p in depths):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>depths = [random.uniform(<NUM_LIT:1.0>, <NUM_LIT>) for _ in range(n_voices)]<EOL><DEDENT>if not (shapes is None or isinstance(shapes, list)):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if shapes is not None:<EOL><INDENT>if len(shapes) != n_voices:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((p not in ['<STR_LIT:t>', '<STR_LIT:s>']) for p in shapes):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>shapes = [random.choice(['<STR_LIT:t>', '<STR_LIT:s>']) for _ in range(n_voices)]<EOL><DEDENT>effect_args = ['<STR_LIT>', '<STR_LIT:{}>'.format(gain_in), '<STR_LIT:{}>'.format(gain_out)]<EOL>for i in range(n_voices):<EOL><INDENT>effect_args.extend([<EOL>'<STR_LIT>'.format(delays[i]),<EOL>'<STR_LIT>'.format(decays[i]),<EOL>'<STR_LIT>'.format(speeds[i]),<EOL>'<STR_LIT>'.format(depths[i]),<EOL>'<STR_LIT>'.format(shapes[i])<EOL>])<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Add a chorus effect to the audio. This can makeasingle vocal sound
        like a chorus, but can also be applied to instrumentation.

        Chorus resembles an echo effect with a short delay, but whereas with
        echo the delay is constant, with chorus, it is varied using sinusoidal
        or triangular modulation. The modulation depth defines the range the
        modulated delay is played before or after the delay. Hence the delayed
        sound will sound slower or faster, that is the delayed sound tuned
        around the original one, like in a chorus where some vocals are
        slightly off key.

        Parameters
        ----------
        gain_in : float, default=0.3
            The time in seconds over which the instantaneous level of the input
            signal is averaged to determine increases in volume.
        gain_out : float, default=0.8
            The time in seconds over which the instantaneous level of the input
            signal is averaged to determine decreases in volume.
        n_voices : int, default=3
            The number of voices in the chorus effect.
        delays : list of floats > 20 or None, default=None
            If a list, the list of delays (in miliseconds) of length n_voices.
            If None, the individual delay parameters are chosen automatically
            to be between 40 and 60 miliseconds.
        decays : list of floats or None, default=None
            If a list, the list of decays (as a fraction of gain_in) of length
            n_voices.
            If None, the individual decay parameters are chosen automatically
            to be between 0.3 and 0.4.
        speeds : list of floats or None, default=None
            If a list, the list of modulation speeds (in Hz) of length n_voices
            If None, the individual speed parameters are chosen automatically
            to be between 0.25 and 0.4 Hz.
        depths : list of floats or None, default=None
            If a list, the list of depths (in miliseconds) of length n_voices.
            If None, the individual delay parameters are chosen automatically
            to be between 1 and 3 miliseconds.
        shapes : list of 's' or 't' or None, deault=None
            If a list, the list of modulation shapes - 's' for sinusoidal or
            't' for triangular - of length n_voices.
            If None, the individual shapes are chosen automatically.


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


if not is_number(amount) or amount < <NUM_LIT:0> or amount > <NUM_LIT:100>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = ['<STR_LIT>', '<STR_LIT>'.format(amount)]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Comparable with compression, this effect modifies an audio signal to
        make it sound louder.

        Parameters
        ----------
        amount : float
            Amount of enhancement between 0 and 100.

        See Also
        --------
        compand, mcompand


def convert(self, samplerate=None, n_channels=None, bitdepth=None):

bitdepths = [<NUM_LIT:8>, <NUM_LIT:16>, <NUM_LIT>, <NUM_LIT:32>, <NUM_LIT:64>]<EOL>if bitdepth is not None:<EOL><INDENT>if bitdepth not in bitdepths:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(str(bitdepths))<EOL>)<EOL><DEDENT>self.output_format.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(bitdepth)])<EOL><DEDENT>if n_channels is not None:<EOL><INDENT>if not isinstance(n_channels, int) or n_channels <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>self.output_format.extend(['<STR_LIT:-c>', '<STR_LIT:{}>'.format(n_channels)])<EOL><DEDENT>if samplerate is not None:<EOL><INDENT>if not is_number(samplerate) or samplerate <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>self.rate(samplerate)<EOL><DEDENT>return self<EOL>

Converts output audio to the specified format.

        Parameters
        ----------
        samplerate : float, default=None
            Desired samplerate. If None, defaults to the same as input.
        n_channels : int, default=None
            Desired number of channels. If None, defaults to the same as input.
        bitdepth : int, default=None
            Desired bitdepth. If None, defaults to the same as input.

        See Also
        --------
        rate


if not is_number(shift) or shift < -<NUM_LIT:2> or shift > <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = ['<STR_LIT>', '<STR_LIT>'.format(shift)]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a DC shift to the audio.

        Parameters
        ----------
        shift : float
            Amount to shift audio between -2 and 2. (Audio is between -1 and 1)

        See Also
        --------
        highpass


effect_args = ['<STR_LIT>']<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply Compact Disc (IEC 60908) de-emphasis (a treble attenuation
        shelving filter). Pre-emphasis was applied in the mastering of some
        CDs issued in the early 1980s. These included many classical music
        albums, as well as now sought-after issues of albums by The Beatles,
        Pink Floyd and others. Pre-emphasis should be removed at playback time
        by a de-emphasis filter in the playback device. However, not all modern
        CD players have this filter, and very few PC CD drives have it; playing
        pre-emphasised audio without the correct de-emphasis filter results in
        audio that sounds harsh and is far from what its creators intended.

        The de-emphasis filter is implemented as a biquad and requires the
        input audio sample rate to be either 44.1kHz or 48kHz. Maximum
        deviation from the ideal response is only 0.06dB (up to 20kHz).

        See Also
        --------
        bass, treble


if not isinstance(positions, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not all((is_number(p) and p >= <NUM_LIT:0>) for p in positions):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>effect_args.extend(['<STR_LIT>'.format(p) for p in positions])<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Delay one or more audio channels such that they start at the given
        positions.

        Parameters
        ----------
        positions: list of floats
            List of times (in seconds) to delay each audio channel.
            If fewer positions are given than the number of channels, the
            remaining channels will be unaffected.


if not isinstance(factor, int) or factor < <NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = ['<STR_LIT>', '<STR_LIT:{}>'.format(factor)]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Downsample the signal by an integer factor. Only the first out of
        each factor samples is retained, the others are discarded.

        No decimation filter is applied. If the input is not a properly
        bandlimited baseband signal, aliasing will occur. This may be desirable
        e.g., for frequency translation.

        For a general resampling effect with anti-aliasing, see rate.

        Parameters
        ----------
        factor : int, default=2
            Downsampling factor.

        See Also
        --------
        rate, upsample


Makes audio easier to listen to on headphones. Adds ‘cues’ to 44.1kHz
        stereo audio so that when listened to on headphones the stereo image is
        moved from inside your head (standard for headphones) to outside and in
        front of the listener (standard for speakers).

        Warning: Will only work properly on 44.1kHz stereo audio!


def echo(self, gain_in=<NUM_LIT>, gain_out=<NUM_LIT>, n_echos=<NUM_LIT:1>, delays=[<NUM_LIT>],<EOL>decays=[<NUM_LIT>]):

if not is_number(gain_in) or gain_in <= <NUM_LIT:0> or gain_in > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(gain_out) or gain_out <= <NUM_LIT:0> or gain_out > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(n_echos, int) or n_echos <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(delays, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(delays) != n_echos:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p <= <NUM_LIT:0>) for p in delays):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(decays, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(decays) != n_echos:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p <= <NUM_LIT:0> or p > <NUM_LIT:1>) for p in decays):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>effect_args = ['<STR_LIT>', '<STR_LIT>'.format(gain_in), '<STR_LIT>'.format(gain_out)]<EOL>for i in range(n_echos):<EOL><INDENT>effect_args.extend([<EOL>'<STR_LIT:{}>'.format(delays[i]),<EOL>'<STR_LIT:{}>'.format(decays[i])<EOL>])<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Add echoing to the audio.

        Echoes are reflected sound and can occur naturally amongst mountains
        (and sometimes large buildings) when talking or shouting; digital echo
        effects emulate this behav- iour and are often used to help fill out
        the sound of a single instrument or vocal. The time differ- ence
        between the original signal and the reflection is the 'delay' (time),
        and the loudness of the reflected signal is the 'decay'. Multiple
        echoes can have different delays and decays.

        Parameters
        ----------
        gain_in : float, default=0.8
            Input volume, between 0 and 1
        gain_out : float, default=0.9
            Output volume, between 0 and 1
        n_echos : int, default=1
            Number of reflections
        delays : list, default=[60]
            List of delays in miliseconds
        decays : list, default=[0.4]
            List of decays, relative to gain in between 0 and 1

        See Also
        --------
        echos, reverb, chorus


def echos(self, gain_in=<NUM_LIT>, gain_out=<NUM_LIT>, n_echos=<NUM_LIT:1>, delays=[<NUM_LIT>],<EOL>decays=[<NUM_LIT>]):

if not is_number(gain_in) or gain_in <= <NUM_LIT:0> or gain_in > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(gain_out) or gain_out <= <NUM_LIT:0> or gain_out > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(n_echos, int) or n_echos <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(delays, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(delays) != n_echos:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p <= <NUM_LIT:0>) for p in delays):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(decays, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(decays) != n_echos:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any((not is_number(p) or p <= <NUM_LIT:0> or p > <NUM_LIT:1>) for p in decays):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>', '<STR_LIT>'.format(gain_in), '<STR_LIT>'.format(gain_out)<EOL>]<EOL>for i in range(n_echos):<EOL><INDENT>effect_args.extend([<EOL>'<STR_LIT>'.format(delays[i]),<EOL>'<STR_LIT>'.format(decays[i])<EOL>])<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Add a sequence of echoes to the audio.

        Like the echo effect, echos stand for ‘ECHO in Sequel’, that is the
        first echos takes the input, the second the input and the first echos,
        the third the input and the first and the second echos, ... and so on.
        Care should be taken using many echos; a single echos has the same
        effect as a single echo.

        Parameters
        ----------
        gain_in : float, default=0.8
            Input volume, between 0 and 1
        gain_out : float, default=0.9
            Output volume, between 0 and 1
        n_echos : int, default=1
            Number of reflections
        delays : list, default=[60]
            List of delays in miliseconds
        decays : list, default=[0.4]
            List of decays, relative to gain in between 0 and 1

        See Also
        --------
        echo, reverb, chorus


def equalizer(self, frequency, width_q, gain_db):

if not is_number(frequency) or frequency <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(width_q) or width_q <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(gain_db):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(frequency),<EOL>'<STR_LIT>'.format(width_q),<EOL>'<STR_LIT>'.format(gain_db)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a two-pole peaking equalisation (EQ) filter to boost or
        reduce around a given frequency.
        This effect can be applied multiple times to produce complex EQ curves.

        Parameters
        ----------
        frequency : float
            The filter's central frequency in Hz.
        width_q : float
            The filter's width as a Q-factor.
        gain_db : float
            The filter's gain in dB.

        See Also
        --------
        bass, treble


def fade(self, fade_in_len=<NUM_LIT:0.0>, fade_out_len=<NUM_LIT:0.0>, fade_shape='<STR_LIT:q>'):

fade_shapes = ['<STR_LIT:q>', '<STR_LIT:h>', '<STR_LIT:t>', '<STR_LIT:l>', '<STR_LIT:p>']<EOL>if fade_shape not in fade_shapes:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format("<STR_LIT:U+0020>".join(fade_shapes))<EOL>)<EOL><DEDENT>if not is_number(fade_in_len) or fade_in_len < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(fade_out_len) or fade_out_len < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = []<EOL>if fade_in_len > <NUM_LIT:0>:<EOL><INDENT>effect_args.extend([<EOL>'<STR_LIT>', '<STR_LIT:{}>'.format(fade_shape), '<STR_LIT>'.format(fade_in_len)<EOL>])<EOL><DEDENT>if fade_out_len > <NUM_LIT:0>:<EOL><INDENT>effect_args.extend([<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT:{}>'.format(fade_shape),<EOL>'<STR_LIT>'.format(fade_out_len), '<STR_LIT>'<EOL>])<EOL><DEDENT>if len(effect_args) > <NUM_LIT:0>:<EOL><INDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL><DEDENT>return self<EOL>

Add a fade in and/or fade out to an audio file.
        Default fade shape is 1/4 sine wave.

        Parameters
        ----------
        fade_in_len : float, default=0.0
            Length of fade-in (seconds). If fade_in_len = 0,
            no fade in is applied.
        fade_out_len : float, defaut=0.0
            Length of fade-out (seconds). If fade_out_len = 0,
            no fade in is applied.
        fade_shape : str, default='q'
            Shape of fade. Must be one of
             * 'q' for quarter sine (default),
             * 'h' for half sine,
             * 't' for linear,
             * 'l' for logarithmic
             * 'p' for inverted parabola.

        See Also
        --------
        splice


if not isinstance(coefficients, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not all([is_number(c) for c in coefficients]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>effect_args.extend(['<STR_LIT>'.format(c) for c in coefficients])<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Use SoX’s FFT convolution engine with given FIR filter coefficients.

        Parameters
        ----------
        coefficients : list
            fir filter coefficients


def flanger(self, delay=<NUM_LIT:0>, depth=<NUM_LIT:2>, regen=<NUM_LIT:0>, width=<NUM_LIT>, speed=<NUM_LIT:0.5>,<EOL>shape='<STR_LIT>', phase=<NUM_LIT>, interp='<STR_LIT>'):

if not is_number(delay) or delay < <NUM_LIT:0> or delay > <NUM_LIT:30>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(depth) or depth < <NUM_LIT:0> or depth > <NUM_LIT:10>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(regen) or regen < -<NUM_LIT> or regen > <NUM_LIT>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(width) or width < <NUM_LIT:0> or width > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(speed) or speed < <NUM_LIT:0.1> or speed > <NUM_LIT:10>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if shape not in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(phase) or phase < <NUM_LIT:0> or phase > <NUM_LIT:100>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if interp not in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(delay),<EOL>'<STR_LIT>'.format(depth),<EOL>'<STR_LIT>'.format(regen),<EOL>'<STR_LIT>'.format(width),<EOL>'<STR_LIT>'.format(speed),<EOL>'<STR_LIT:{}>'.format(shape),<EOL>'<STR_LIT>'.format(phase),<EOL>'<STR_LIT:{}>'.format(interp)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a flanging effect to the audio.

        Parameters
        ----------
        delay : float, default=0
            Base delay (in miliseconds) between 0 and 30.
        depth : float, default=2
            Added swept delay (in miliseconds) between 0 and 10.
        regen : float, default=0
            Percentage regeneration between -95 and 95.
        width : float, default=71,
            Percentage of delayed signal mixed with original between 0 and 100.
        speed : float, default=0.5
            Sweeps per second (in Hz) between 0.1 and 10.
        shape : 'sine' or 'triangle', default='sine'
            Swept wave shape
        phase : float, default=25
            Swept wave percentage phase-shift for multi-channel flange between
            0 and 100. 0 = 100 = same phase on each channel
        interp : 'linear' or 'quadratic', default='linear'
            Digital delay-line interpolation type.

        See Also
        --------
        tremolo


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


def highpass(self, frequency, width_q=<NUM_LIT>, n_poles=<NUM_LIT:2>):

if not is_number(frequency) or frequency <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(width_q) or width_q <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if n_poles not in [<NUM_LIT:1>, <NUM_LIT:2>]:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>', '<STR_LIT>'.format(n_poles), '<STR_LIT>'.format(frequency)<EOL>]<EOL>if n_poles == <NUM_LIT:2>:<EOL><INDENT>effect_args.append('<STR_LIT>'.format(width_q))<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a high-pass filter with 3dB point frequency. The filter can be
        either single-pole or double-pole. The filters roll off at 6dB per pole
        per octave (20dB per pole per decade).

        Parameters
        ----------
        frequency : float
            The filter's cutoff frequency in Hz.
        width_q : float, default=0.707
            The filter's width as a Q-factor. Applies only when n_poles=2.
            The default gives a Butterworth response.
        n_poles : int, default=2
            The number of poles in the filter. Must be either 1 or 2

        See Also
        --------
        lowpass, equalizer, sinc, allpass


def lowpass(self, frequency, width_q=<NUM_LIT>, n_poles=<NUM_LIT:2>):

Apply a low-pass filter with 3dB point frequency. The filter can be
        either single-pole or double-pole. The filters roll off at 6dB per pole
        per octave (20dB per pole per decade).

        Parameters
        ----------
        frequency : float
            The filter's cutoff frequency in Hz.
        width_q : float, default=0.707
            The filter's width as a Q-factor. Applies only when n_poles=2.
            The default gives a Butterworth response.
        n_poles : int, default=2
            The number of poles in the filter. Must be either 1 or 2

        See Also
        --------
        highpass, equalizer, sinc, allpass


if num_taps is not None and not isinstance(num_taps, int):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if num_taps is not None and num_taps % <NUM_LIT:2> == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>if num_taps is not None:<EOL><INDENT>effect_args.extend(['<STR_LIT>', '<STR_LIT:{}>'.format(num_taps)])<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply an odd-tap Hilbert transform filter, phase-shifting the signal
        by 90 degrees. This is used in many matrix coding schemes and for
        analytic signal generation. The process is often written as a
        multiplication by i (or j), the imaginary unit. An odd-tap Hilbert
        transform filter has a bandpass characteristic, attenuating the lowest
        and highest frequencies.

        Parameters
        ----------
        num_taps : int or None, default=None
            Number of filter taps - must be odd. If none, it is chosen to have
            a cutoff frequency of about 75 Hz.


def loudness(self, gain_db=-<NUM_LIT>, reference_level=<NUM_LIT>):

if not is_number(gain_db):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not is_number(reference_level):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if reference_level > <NUM_LIT> or reference_level < <NUM_LIT:50>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(gain_db),<EOL>'<STR_LIT>'.format(reference_level)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Loudness control. Similar to the gain effect, but provides
        equalisation for the human auditory system.

        The gain is adjusted by gain_db and the signal is equalised according
        to ISO 226 w.r.t. reference_level.

        Parameters
        ----------
        gain_db : float, default=-10.0
            Loudness adjustment amount (in dB)
        reference_level : float, default=65.0
            Reference level (in dB) according to which the signal is equalized.
            Must be between 50 and 75 (dB)

        See Also
        --------
        gain


def mcompand(self, n_bands=<NUM_LIT:2>, crossover_frequencies=[<NUM_LIT>],<EOL>attack_time=[<NUM_LIT>, <NUM_LIT>], decay_time=[<NUM_LIT:0.1>, <NUM_LIT>],<EOL>soft_knee_db=[<NUM_LIT>, None],<EOL>tf_points=[[(-<NUM_LIT>, -<NUM_LIT>), (-<NUM_LIT>, -<NUM_LIT>), (-<NUM_LIT>, -<NUM_LIT>), (<NUM_LIT:0>, <NUM_LIT:0>)],<EOL>[(-<NUM_LIT>, -<NUM_LIT>), (-<NUM_LIT>, -<NUM_LIT>), (-<NUM_LIT:15>, -<NUM_LIT>), (<NUM_LIT:0>, <NUM_LIT:0>)]],<EOL>gain=[None, None]):

if not isinstance(n_bands, int) or n_bands < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (not isinstance(crossover_frequencies, list) or<EOL>len(crossover_frequencies) != n_bands - <NUM_LIT:1>):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if any([not is_number(f) or f < <NUM_LIT:0> for f in crossover_frequencies]):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not isinstance(attack_time, list) or len(attack_time) != n_bands:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([not is_number(a) or a <= <NUM_LIT:0> for a in attack_time]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(decay_time, list) or len(decay_time) != n_bands:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([not is_number(d) or d <= <NUM_LIT:0> for d in decay_time]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([a > d for a, d in zip(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 isinstance(soft_knee_db, list) or len(soft_knee_db) != n_bands:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([(not is_number(d) and d is not None) for d in soft_knee_db]):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not isinstance(tf_points, list) or len(tf_points) != n_bands:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([not isinstance(t, list) or len(t) == <NUM_LIT:0> for t in tf_points]):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>for tfp in tf_points:<EOL><INDENT>if any(not isinstance(pair, tuple) for pair in tfp):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any(len(pair) != <NUM_LIT:2> for pair in tfp):<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 tfp):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if any((p[<NUM_LIT:0>] > <NUM_LIT:0> or p[<NUM_LIT:1>] > <NUM_LIT:0>) for p in tfp):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if len(tf_points) > len(set([p[<NUM_LIT:0>] for p in tfp])):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if not isinstance(gain, list) or len(gain) != n_bands:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if any([not (is_number(g) or g is None) for g in gain]):<EOL><INDENT>print(gain)<EOL>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>for i in range(n_bands):<EOL><INDENT>if i > <NUM_LIT:0>:<EOL><INDENT>effect_args.append('<STR_LIT>'.format(crossover_frequencies[i - <NUM_LIT:1>]))<EOL><DEDENT>intermed_args = ["<STR_LIT>".format(attack_time[i], decay_time[i])]<EOL>tf_points_band = tf_points[i]<EOL>tf_points_band = sorted(<EOL>tf_points_band,<EOL>key=lambda tf_points_band: tf_points_band[<NUM_LIT:0>]<EOL>)<EOL>transfer_list = []<EOL>for point in tf_points_band:<EOL><INDENT>transfer_list.extend([<EOL>"<STR_LIT>".format(point[<NUM_LIT:0>]), "<STR_LIT>".format(point[<NUM_LIT:1>])<EOL>])<EOL><DEDENT>if soft_knee_db[i] is not None:<EOL><INDENT>intermed_args.append(<EOL>"<STR_LIT>".format(soft_knee_db[i], "<STR_LIT:U+002C>".join(transfer_list))<EOL>)<EOL><DEDENT>else:<EOL><INDENT>intermed_args.append("<STR_LIT:U+002C>".join(transfer_list))<EOL><DEDENT>if gain[i] is not None:<EOL><INDENT>intermed_args.append("<STR_LIT>".format(gain[i]))<EOL><DEDENT>effect_args.append('<STR_LIT:U+0020>'.join(intermed_args))<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

The multi-band compander is similar to the single-band compander but
        the audio is first divided into bands using Linkwitz-Riley cross-over
        filters and a separately specifiable compander run on each band.

        When used with n_bands=1, this effect is identical to compand.
        When using n_bands > 1, the first set of arguments applies a single
        band compander, and each subsequent set of arugments is applied on
        each of the crossover frequencies.

        Parameters
        ----------
        n_bands : int, default=2
            The number of bands.
        crossover_frequencies : list of float, default=[1600]
            A list of crossover frequencies in Hz of length n_bands-1.
            The first band is always the full spectrum, followed by the bands
            specified by crossover_frequencies.
        attack_time : list of float, default=[0.005, 0.000625]
            A list of length n_bands, where each element is the time in seconds
            over which the instantaneous level of the input signal is averaged
            to determine increases in volume over the current band.
        decay_time : list of float, default=[0.1, 0.0125]
            A list of length n_bands, where each element is the time in seconds
            over which the instantaneous level of the input signal is averaged
            to determine decreases in volume over the current band.
        soft_knee_db : list of float or None, default=[6.0, None]
            A list of length n_bands, where each element is the ammount (in dB)
            for which the points at where adjacent line segments on the
            transfer function meet will be rounded over the current band.
            If None, no soft_knee is applied.
        tf_points : list of list of tuples, default=[
                [(-47, -40), (-34, -34), (-17, -33), (0, 0)],
                [(-47, -40), (-34, -34), (-15, -33), (0, 0)]]
            A list of length n_bands, where each element is the transfer
            function points as a list of tuples corresponding to points in
            (dB, dB) defining the compander's transfer function over the
            current band.
        gain : list of floats or None
            A list of gain values for each frequency band.
            If None, no gain is applied.

        See Also
        --------
        compand, contrast


def noiseprof(self, input_filepath, profile_path):

if os.path.isdir(profile_path):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(profile_path))<EOL><DEDENT>if os.path.dirname(profile_path) == '<STR_LIT>' and profile_path != '<STR_LIT>':<EOL><INDENT>_abs_profile_path = os.path.join(os.getcwd(), profile_path)<EOL><DEDENT>else:<EOL><INDENT>_abs_profile_path = profile_path<EOL><DEDENT>if not os.access(os.path.dirname(_abs_profile_path), os.W_OK):<EOL><INDENT>raise IOError(<EOL>"<STR_LIT>".format(_abs_profile_path))<EOL><DEDENT>effect_args = ['<STR_LIT>', profile_path]<EOL>self.build(input_filepath, None, extra_args=effect_args)<EOL>return None<EOL>

Calculate a profile of the audio for use in noise reduction.
        Running this command does not effect the Transformer effects
        chain. When this function is called, the calculated noise profile
        file is saved to the `profile_path`.

        Parameters
        ----------
        input_filepath : str
            Path to audiofile from which to compute a noise profile.
        profile_path : str
            Path to save the noise profile file.

        See Also
        --------
        noisered


def noisered(self, profile_path, amount=<NUM_LIT:0.5>):

if not os.path.exists(profile_path):<EOL><INDENT>raise IOError(<EOL>"<STR_LIT>".format(profile_path))<EOL><DEDENT>if not is_number(amount) or amount < <NUM_LIT:0> or amount > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>profile_path,<EOL>'<STR_LIT>'.format(amount)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Reduce noise in the audio signal by profiling and filtering.
        This effect is moderately effective at removing consistent
        background noise such as hiss or hum.

        Parameters
        ----------
        profile_path : str
            Path to a noise profile file.
            This file can be generated using the `noiseprof` effect.
        amount : float, default=0.5
            How much noise should be removed is specified by amount. Should
            be between 0 and 1.  Higher numbers will remove more noise but
            present a greater likelihood  of  removing wanted  components  of
            the  audio  signal.

        See Also
        --------
        noiseprof


if not is_number(db_level):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(db_level)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Normalize an audio file to a particular db level.
        This behaves identically to the gain effect with normalize=True.

        Parameters
        ----------
        db_level : float, default=-3.0
            Output volume (db)

        See Also
        --------
        gain, loudness


effect_args = ['<STR_LIT>']<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Out Of Phase Stereo effect. Mixes stereo to twin-mono where each
        mono channel contains the difference between the left and right stereo
        channels. This is sometimes known as the 'karaoke' effect as it often
        has the effect of removing most or all of the vocals from a recording.


def overdrive(self, gain_db=<NUM_LIT>, colour=<NUM_LIT>):

if not is_number(gain_db):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not is_number(colour):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(gain_db),<EOL>'<STR_LIT>'.format(colour)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply non-linear distortion.

        Parameters
        ----------
        gain_db : float, default=20
            Controls the amount of distortion (dB).
        colour : float, default=20
            Controls the amount of even harmonic content in the output (dB).


def pad(self, start_duration=<NUM_LIT:0.0>, end_duration=<NUM_LIT:0.0>):

if not is_number(start_duration) or start_duration < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(end_duration) or end_duration < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(start_duration),<EOL>'<STR_LIT>'.format(end_duration)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Add silence to the beginning or end of a file.
        Calling this with the default arguments has no effect.

        Parameters
        ----------
        start_duration : float
            Number of seconds of silence to add to beginning.
        end_duration : float
            Number of seconds of silence to add to end.

        See Also
        --------
        delay


def phaser(self, gain_in=<NUM_LIT>, gain_out=<NUM_LIT>, delay=<NUM_LIT:3>, decay=<NUM_LIT>, speed=<NUM_LIT:0.5>,<EOL>modulation_shape='<STR_LIT>'):

if not is_number(gain_in) or gain_in <= <NUM_LIT:0> or gain_in > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(gain_out) or gain_out <= <NUM_LIT:0> or gain_out > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(delay) or delay <= <NUM_LIT:0> or delay > <NUM_LIT:5>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(decay) or decay < <NUM_LIT:0.1> or decay > <NUM_LIT:0.5>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(speed) or speed < <NUM_LIT:0.1> or speed > <NUM_LIT:2>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if modulation_shape not in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(gain_in),<EOL>'<STR_LIT>'.format(gain_out),<EOL>'<STR_LIT>'.format(delay),<EOL>'<STR_LIT>'.format(decay),<EOL>'<STR_LIT>'.format(speed)<EOL>]<EOL>if modulation_shape == '<STR_LIT>':<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>elif modulation_shape == '<STR_LIT>':<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Apply a phasing effect to the audio.

        Parameters
        ----------
        gain_in : float, default=0.8
            Input volume between 0 and 1
        gain_out: float, default=0.74
            Output volume between 0 and 1
        delay : float, default=3
            Delay in miliseconds between 0 and 5
        decay : float, default=0.4
            Decay relative to gain_in, between 0.1 and 0.5.
        speed : float, default=0.5
            Modulation speed in Hz, between 0.1 and 2
        modulation_shape : str, defaul='sinusoidal'
            Modulation shpae. One of 'sinusoidal' or 'triangular'

        See Also
        --------
        flanger, tremolo


def pitch(self, n_semitones, quick=False):

if not is_number(n_semitones):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if n_semitones < -<NUM_LIT:12> or n_semitones > <NUM_LIT:12>:<EOL><INDENT>logger.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not isinstance(quick, bool):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>if quick:<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>effect_args.append('<STR_LIT>'.format(n_semitones * <NUM_LIT>))<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Pitch shift the audio without changing the tempo.

        This effect uses the WSOLA algorithm. The audio is chopped up into
        segments which are then shifted in the time domain and overlapped
        (cross-faded) at points where their waveforms are most similar as
        determined by measurement of least squares.

        Parameters
        ----------
        n_semitones : float
            The number of semitones to shift. Can be positive or negative.
        quick : bool, default=False
            If True, this effect will run faster but with lower sound quality.

        See Also
        --------
        bend, speed, tempo


def rate(self, samplerate, quality='<STR_LIT:h>'):

quality_vals = ['<STR_LIT:q>', '<STR_LIT:l>', '<STR_LIT:m>', '<STR_LIT:h>', '<STR_LIT:v>']<EOL>if not is_number(samplerate) or samplerate <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if quality not in quality_vals:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format('<STR_LIT:U+0020>'.join(quality_vals))<EOL>)<EOL><DEDENT>effect_args = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(quality),<EOL>'<STR_LIT>'.format(samplerate)<EOL>]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Change the audio sampling rate (i.e. resample the audio) to any
        given `samplerate`. Better the resampling quality = slower runtime.

        Parameters
        ----------
        samplerate : float
            Desired sample rate.
        quality : str
            Resampling quality. One of:
             * q : Quick - very low quality,
             * l : Low,
             * m : Medium,
             * h : High (default),
             * v : Very high

        See Also
        --------
        upsample, downsample, convert


def remix(self, remix_dictionary=None, num_output_channels=None):

if not (isinstance(remix_dictionary, dict) or<EOL>remix_dictionary is None):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if remix_dictionary is not None:<EOL><INDENT>if not all([isinstance(i, int) and i > <NUM_LIT:0> for i<EOL>in remix_dictionary.keys()]):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not all([isinstance(v, list) for v<EOL>in remix_dictionary.values()]):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>for v_list in remix_dictionary.values():<EOL><INDENT>if not all([isinstance(v, int) and v > <NUM_LIT:0> for v in v_list]):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT><DEDENT>if not ((isinstance(num_output_channels, int) and<EOL>num_output_channels > <NUM_LIT:0>) or num_output_channels is None):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>if remix_dictionary is None:<EOL><INDENT>effect_args.append('<STR_LIT:->')<EOL><DEDENT>else:<EOL><INDENT>if num_output_channels is None:<EOL><INDENT>num_output_channels = max(remix_dictionary.keys())<EOL><DEDENT>for channel in range(<NUM_LIT:1>, num_output_channels + <NUM_LIT:1>):<EOL><INDENT>if channel in remix_dictionary.keys():<EOL><INDENT>out_channel = '<STR_LIT:U+002C>'.join(<EOL>[str(i) for i in remix_dictionary[channel]]<EOL>)<EOL><DEDENT>else:<EOL><INDENT>out_channel = '<STR_LIT:0>'<EOL><DEDENT>effect_args.append(out_channel)<EOL><DEDENT><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Remix the channels of an audio file.

        Note: volume options are not yet implemented

        Parameters
        ----------
        remix_dictionary : dict or None
            Dictionary mapping output channel to list of input channel(s).
            Empty lists indicate the corresponding output channel should be
            empty. If None, mixes all channels down to a single mono file.
        num_output_channels : int or None
            The number of channels in the output file. If None, the number of
            output channels is equal to the largest key in remix_dictionary.
            If remix_dictionary is None, this variable is ignored.

        Examples
        --------
        Remix a 4-channel input file. The output file will have
        input channel 2 in channel 1, a mixdown of input channels 1 an 3 in
        channel 2, an empty channel 3, and a copy of input channel 4 in
        channel 4.

        >>> import sox
        >>> tfm = sox.Transformer()
        >>> remix_dictionary = {1: [2], 2: [1, 3], 4: [4]}
        >>> tfm.remix(remix_dictionary)


if not isinstance(count, int) or count < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>', '<STR_LIT:{}>'.format(count)]<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>

Repeat the entire audio count times.

        Parameters
        ----------
        count : int, default=1
            The number of times to repeat the audio.


def reverb(self, reverberance=<NUM_LIT:50>, high_freq_damping=<NUM_LIT:50>, room_scale=<NUM_LIT:100>,<EOL>stereo_depth=<NUM_LIT:100>, pre_delay=<NUM_LIT:0>, wet_gain=<NUM_LIT:0>, wet_only=False):

if (not is_number(reverberance) or reverberance < <NUM_LIT:0> or<EOL>reverberance > <NUM_LIT:100>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (not is_number(high_freq_damping) or high_freq_damping < <NUM_LIT:0> or<EOL>high_freq_damping > <NUM_LIT:100>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (not is_number(room_scale) or room_scale < <NUM_LIT:0> or<EOL>room_scale > <NUM_LIT:100>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (not is_number(stereo_depth) or stereo_depth < <NUM_LIT:0> or<EOL>stereo_depth > <NUM_LIT:100>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(pre_delay) or pre_delay < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(wet_gain):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(wet_only, bool):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = ['<STR_LIT>']<EOL>if wet_only:<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>effect_args.extend([<EOL>'<STR_LIT>'.format(reverberance),<EOL>'<STR_LIT>'.format(high_freq_damping),<EOL>'<STR_LIT>'.format(room_scale),<EOL>'<STR_LIT>'.format(stereo_depth),<EOL>'<STR_LIT>'.format(pre_delay),<EOL>'<STR_LIT>'.format(wet_gain)<EOL>])<EOL>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Add reverberation to the audio using the ‘freeverb’ algorithm.
        A reverberation effect is sometimes desirable for concert halls that
        are too small or contain so many people that the hall’s natural
        reverberance is diminished. Applying a small amount of stereo reverb
        to a (dry) mono signal will usually make it sound more natural.

        Parameters
        ----------
        reverberance : float, default=50
            Percentage of reverberance
        high_freq_damping : float, default=50
            Percentage of high-frequency damping.
        room_scale : float, default=100
            Scale of the room as a percentage.
        stereo_depth : float, default=100
            Stereo depth as a percentage.
        pre_delay : float, default=0
            Pre-delay in milliseconds.
        wet_gain : float, default=0
            Amount of wet gain in dB
        wet_only : bool, default=False
            If True, only outputs the wet signal.

        See Also
        --------
        echo


def silence(self, location=<NUM_LIT:0>, silence_threshold=<NUM_LIT:0.1>,<EOL>min_silence_duration=<NUM_LIT:0.1>, buffer_around_silence=False):

if location not in [-<NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:1>]:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not is_number(silence_threshold) or silence_threshold < <NUM_LIT:0>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>elif silence_threshold >= <NUM_LIT:100>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not is_number(min_silence_duration) or min_silence_duration <= <NUM_LIT:0>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not isinstance(buffer_around_silence, bool):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>effect_args = []<EOL>if location == -<NUM_LIT:1>:<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>if buffer_around_silence:<EOL><INDENT>effect_args.extend(['<STR_LIT>', '<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>effect_args.extend([<EOL>'<STR_LIT:1>',<EOL>'<STR_LIT>'.format(min_silence_duration),<EOL>'<STR_LIT>'.format(silence_threshold)<EOL>])<EOL>if location == <NUM_LIT:0>:<EOL><INDENT>effect_args.extend([<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'.format(min_silence_duration),<EOL>'<STR_LIT>'.format(silence_threshold)<EOL>])<EOL><DEDENT>if location == -<NUM_LIT:1>:<EOL><INDENT>effect_args.append('<STR_LIT>')<EOL><DEDENT>self.effects.extend(effect_args)<EOL>self.effects_log.append('<STR_LIT>')<EOL>return self<EOL>

Removes silent regions from an audio file.

        Parameters
        ----------
        location : int, default=0
            Where to remove silence. One of:
             * 0 to remove silence throughout the file (default),
             * 1 to remove silence from the beginning,
             * -1 to remove silence from the end,
        silence_threshold : float, default=0.1
            Silence threshold as percentage of maximum sample amplitude.
            Must be between 0 and 100.
        min_silence_duration : float, default=0.1
            The minimum ammount of time in seconds required for a region to be
            considered non-silent.
        buffer_around_silence : bool, default=False
            If True, leaves a buffer of min_silence_duration around removed
            silent regions.

        See Also
        --------
        vad