Class: StringyFi::Measures
- Inherits:
-
Array
- Object
- Array
- StringyFi::Measures
- Defined in:
- lib/stringyfi/measures.rb
Instance Method Summary collapse
Instance Method Details
#octave_range ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/stringyfi/measures.rb', line 13 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
3 4 5 6 7 8 9 10 11 |
# File 'lib/stringyfi/measures.rb', line 3 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 |