def split_glides(n_samples, dur, fs_a, GL, min_dur=None):
    """Get start/stop indices of each `dur` length sub-glide for glides in GL

    Args
    ----
    dur: int
        Desired duration of glides
    GL: ndarray, (n, 2)
        Matrix containing the start time (first column) and end time
        (2nd column) of any glides.Times are in seconds.
    min_dur: int, default (bool False)
        Minimum number of seconds for sub-glide. Default value is `False`, which
        makes `min_dur` equal to `dur`, ignoring sub-glides smaller than `dur`.

    Attributes
    ----------
    gl_ind_diff: ndarray, (n,3)
        GL, with additional column of difference between the first two columns

    Returns
    -------
    SGL: ndarray, (n, 2)
        Matrix containing the start time (first column) and end time (2nd
        column) of the generated sub-glides. All glides must have duration equal
        to the given dur value.Times are in seconds.
    """
    import numpy
    ndur = dur * fs_a
    if not min_dur:
        min_ndur = dur * fs_a
    else:
        min_ndur = min_dur * fs_a
    gl_ind_diff = numpy.vstack((GL.T, GL[:, (1)] - GL[:, (0)])).T
    SGL_started = False
    for i in range(len(GL)):
        gl_ndur = gl_ind_diff[i, 2]
        if abs(gl_ndur) > ndur:
            n_sgl = int(gl_ndur // ndur)
            sgl_ndur = numpy.ones(n_sgl) * ndur
            sgl_start = numpy.arange(n_sgl) * (ndur + 1)
            if gl_ndur % ndur > min_ndur:
                last_ndur = numpy.floor(gl_ndur % ndur)
                sgl_ndur = numpy.hstack([sgl_ndur, last_ndur])
                last_start = len(sgl_start) * ndur + ndur
                sgl_start = numpy.hstack([sgl_start, last_start])
            for k in range(len(sgl_start)):
                next_start_ind = (gl_ind_diff[i, 0] + sgl_start[k]).astype(int)
                next_end_ind = (next_start_ind + sgl_ndur[k]).astype(int)
                if SGL_started is False:
                    sgl_start_ind = next_start_ind
                    sgl_end_ind = next_end_ind
                    SGL_started = True
                else:
                    sgl_start_ind = numpy.hstack((sgl_start_ind,
                        next_start_ind))
                    sgl_end_ind = numpy.hstack((sgl_end_ind, next_end_ind))
    SGL = numpy.vstack((sgl_start_ind, sgl_end_ind)).T
    SGL = SGL[(SGL[:, (0)] >= 0) & (SGL[:, (1)] < n_samples)]
    sgl_ndur = SGL[:, (1)] - SGL[:, (0)]
    if min_dur:
        assert numpy.all((sgl_ndur <= ndur) & (sgl_ndur >= min_ndur))
    else:
        assert numpy.all(sgl_ndur == ndur)
    data_sgl_mask = numpy.zeros(n_samples, dtype=bool)
    for start, stop in SGL.astype(int):
        data_sgl_mask[start:stop] = True
    return SGL, data_sgl_mask
