{"id":21570390,"url":"https://github.com/arirusso/topaz","last_synced_at":"2025-07-20T10:34:34.829Z","repository":{"id":1463000,"uuid":"1699732","full_name":"arirusso/topaz","owner":"arirusso","description":"MIDI syncable tempo in Ruby","archived":false,"fork":false,"pushed_at":"2022-08-26T22:17:25.000Z","size":105,"stargazers_count":15,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-12T10:26:11.536Z","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-05-04T05:05:17.000Z","updated_at":"2020-12-19T02:41:48.000Z","dependencies_parsed_at":"2022-07-07T12:44:30.796Z","dependency_job_id":null,"html_url":"https://github.com/arirusso/topaz","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arirusso/topaz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Ftopaz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Ftopaz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Ftopaz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Ftopaz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arirusso","download_url":"https://codeload.github.com/arirusso/topaz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arirusso%2Ftopaz/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265108514,"owners_count":23712466,"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:31.126Z","updated_at":"2025-07-20T10:34:34.807Z","avatar_url":"https://github.com/arirusso.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Topaz\n\n![pic](http://img526.imageshack.us/img526/5781/topazt.jpg)\n\nMIDI syncable tempo in Ruby\n\n## Installation\n\n`gem install midi-topaz`\n\n  or with Bundler, add this to your Gemfile\n\n`gem \"midi-topaz\"`\n\n## Usage\n\n```ruby\nrequire \"topaz\"\n```\n\nFor demonstration purposes, here's a mock sequencer class and object\n\n```ruby\nclass Sequencer\n\n  def step\n    @i ||= 0\n    puts \"step #{@i+=1}\"\n  end\n\nend\n\nsequencer = Sequencer.new\n```\n\nThe Topaz clock can now be used to step that sequencer.  Timed by Topaz, the passed in block will be called repeatedly at 130 BPM\n\n```ruby\n@clock = Topaz::Clock.new(130) { sequencer.step }\n```\n\nA MIDI device can be used to time and control the tempo.  To accomplish this, pass a [unimidi](https://github.com/arirusso/unimidi) input to the Clock constructor\n\n```ruby\n@input = UniMIDI::Input.gets # select a midi input\n\n@clock = Topaz::Clock.new(@input) { sequencer.step }\n```\n\nTopaz can also act as a MIDI master clock. If a MIDI output is passed to Topaz, MIDI clock messages will automatically be sent to that output at the appropriate time\n\n```ruby\n@output = UniMIDI::Output.gets # select a midi output\n\n@clock = Topaz::Clock.new(120, :midi =\u003e @output) do\n  sequencer.step\nend\n```\n\nInput and multiple outputs can be used simultaneously, for MIDI thru\n\n```ruby\n@clock = Topaz::Clock.new(@input, :midi =\u003e [@output1, @output2]) do\n  sequencer.step\nend\n```\n\nOnce the Clock object is initialized, start the clock\n\n```ruby\n@clock.start\n```\n\nTopaz will run in a background thread if the option `:background =\u003e true` is passed in.\n\n```ruby\n@clock.start(:background =\u003e true)\n```\n\nIf you are syncing to an external MIDI source, this will start the listener waiting for MIDI clock messages.\n\nYou can view the current tempo:\n\n```ruby\n@clock.tempo\n  =\u003e 132.422000\n```\n\nPass in a block that will stop the clock when it evaluates to true\n\n```ruby\n@clock.trigger.stop { @i == 20 }\n```\n\n## Documentation\n\n* [examples](http://github.com/arirusso/topaz/tree/master/examples)\n* [rdoc](http://rdoc.info/gems/midi-topaz)\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%2Ftopaz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farirusso%2Ftopaz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farirusso%2Ftopaz/lists"}