def integer_based_slice(self, ts):
        """
        Transform a :class:`TimeSlice` into integer indices that numpy can work
        with

        Args:
            ts (slice, TimeSlice): the time slice to translate into integer
                indices
        """

        if isinstance(ts, slice):
            try:
                start = Seconds(0) if ts.start is None else ts.start
                if start < Seconds(0):
                    start = self.end + start
                stop = self.end if ts.stop is None else ts.stop
                if stop < Seconds(0):
                    stop = self.end + stop
                duration = stop - start
                ts = TimeSlice(start=start, duration=duration)
            except (ValueError, TypeError):
                pass

        if not isinstance(ts, TimeSlice):
            return ts

        diff = self.duration - self.frequency
        start_index = \
            max(0, np.floor((ts.start - diff) / self.frequency))
        end = self.end if ts.duration is None else ts.end


        # KLUDGE: This is basically arbitrary, but the motivation is that we'd
        # like to differentiate between cases where the slice
        # actually/intentionally overlaps a particular sample, and cases where
        # the slice overlaps the sample by a tiny amount, due to rounding or
        # lack of precision (e.g. Seconds(1) / SR44100().frequency).
        ratio = np.round(end / self.frequency, 2)


        stop_index = np.ceil(ratio)
        return slice(int(start_index), int(stop_index))