def index_to_slice(idx, idx_min=None, idx_max=None, step=None, pad=True):

    # First, normalize the index set
    idx_fixed = fix_frames(idx, idx_min, idx_max, pad=pad)

    # Now convert the indices to slices
    return [slice(start, end, step) for (start, end) in zip(idx_fixed, idx_fixed[1:])]
Generate a slice array from an index array.
dataset/ETHPy150Open bmcfee/librosa/librosa/util/utils.py/index_to_slice