
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
MIDI syncable tempo in Ruby
gem install midi-topaz
or with Bundler, add this to your Gemfile
gem "midi-topaz"
require "topaz"
For demonstration purposes, here's a mock sequencer class and object
class Sequencer
def step
@i ||= 0
puts "step #{@i+=1}"
end
end
sequencer = Sequencer.new
The Topaz clock can now be used to step that sequencer. Timed by Topaz, the passed in block will be called repeatedly at 130 BPM
@clock = Topaz::Clock.new(130) { sequencer.step }
A MIDI device can be used to time and control the tempo. To accomplish this, pass a unimidi input to the Clock constructor
@input = UniMIDI::Input.gets # select a midi input
@clock = Topaz::Clock.new(@input) { sequencer.step }
Topaz 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
@output = UniMIDI::Output.gets # select a midi output
@clock = Topaz::Clock.new(120, :midi => @output) do
sequencer.step
end
Input and multiple outputs can be used simultaneously, for MIDI thru
@clock = Topaz::Clock.new(@input, :midi => [@output1, @output2]) do
sequencer.step
end
Once the Clock object is initialized, start the clock
@clock.start
Topaz will run in a background thread if the option :background => true
is passed in.
@clock.start(:background => true)
If you are syncing to an external MIDI source, this will start the listener waiting for MIDI clock messages.
You can view the current tempo:
@clock.tempo
=> 132.422000
Pass in a block that will stop the clock when it evaluates to true
@clock.trigger.stop { @i == 20 }
Apache 2.0, See the file LICENSE
Copyright (c) 2011-2015 Ari Russo
FAQs
Unknown package
We found that midi-topaz demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.