Class: Tonal::ExtendedRatio

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 extended ratio.

Examples:

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

Parameters:

  • reduced (Boolean) (defaults to: true)

    whether to return reduced ratios or not

Returns:



68
69
70
71
72
73
# File 'lib/tonal/extended_ratio.rb', line 68

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_subharmonic_extended_ratioTonal::SubharmonicExtendedRatio Also known as: to_sefr

Returns the subharmonic extended ratio.

Examples:

er = Tonal::ExtendedRatio.new(partials: [4, 5, 6])
er.to_subharmonic_extended_ratio => Tonal::SubharmonicExtendedRatio with partials [(1/15), (1/12), (1/10)]

Returns:



80
81
82
# File 'lib/tonal/extended_ratio.rb', line 80

def to_subharmonic_extended_ratio
  switch_to(:subharmonic)
end