Method: Diamond::Arpeggiator#initialize

Defined in:
lib/diamond/arpeggiator.rb

#initialize(tempo_or_input, options = {}, &block) ⇒ Arpeggiator

a numeric tempo rate (BPM), or unimidi input is required by the constructor (tempo_or_input). in the case that you use a MIDI input, it will be used as a clock source

the constructor also accepts a number of options – these options are all editable after initialization by calling for example arpeggiator.gate = 4

  • rx_channel (or channel) - only respond to input messages to the given MIDI channel. will operate on all input sources. if not given, or nil the arpeggiator will work in omni mode and respond to all messages

  • gate - gate refers to how long the arpeggiated notes will be held out. the gate value is a percentage based on the rate. if the rate is 4, then a gate of 100 is equal to a quarter note. the default gate is 75. Gate must be positive and less than 500

  • interval - the arpeggiator increments the pattern over interval scale degrees range times. the default interval is 12, meaning one octave above the current note. interval may be any positive or negative number

  • midi - this can be a unimidi input or output. will accept a single device or an array

  • midi_clock_output - should this Arpeggiator output midi clock? defaults to false

  • tx_channel - send output messages to the given MIDI channel despite what channel the input notes were intended for.

  • pattern_offset - pattern_offset n means that the arpeggiator will begin on the nth note of the sequence (but not omit any notes). the default pattern_offset is 0.

  • pattern - A Pattern object that computes the contour of the arpeggiated melody

  • range - the arpeggiator increments the pattern over interval scale degrees range times. range must be 0 or greater. the default range is 3

  • rate - rate is how fast the arpeggios will be played. the default is 8, which is an eighth note. rate may be 0 (whole note) or greater but must be equal to or less than resolution

  • resolution - the resolution of the arpeggiator (numeric notation)



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/diamond/arpeggiator.rb', line 61

def initialize(tempo_or_input, options = {}, &block)
  devices = [(options[:midi] || [])].flatten
  resolution = options[:resolution] || 128
  rx_channel = options[:rx_channel] || options[:channel]
  tx_channel = options[:tx_channel]
  
  initialize_midi_input(get_inputs(devices), rx_channel, options[:midi_map])
  initialize_sequence(resolution, options)  

  super(tempo_or_input, options.merge({ :sequence => @sequence }))
  self.tx_channel = tx_channel unless tx_channel.nil?
  
  use_osc = !options[:osc_input_port].nil?
  osc_start(:input_port => options[:osc_input_port], :output => options[:osc_output], :map => options[:osc_map], :service_name => options[:name]) if use_osc
  
  edit(&block) unless block.nil?
end

Comments