def buf_to_float(x, n_bytes=<NUM_LIT:2>, dtype=np.float32):
<EOL>scale = <NUM_LIT:1.>/float(<NUM_LIT:1> << ((<NUM_LIT:8> * n_bytes) - <NUM_LIT:1>))<EOL>fmt = '<STR_LIT>'.format(n_bytes)<EOL>return scale * np.frombuffer(x, fmt).astype(dtype)<EOL>
Convert an integer buffer to floating point values.
    This is primarily useful when loading integer-valued wav data
    into numpy arrays.

    See Also
    --------
    buf_to_float

    Parameters
    ----------
    x : np.ndarray [dtype=int]
        The integer-valued data buffer

    n_bytes : int [1, 2, 4]
        The number of bytes per sample in `x`

    dtype : numeric type
        The target output type (default: 32-bit float)

    Returns
    -------
    x_float : np.ndarray [dtype=float]
        The input data buffer cast to floating point