def resample(input_data, ratio, converter_type='<STR_LIT>', verbose=False):
from samplerate.lowlevel import src_simple<EOL>from samplerate.exceptions import ResamplingError<EOL>input_data = np.require(input_data, requirements='<STR_LIT:C>', dtype=np.float32)<EOL>if input_data.ndim == <NUM_LIT:2>:<EOL><INDENT>num_frames, channels = input_data.shape<EOL>output_shape = (int(num_frames * ratio), channels)<EOL><DEDENT>elif input_data.ndim == <NUM_LIT:1>:<EOL><INDENT>num_frames, channels = input_data.size, <NUM_LIT:1><EOL>output_shape = (int(num_frames * ratio), )<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>output_data = np.empty(output_shape, dtype=np.float32)<EOL>converter_type = _get_converter_type(converter_type)<EOL>(error, input_frames_used, output_frames_gen)= src_simple(input_data, output_data, ratio,<EOL>converter_type.value, channels)<EOL>if error != <NUM_LIT:0>:<EOL><INDENT>raise ResamplingError(error)<EOL><DEDENT>if verbose:<EOL><INDENT>info = ('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>.format(input_frames_used, output_frames_gen))<EOL>print(info)<EOL><DEDENT>return (output_data[:output_frames_gen, :]<EOL>if channels > <NUM_LIT:1> else output_data[:output_frames_gen])<EOL>
Resample the signal in `input_data` at once.

    Parameters
    ----------
    input_data : ndarray
        Input data. A single channel is provided as a 1D array of `num_frames` length.
        Input data with several channels is represented as a 2D array of shape
        (`num_frames`, `num_channels`). For use with `libsamplerate`, `input_data`
        is converted to 32-bit float and C (row-major) memory order.
    ratio : float
        Conversion ratio = output sample rate / input sample rate.
    converter_type : ConverterType, str, or int
        Sample rate converter.
    verbose : bool
        If `True`, print additional information about the conversion.

    Returns
    -------
    output_data : ndarray
        Resampled input data.

    Note
    ----
    If samples are to be processed in chunks, `Resampler` and
    `CallbackResampler` will provide better results and allow for variable
    conversion ratios.