{"id":21570389,"url":"https://github.com/arirusso/midi-eye","last_synced_at":"2025-04-10T14:12:52.530Z","repository":{"id":1493034,"uuid":"1743910","full_name":"arirusso/midi-eye","owner":"arirusso","description":"Ruby MIDI input event listener","archived":false,"fork":false,"pushed_at":"2022-08-17T22:19:02.000Z","size":88,"stargazers_count":25,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T12:56:20.949Z","etag":null,"topics":["event-listener","hardware","listener","midi","midi-controller","midi-device","midi-eye","midi-messages","music","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arirusso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-05-13T15:20:50.000Z","updated_at":"2024-12-03T18:42:07.000Z","dependencies_parsed_at":"2022-08-10T03:41:17.885Z","dependency_job_id":null,"html_url":"https://github.com/arirusso/midi-eye","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Fmidi-eye","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Fmidi-eye/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Fmidi-eye/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Fmidi-eye/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arirusso","download_url":"https://codeload.github.com/arirusso/midi-eye/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247968240,"owners_count":21025798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["event-listener","hardware","listener","midi","midi-controller","midi-device","midi-eye","midi-messages","music","ruby"],"created_at":"2024-11-24T11:12:30.731Z","updated_at":"2025-04-10T14:12:52.513Z","avatar_url":"https://github.com/arirusso.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MIDI EYE\n\nMIDI input event listener for Ruby\n\n## Install\n\n`gem install midi-eye`\n\nor using Bundler, add this to your Gemfile\n\n`gem \"midi-eye\"`\n\n## Usage\n\n```ruby\nrequire 'midi-eye'\n```\n\nThe following is an example that takes any note messages received from a unimidi input, transposes them up one octave and then sends them to an output  \n\nFirst, pick some MIDI IO ports\n\n```ruby\n@input = UniMIDI::Input.gets\n@output = UniMIDI::Output.gets\n```\n\nThen create a listener for the input port\n\n```ruby\ntranspose = MIDIEye::Listener.new(@input)\n```\n\nYou can bind an event to the listener using `Listener#listen_for`\n\nThe listener will try to positively match the parameters you pass in to the properties of the messages it receives.\n\nIn this example, we specify that the listener listens for note on/off messages, which are identifiable by their class.\n\n```ruby\ntranspose.listen_for(:class =\u003e [MIDIMessage::NoteOn, MIDIMessage::NoteOff]) do |event|\n\n  # raise the note value by an octave\n  event[:message].note += 12\n\n  # send the altered note message to the output you chose earlier\n  @output.puts(event[:message])\n\nend\n```\n\nThere is also the option of leaving out the parameters altogether and including using conditional if/unless/case/etc statements in the callback.\n\nYou can bind as many events to a listener as you wish by repeatedly calling `Listener#listen_for`\n\nOnce all the events are bound, start the listener\n\n```ruby\ntranspose.run\n```\n\nA listener can also be run in a background thread by passing in `:background =\u003e true`.\n\n```ruby\ntranspose.run(:background =\u003e true)\n\ntranspose.join # join the background thread later\n```\n\n## Documentation\n\n* [examples](http://github.com/arirusso/midi-eye/tree/master/examples)\n* [rdoc](http://rdoc.info/gems/midi-eye)\n\n## Author\n\n* [Ari Russo](http://github.com/arirusso) \u003cari.russo at gmail.com\u003e\n\n## License\n\nApache 2.0, See the file LICENSE\n\nCopyright (c) 2011-2017 [Ari Russo](http://arirusso.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farirusso%2Fmidi-eye","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farirusso%2Fmidi-eye","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farirusso%2Fmidi-eye/lists"}