Sha256: d8f2db51b27be33f1a22443ca4529e7b9691177619c18881cb0fc031c7b253d4
Contents?: true
Size: 812 Bytes
Versions: 3
Compression:
Stored size: 812 Bytes
Contents
module Scissor class Sequence def initialize(pattern, duration_per_step) @pattern = pattern @duration_per_step = duration_per_step end def apply(instruments) result = Scissor() @pattern.split(//).each do |c| if instruments.include?(c.to_sym) instrument = instruments[c.to_sym] if instrument.is_a?(Proc) instrument = instrument.call(c) end if @duration_per_step > instrument.duration result += instrument result += Scissor.silence(@duration_per_step - instrument.duration) else result += instrument.slice(0, @duration_per_step) end else result += Scissor.silence(@duration_per_step) end end result end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
youpy-scissor-0.0.17 | lib/scissor/sequence.rb |
youpy-scissor-0.0.18 | lib/scissor/sequence.rb |
youpy-scissor-0.0.19 | lib/scissor/sequence.rb |