{"id":21570387,"url":"https://github.com/arirusso/diamond","last_synced_at":"2025-04-10T14:12:48.972Z","repository":{"id":59152908,"uuid":"1906998","full_name":"arirusso/diamond","owner":"arirusso","description":"MIDI arpeggiator in Ruby","archived":false,"fork":false,"pushed_at":"2022-08-19T18:41:18.000Z","size":212,"stargazers_count":48,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-24T12:56:20.694Z","etag":null,"topics":[],"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-06-16T17:50:03.000Z","updated_at":"2024-11-01T18:20:03.000Z","dependencies_parsed_at":"2022-09-13T11:01:00.553Z","dependency_job_id":null,"html_url":"https://github.com/arirusso/diamond","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%2Fdiamond","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Fdiamond/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Fdiamond/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Fdiamond/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arirusso","download_url":"https://codeload.github.com/arirusso/diamond/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247867366,"owners_count":21009240,"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":[],"created_at":"2024-11-24T11:12:29.739Z","updated_at":"2025-04-10T14:12:48.953Z","avatar_url":"https://github.com/arirusso.png","language":"Ruby","funding_links":[],"categories":["Programming Languages"],"sub_categories":["Ruby"],"readme":"# Diamond\n\n[MIDI arpeggiator](http://en.wikipedia.org/wiki/Arpeggiator#Arpeggiator) in Ruby\n\n![diamond](http://1.bp.blogspot.com/-at6MuXyeuwY/TgoTFCeQP7I/AAAAAAAAAF4/WbjtunQ4IQc/s320/687474703a2f2f696d616765732e7472656574726f75626c652e6e65742f696d616765732f6469616d6f6e642e6a7067.jpeg)\n\n## Features\n\n* Classic arpeggiator functionality and patterns\n* [OSC](http://en.wikipedia.org/wiki/Open_Sound_Control) and MIDI remote control\n* MIDI clock IO\n* Multiplex clocks and arpeggiators\n* Suited to [live coding](http://en.wikipedia.org/wiki/Live_coding)\n* Generative arpeggio patterns\n\n## Installation\n\n`gem install diamond`\n\n  or with Bundler, add this to your Gemfile\n\n`gem \"diamond\"`\n\n## Usage\n\n```ruby\nrequire \"diamond\"\n```\n\nFirst, select a MIDI output using [unimidi](https://github.com/arirusso/unimidi). ([more about that here](http://tx81z.blogspot.com/2011/10/selecting-midi-device-with-unimidi.html))\n\n```ruby\n@output = UniMIDI::Output.gets\n```\n\nThe Diamond arpeggiator has a number of [optional parameters](http://rubydoc.info/github/arirusso/diamond/master/Diamond/Arpeggiator:initialize).  For this example, here's a straightforward setup\n\n```ruby\noptions = {\n  :gate =\u003e 90,\n  :interval =\u003e 7,\n  :midi =\u003e @output,\n  :pattern =\u003e \"UpDown\",\n  :range =\u003e 4,\n  :rate =\u003e 8\n}\n\narpeggiator = Diamond::Arpeggiator.new(options)\n```\n\nCreate a clock object, passing in a tempo value. In this case the tempo will be 138 BPM\n\n```ruby\nclock = Diamond::Clock.new(138)\n```\n\nPoint the clock to the arpeggiator\n\n```ruby\nclock \u003c\u003c arpeggiator\n```\n\nThe arpeggiator will play based on inputted notes or chords; a MIDI input can be used for that. ([see example](http://github.com/arirusso/diamond/blob/master/examples/midi_note_input.rb)). It's also possible to enter notes in Ruby:\n\n```ruby\nchord = [\"C3\", \"G3\", \"Bb3\", \"A4\"]\n```\n\nUse `Arpeggiator#add` and `Arpeggiator#remove` to change the notes that the arpeggiator sees. (`Arpeggiator#\u003c\u003c` is the same as add)  \n\n```ruby\narpeggiator.add(chord)\narpeggiator \u003c\u003c \"C5\"\n```\n\nStarting the clock will also start the arpeggiator:\n\n```ruby\nclock.start\n```\n\nNote that by default, the clock will run in a background thread. If you're working in a [PRY](http://pryrepl.org)/[IRB](http://en.wikipedia.org/wiki/Interactive_Ruby_Shell)/etc this will allow you to continue to code while the arpeggiator runs. To start in the *foreground*, pass `:focus =\u003e true` to `Clock#start`.\n\nAll of the [arpeggiator options](http://rubydoc.info/github/arirusso/diamond/master/Diamond/Arpeggiator:initialize) can be controlled while the arpeggiator is running.\n\n```ruby\narpeggiator.rate = 16\narpeggiator.gate = 20  \narpeggiator.remove(\"C5\", \"A4\")\n```\n\n[This screencast video](http://vimeo.com/25983971) shows Diamond being live coded in this way.  (Note that the API has changed a bit since 2011 when the video was made).\n\nThis [blog post](http://tx81z.blogspot.com/2011/07/live-coding-with-diamond.html) explains what is happening in the video.\n\n#### Posts\n\n* [Introduction](http://tx81z.blogspot.com/2011/07/diamond-midi-arpeggiator-in-ruby.html)\n* [Live coding Diamond and syncing multiple arpeggiators to each other](http://tx81z.blogspot.com/2011/07/live-coding-with-diamond.html)\n* [A note about live coding in IRB with OSX](http://tx81z.blogspot.com/2011/09/note-about-live-coding-in-irb-with-osx.html)\n\n#### Examples\n\n* [Control via OSC](http://github.com/arirusso/diamond/blob/master/examples/osc_control.rb)\n* [Define a Pattern](http://github.com/arirusso/diamond/blob/master/examples/define_pattern.rb)\n* [Feed notes to Diamond using a MIDI controller or other input](http://github.com/arirusso/diamond/blob/master/examples/midi_note_input.rb)\n* [Feed notes to Diamond using MIDI message objects](http://github.com/arirusso/diamond/blob/master/examples/midi_message_objects.rb)\n* [Sync multiple Arpeggiator instances to each other](http://github.com/arirusso/diamond/blob/master/examples/sync_multiple_arps.rb)\n* [Sync Diamond to external MIDI clock](http://github.com/arirusso/diamond/blob/master/examples/midi_clock_sync.rb)\n* [Use Diamond as a master MIDI clock](http://github.com/arirusso/diamond/blob/master/examples/midi_clock_output.rb)\n\n[More...](http://github.com/arirusso/diamond/blob/master/examples)\n\n## Other Documentation\n\n* [rdoc](http://rubydoc.info/github/arirusso/diamond)\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-2015 [Ari Russo](http://arirusso.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farirusso%2Fdiamond","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farirusso%2Fdiamond","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farirusso%2Fdiamond/lists"}