Class: Diamond::Arpeggiator

Inherits:
Object
  • Object
show all
Includes:
Diamond::API::MIDI, Diamond::API::Sequence, Diamond::API::SequenceParameters
Defined in:
lib/diamond/arpeggiator.rb

Overview

The arpeggiator core

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Diamond::API::SequenceParameters

included

Methods included from Diamond::API::Sequence

included

Methods included from Diamond::API::MIDI

#add_midi_source, included, #midi_sources, #mute?, #remove_midi_source

Constructor Details

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

Returns a new instance of Arpeggiator.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :gate (Fixnum)

    Duration of the arpeggiated notes. The value is a percentage based on the rate. If the rate is 4, then a gate of 100 is equal to a quarter note. (default: 75) must be 1..500

  • :interval (Fixnum)

    Increment (pattern) over (interval) scale degrees (range) times. May be positive or negative. (default: 12)

  • :midi (Array<UniMIDI::Input, UniMIDI::Output>, UniMIDI::Input, UniMIDI::Output)

    MIDI devices to use

  • :midi_control (Array<Hash>)

    A user-defined mapping of MIDI cc to arpeggiator params

  • :midi_debug (Boolean)

    Whether to send debug output about MIDI to standard out

  • :rx_channel (Fixnum) — default: or :channel

    Only respond to input messages to the given MIDI channel. will operate on all input sources. if not included, or nil the arpeggiator will work in omni mode and respond to all messages

  • :tx_channel (Fixnum)

    Send output messages to the given MIDI channel despite what channel the input notes were intended for.

  • :pattern_offset (Fixnum)

    Begin on the nth note of the sequence (but not omit any notes). (default: 0)

  • :pattern (String, Pattern)

    Computes the contour of the arpeggiated melody. Can be the name of a pattern or a pattern object.

  • :range (Fixnum)

    Increment the (pattern) over (interval) scale degrees (range) times. Must be positive (abs will be used). (default: 3)

  • :rate (Fixnum)

    How fast the arpeggios will be played. Must be positive (abs will be used). (default: 8, eighth note.) must be 0..resolution

  • :resolution (Fixnum)

    Numeric resolution for rhythm (default: 128)

  • :osc_control (Hash)

    A user-defined map of OSC addresses and properties to arpeggiator params

  • :osc_port (Fixnum)

    The port to listen for OSC on

  • :osc_debug (Boolean)

    Whether to send debug output about OSC to standard out



28
29
30
31
32
33
34
35
36
37
# File 'lib/diamond/arpeggiator.rb', line 28

def initialize(options = {}, &block)
  resolution = options.fetch(:resolution, 128)

  @sequence = Sequence.new
  @parameter = SequenceParameters.new(@sequence, resolution, options) { @sequence.mark_changed }
  @sequencer = Sequencer.new

  initialize_midi(options)
  initialize_osc(options)
end

Instance Attribute Details

#parameterObject (readonly)

Returns the value of attribute parameter.



10
11
12
# File 'lib/diamond/arpeggiator.rb', line 10

def parameter
  @parameter
end

#sequenceObject (readonly)

Returns the value of attribute sequence.



10
11
12
# File 'lib/diamond/arpeggiator.rb', line 10

def sequence
  @sequence
end

#sequencerObject (readonly)

Returns the value of attribute sequencer.



10
11
12
# File 'lib/diamond/arpeggiator.rb', line 10

def sequencer
  @sequencer
end