
Diamond is a MIDI arpeggiator in Ruby.
It features all of the classic functions of a MIDI arpeggiator plus the ability to live code, algorithmically generate and modify patterns, chain and sync instances and more
(Sounds starts around 55 seconds in)
Getting started
Ruby 1.9.2 or JRuby in 1.9 mode are required.
It installs with a typical gem installation...
gem install diamondHere is a very basic example to get started:
require "diamond"First, select a MIDI output using unimidi. (more...)
@output = UniMIDI::Output.getsThe Arpeggiator has a number of optional parameters (more...). For the sake of keeping this demo simple, here is a straightforward setup:
opts = {
:gate => 90,
:range => 4,
:interval => 7,
:midi => @output,
:pattern => Diamond::Pattern["UpDown"],
:rate => 8
}
(read more about what these options mean)Now create an Arpeggiator object, passing in a tempo value and the options chosen before. In this case the tempo will be 138 BPM
arp = Diamond::Arpeggiator.new(138, opts)Of course, an Arpeggiator needs notes to work with. As you might expect, it's easy to use a MIDI input for that (see example). However, again for the sake of simplicity here's a chord 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)
arp.add(chord)
arp.add("C5")
arp << "A4"
By default, the arpeggiator will run in a background thread so if you are working in IRB this will allow you to live code, sync it other arpeggiators, or just run another foreground process. (To start in the foreground, just pass :focus => true to Arpeggiator#start)arp.startAt that point, the arpeggiator starts playing. All of its options can be controlled on the on the fly.
arp.rate = 16
arp.gate = 20
arp.remove("C5", "A4")
Here are examples showing how to use some of Diamond's other features - Feeding notes to Diamond using a MIDI controller
- Feeding notes to Diamond using MIDI Message objects
- Live coding Diamond and syncing multiple arpeggiators to each other
- Syncing Diamond to external MIDI clock