MIDI arpeggiator in Ruby
Ruby
Latest commit 38e27ab Oct 11, 2016 @arirusso committed on GitHub Update README.md
Permalink
Failed to load latest commit information.
examples whitespace Apr 11, 2015
lib bump gem version Apr 12, 2015
test fix the stubs Jan 3, 2015
Gemfile bump versions for bug fixes Apr 12, 2015
LICENSE dates Apr 11, 2015
README.md Update README.md Oct 12, 2016
Rakefile easier to index test names Sep 16, 2014

README.md

Diamond

MIDI arpeggiator in Ruby

diamond

Features

  • Classic arpeggiator functionality and patterns
  • OSC and MIDI remote control
  • MIDI clock IO
  • Multiplex clocks and arpeggiators
  • Suited to live coding
  • Generative arpeggio patterns

Installation

gem install diamond

or with Bundler, add this to your Gemfile

gem "diamond"

Usage

require "diamond"

First, select a MIDI output using unimidi. (more about that here)

@output = UniMIDI::Output.gets

The Diamond arpeggiator has a number of optional parameters. For this example, here's a straightforward setup

options = {
  :gate => 90,
  :interval => 7,
  :midi => @output,
  :pattern => "UpDown",
  :range => 4,
  :rate => 8
}

arpeggiator = Diamond::Arpeggiator.new(options)

Create a clock object, passing in a tempo value. In this case the tempo will be 138 BPM

clock = Diamond::Clock.new(138)

Point the clock to the arpeggiator

clock << arpeggiator

The arpeggiator will play based on inputted notes or chords; a MIDI input can be used for that. (see example). It's also possible to enter notes in Ruby:

chord = ["C3", "G3", "Bb3", "A4"]

Use Arpeggiator#add and Arpeggiator#remove to change the notes that the arpeggiator sees. (Arpeggiator#<< is the same as add)

arpeggiator.add(chord)
arpeggiator << "C5"

Starting the clock will also start the arpeggiator:

clock.start

Note that by default, the clock will run in a background thread. If you're working in a PRY/IRB/etc this will allow you to continue to code while the arpeggiator runs. To start in the foreground, pass :focus => true to Clock#start.

All of the arpeggiator options can be controlled while the arpeggiator is running.

arpeggiator.rate = 16
arpeggiator.gate = 20  
arpeggiator.remove("C5", "A4")

This screencast video shows Diamond being live coded in this way. (Note that the API has changed a bit since 2011 when the video was made).

This blog post explains what is happening in the video.

Posts

Examples

More...

Other Documentation

Author

License

Apache 2.0, See the file LICENSE

Copyright (c) 2011-2015 Ari Russo