• Stars
    star
    137
  • Rank 257,934 (Top 6 %)
  • Language
    Ruby
  • License
    Other
  • Created almost 13 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Ruby DSL for MIDI

MicroMIDI

A Ruby DSL for MIDI

micromidi

Features

  • Cross-platform compatible using MRI or JRuby.
  • Simplified MIDI and Sysex message output
  • MIDI Thru, processing and custom input events
  • Optional shorthand for live coding

Installation

gem install micromidi

or using Bundler, add this to your Gemfile

gem "micromidi"

If you're using Linux, the libasound and libasound-dev packages may be required

Usage

Here's a quick example that plays some arpeggios

require "midi"

# prompt the user to select an input and output

@input = UniMIDI::Input.gets
@output = UniMIDI::Output.gets

MIDI.using(@output) do

  5.times do |oct|
    octave oct
    %w{C E G B}.each { |n| play n, 0.5 }
  end

end

This next example filters outs notes if their octave is between 1 and 3. All other messages are sent thru.

Output is also printed to the console by passing $stdout as though it's a MIDI device

MIDI.using(@input, @output, $stdout) do

  thru_except :note { |msg| only(msg, :octave, (1..3)) }

  join

end

This is the same example redone using shorthand aliases

M(@input, @output) do

  te :n { |m| only(m, :oct, (1..3)) }

  j

end

Finally, here is an example that maps some MIDI Control Change messages to SysEx

MIDI.using(@input, @output) do

  *@the_map =
    [0x40, 0x7F, 0x00],
    [0x41, 0x7F, 0x00],
    [0x42, 0x7F, 0x00]

  node :roland, :model_id => 0x42, :device_id => 0x10

  receive :cc do |message|

    command @the_map[message.index - 1], message.value

  end

end

Here are a few posts explaining each of the concepts used here in greater detail:

Documentation

Author

License

Apache 2.0, See the file LICENSE

Copyright (c) 2011-2015 Ari Russo

More Repositories

1

unimidi

Realtime MIDI IO for Ruby
Ruby
255
star
2

d3-audio-spectrum

Spectrum analysis demo using D3 and HTML5 audio
JavaScript
106
star
3

diamond

MIDI arpeggiator in Ruby
Ruby
47
star
4

viddl

Ruby/Command line tool to download, cut, crop and resize video clips
Ruby
32
star
5

twigs

Alternate firmware for Mutable Instruments Branches synthesizer module
C++
29
star
6

midi-eye

Ruby MIDI input event listener
Ruby
24
star
7

web-repl

Javascript/Web REPL in Ruby
Ruby
22
star
8

nibbler

Ruby MIDI message parser
Ruby
21
star
9

audio-playback

Ruby/Command Line Audio File Player
Ruby
21
star
10

midi-message

Ruby MIDI message objects
Ruby
19
star
11

three-audio-spectrum

Spectrum Analysis using Three.js and the HTML5 Web Audio API
JavaScript
17
star
12

midi-winmm

Realtime MIDI IO with Ruby for Windows/Cygwin
Ruby
15
star
13

topaz

MIDI syncable tempo in Ruby
Ruby
15
star
14

alsa-rawmidi

Realtime MIDI IO with Ruby for Linux
Ruby
12
star
15

crontest

For testing cron jobs
Ruby
12
star
16

osc-access

Build OSC into Ruby objects
Ruby
8
star
17

micro-osc

A Ruby DSL for OSC
Ruby
8
star
18

mmplayer

Control MPlayer with MIDI
Ruby
6
star
19

midi-jruby

Realtime MIDI IO in JRuby
Ruby
5
star
20

pulse-analysis

Measure pulse timing accuracy in an audio file
Ruby
4
star
21

diamond-touchosc

Use TouchOSC to control the Diamond arpeggiator
Ruby
3
star
22

grandpa

ruby-gosu + mvc
Ruby
3
star
23

patch

Universal controller message hub
JavaScript
3
star
24

sequencer

Perform a sequence of events at tempo
Ruby
2
star
25

midi-instrument

Core MIDI instrument functionality
Ruby
2
star
26

midi-fx

Realtime MIDI effects
Ruby
1
star
27

analog

A Ruby helper for scaling numbers
Ruby
1
star
28

studio_config

my music studio config files
Ruby
1
star
29

liveset

Performance code/notes
Ruby
1
star
30

arirusso.com

HTML
1
star