def each_delta(index=0)
      return enum_for(__method__, index) unless block_given?

      delta = @delta

      if delta.is_a?(Array)
        size = delta.size
        return if size == 0

        start = index.floor
        i = start % size
        loop do
          yield delta[i]
          i = (i + 1) % size
          start += 1
        end
      elsif delta.is_a?(Pattern)
        delta.each_event(index) { |v, _| yield v }
      else
        loop { yield delta }
      end
    end
def each_delta(index=0)
      return enum_for(__method__, index) unless block_given?

      delta = @delta

      if delta.is_a?(Array)
        size = delta.size
        return if size == 0

        start = index.floor
        i = start % size
        loop do
          yield delta[i]
          i = (i + 1) % size
          start += 1
        end
      elsif delta.is_a?(Pattern)
        delta.each_event(index) { |v, _| yield v }
      else
        loop { yield delta }
      end
    end
Calls the given block passing the delta of each value in pattern

 This method is used internally by {#each_event} to calculate when each
 event in pattern occurs in time.  If no block is given, an Enumerator is
 returned instead.

 @param index [Numeric]
 @yield [d] duration
 @return [Enumerator]