Class: Tonal::SubharmonicExtendedRatio

Inherits:
Object
  • Object
show all
Includes:
ExtendableRatio
Defined in:
lib/tonal/extended_ratio.rb

Instance Attribute Summary

Attributes included from ExtendableRatio

#partials

Instance Method Summary collapse

Methods included from ExtendableRatio

#initialize, #inspect, #interval_between

Instance Method Details

#ratios(reduced: true) ⇒ Array<Tonal::Ratio, Tonal::ReducedRatio>

Returns the ratios of the subharmonic extended ratio.

Examples:

ser = Tonal::SubharmonicExtendedRatio.new(partials: [6,5,4])
ser.ratios => [1/1, 6/5, 3/2]

Parameters:

  • reduced (Boolean) (defaults to: true)

    whether to return reduced ratios or not

Returns:



105
106
107
108
109
110
# File 'lib/tonal/extended_ratio.rb', line 105

def ratios(reduced: true)
  first = partials.first
  partials.map do |n|
    reduced ? Tonal::ReducedRatio.new(n, first) : Tonal::Ratio.new(n, first)
  end
end

#to_extended_ratioTonal::ExtendedRatio Also known as: to_efr

Returns the harmonic extended ratio.

Examples:

ser = Tonal::SubharmonicExtendedRatio.new(partials: [6,5,4])
ser.to_extended_ratio => Tonal::ExtendedRatio with partials [10, 12, 15]

Returns:



117
118
119
# File 'lib/tonal/extended_ratio.rb', line 117

def to_extended_ratio
  switch_to(:harmonic)
end