class Nilsteps::Sequencer
16 steps / bar OSC sequencer for a track
Public Class Methods
new(bpm: 120, length: 16, osc_server: "localhost", osc_port: 2345)
click to toggle source
# File lib/nilsteps.rb, line 27 def initialize(bpm: 120, length: 16, osc_server: "localhost", osc_port: 2345) @steps = Array.new(length) @resolution = 16 # Cannot change resolution for the moment @osc_client = OSC::Client.new(osc_server, osc_port) @bpm_to_ms = BPMToMsec.new(bpm) end
Public Instance Methods
note_length()
click to toggle source
# File lib/nilsteps.rb, line 47 def note_length case @resolution when 1 @bpm_to_ms.whole_note when 2 @bpm_to_ms.half_note when 4 @bpm_to_ms.quater_note when 8 @bpm_to_ms.eighth_note when 16 @bpm_to_ms.sixteenth_note when 32 @bpm_to_ms.thirtysecond_note else @bpm_to_ms.sixteenth_note end end
play(bars = 1) { |step| ... }
click to toggle source