Code Monkey home page Code Monkey logo

diamond's Introduction

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

diamond's People

Contributors

arirusso avatar juliancheal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.