@decorators.deprecated('0.4', '0.5')
def buf_to_int(x, n_bytes=2):  # pragma: no cover

    if n_bytes not in [1, 2, 4]:
        raise ParameterError('n_bytes must be one of {1, 2, 4}')

    # What is the scale of the input data?
    scale = float(1 << ((8 * n_bytes) - 1))

    # Construct a format string
    fmt = '<i{:d}'.format(n_bytes)

    # Rescale and cast the data
    return (x * scale).astype(fmt)
Convert a floating point buffer into integer values.
dataset/ETHPy150Open bmcfee/librosa/librosa/util/utils.py/buf_to_int