Gem Version Circle CI

MIDI Operations. Heavily inspired by this blog entry and hitode909/sketch-midi.


MIDIOps is available on Rubygems.

Add this line to your application's Gemfile:

gem 'midiops'

And then execute:

$ bundle

Or install it yourself as:

$ gem install midiops


This is a super simple example:

require 'midiops'

observer = MIDIOps::Observer.new

# args: midi ch, note in string
observer.on_key 0, 'C5' do
  puts "Ch.0.C5 pressed!"

observer.on_key 0, 'D5' do |vel|
  puts "Ch.0.C5 pressed with velocity #{vel}!"


Connect some MIDI keyboard and execute the script, then press key C5 or D5 on your midi device. Hooray!

See /examples for more materials.

Notes are like 'C3', 'B-1', 'C#4' (sharp) or 'Db5' (flat)


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.


Bug reports and pull requests are welcome on GitHub at https://github.com/polamjag/midiops. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.