Class: Zgomot::Comp::Perc
Constant Summary collapse
- PERC_MAP =
{ :acoustic_bass_drum => [:B,1], :bass_drum_1 => [:C,2], :side_stick => [:Cs,2], :acoustic_snare => [:D,2], :hand_clap => [:Ds,2], :electric_snare => [:E,2], :low_floor_tom => [:F,2], :closed_hi_hat => [:Fs,2], :high_floor_tom => [:G,2], :pedal_hi_hat => [:Gs,2], :low_tom => [:A,2], :open_hi_hat => [:As,2], :low_mid_tom => [:B,2], :high_mid_tom => [:C,3], :crash_cymbal_1 => [:Cs,3], :high_tom => [:D,3], :ride_cymbal_1 => [:Ds,3], :chinese_cymbal => [:E,3], :ride_bell => [:F,3], :tambourine => [:Fs,3], :splash_cymbal => [:G,3], :cowbell => [:Gs,3], :crash_cymbal_2 => [:A,3], :vibraslap => [:As,3], :ride_cymbal_2 => [:B,3], :high_bongo => [:C,4], :low_bongo => [:Cs,4], :mute_hi_conga => [:D,4], :open_hi_conga => [:Ds,4], :low_conga => [:E,4], :high_timbale => [:F,4], :low_timbale => [:Fs,4], :high_agogo => [:G,4], :low_agogo => [:Gs,4], :cabasa => [:A,4], :maracas => [:As,4], :short_whistle => [:B,4], :long_whistle => [:C,5], :short_guiro => [:Cs,5], :long_guiro => [:D,5], :claves => [:Ds,5], :hi_woodblock => [:E,5], :low_woodblock => [:F,5], :mute_cuica => [:Fs,5], :open_cuica => [:G,5], :mute_triangle => [:Gs,5], :open_triangle => [:A,5], :R => :R, }
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#perc ⇒ Object
readonly
Returns the value of attribute perc.
-
#time_scale ⇒ Object
readonly
Returns the value of attribute time_scale.
-
#velocity ⇒ Object
readonly
Returns the value of attribute velocity.
Instance Method Summary collapse
- #bpm!(v) ⇒ Object
- #channel=(chan) ⇒ Object
-
#initialize(args) ⇒ Perc
constructor
A new instance of Perc.
- #length!(v) ⇒ Object
- #length_to_sec ⇒ Object
- #note ⇒ Object
- #offset=(time) ⇒ Object
- #time=(time) ⇒ Object
- #to_midi ⇒ Object
- #velocity!(v) ⇒ Object
Constructor Details
#initialize(args) ⇒ Perc
Returns a new instance of Perc.
30 31 32 |
# File 'lib/zgomot/comp/perc.rb', line 30 def initialize(args) @length, @velocity, @perc = args[:length], args[:velocity], args[:perc] end |
Instance Attribute Details
#length ⇒ Object (readonly)
Returns the value of attribute length.
28 29 30 |
# File 'lib/zgomot/comp/perc.rb', line 28 def length @length end |
#perc ⇒ Object (readonly)
Returns the value of attribute perc.
28 29 30 |
# File 'lib/zgomot/comp/perc.rb', line 28 def perc @perc end |
#time_scale ⇒ Object (readonly)
Returns the value of attribute time_scale.
28 29 30 |
# File 'lib/zgomot/comp/perc.rb', line 28 def time_scale @time_scale end |
#velocity ⇒ Object (readonly)
Returns the value of attribute velocity.
28 29 30 |
# File 'lib/zgomot/comp/perc.rb', line 28 def velocity @velocity end |
Instance Method Details
#bpm!(v) ⇒ Object
38 39 40 |
# File 'lib/zgomot/comp/perc.rb', line 38 def bpm!(v) note.bpm!(v); self end |
#channel=(chan) ⇒ Object
41 42 43 |
# File 'lib/zgomot/comp/perc.rb', line 41 def channel=(chan) note.channel = chan end |
#length!(v) ⇒ Object
53 54 55 |
# File 'lib/zgomot/comp/perc.rb', line 53 def length!(v) note.length!(v); self end |
#length_to_sec ⇒ Object
56 57 58 |
# File 'lib/zgomot/comp/perc.rb', line 56 def length_to_sec note.length_to_sec end |
#note ⇒ Object
33 34 35 36 37 |
# File 'lib/zgomot/comp/perc.rb', line 33 def note @note ||= Zgomot::Midi::Note.new(:pitch => Perc::PERC_MAP[perc], :length => length, :velocity => velocity) end |
#offset=(time) ⇒ Object
44 45 46 |
# File 'lib/zgomot/comp/perc.rb', line 44 def offset=(time) note.offset = time end |
#time=(time) ⇒ Object
47 48 49 |
# File 'lib/zgomot/comp/perc.rb', line 47 def time=(time) note.time = time end |
#to_midi ⇒ Object
59 60 61 |
# File 'lib/zgomot/comp/perc.rb', line 59 def to_midi note.to_midi end |
#velocity!(v) ⇒ Object
50 51 52 |
# File 'lib/zgomot/comp/perc.rb', line 50 def velocity!(v) note.velocity!(v); self end |