Class: StringyFi::Measures
- Inherits:
-
Array
- Object
- Array
- StringyFi::Measures
- Defined in:
- lib/stringyfi/measures.rb
Overview
extend Array with methods for working with measures
Instance Method Summary collapse
Instance Method Details
#octave_range ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stringyfi/measures.rb', line 15 def octave_range lo = hi = nil each do |measure| measure.each do |note| next if note.rest? lo ||= note.octave hi ||= note.octave lo = note.octave if note.octave < lo hi = note.octave if note.octave > hi end end [lo, hi] end |
#shortest_fractional_duration ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/stringyfi/measures.rb', line 5 def shortest_fractional_duration result = 1 each do |measure| measure.each do |note| result = note.fractional_duration if note.fractional_duration < result end end result end |