def compute_sample_slices(N, frame_size, step):
    """
    Computes tart and stop indices and padding.

    Returns a list of tuples:

        (center_idx, begin_idx, end_idx, pad_left, pad_right),

    """

    assert N > 0, 'N <= 0'
    assert frame_size > 0, 'frame_size <= 0'
    assert step > 0, 'step <= 0'

    #-------------------------------------------------------------------------
    # compute center indicies for each frame

    h_frame = frame_size // 2

    centers = []

    c_idx = 0

    while c_idx < N + h_frame:
        centers.append(c_idx)
        c_idx += step

    #-------------------------------------------------------------------------
    # sampl

    sample_slices = []

    for c_idx in centers:

        i0 = c_idx - h_frame
        i1 = c_idx + h_frame

        pad_l = 0
        pad_r = 0

        if i0 < 0:
            pad_l = abs(i0)
            i0 = 0

        if i1 >= N:
            pad_r = i1 - N + 1
            i1 = N - 1

        sample_slices.append( (c_idx, i0, i1, pad_l, pad_r) )

    return sample_slices