class Diamond::Pattern

Pattern that the sequence is derived from given the parameters and input

Attributes

name[R]

Public Class Methods

new(name, &block) click to toggle source

@param [String, Symbol] name A name to identify the pattern by eg “up/down” @param [Proc] block The pattern procedure, which should return an array of scale degree numbers.

For example, given the arguments (3, 7) the "Up" pattern will produce [0, 7, 14, 21]
# File lib/diamond/pattern.rb, line 55
def initialize(name, &block)
  @name = name
  @proc = block
end

Public Instance Methods

compute(range, interval) click to toggle source

Compute scale degrees using the pattern with the given range and interval @param [Fixnum] range @param [Interval] interval @return [Array<Fixnum>]

# File lib/diamond/pattern.rb, line 64
def compute(range, interval)
  @proc.call(range, interval)
end