Class: Musa::Scales::ScaleSystemTuning
- Inherits:
-
Object
- Object
- Musa::Scales::ScaleSystemTuning
- Extended by:
- Forwardable
- Defined in:
- lib/musa-dsl/music/scales.rb
Instance Attribute Summary collapse
-
#a_frequency ⇒ Object
readonly
Returns the value of attribute a_frequency.
-
#scale_system ⇒ Object
readonly
Returns the value of attribute scale_system.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](scale_kind_class_id) ⇒ Object
- #chromatic ⇒ Object
- #frequency_of_pitch(pitch, root) ⇒ Object
-
#initialize(scale_system, a_frequency) ⇒ ScaleSystemTuning
constructor
A new instance of ScaleSystemTuning.
- #inspect ⇒ Object (also: #to_s)
Constructor Details
#initialize(scale_system, a_frequency) ⇒ ScaleSystemTuning
Returns a new instance of ScaleSystemTuning.
139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/musa-dsl/music/scales.rb', line 139 def initialize(scale_system, a_frequency) @scale_system = scale_system @a_frequency = a_frequency @scale_kinds = {} @chromatic_scale_kind = self[@scale_system.chromatic_class.id] @scale_system.scale_kind_classes.each_key do |name| define_singleton_method name do self[name] end end end |
Instance Attribute Details
#a_frequency ⇒ Object (readonly)
Returns the value of attribute a_frequency.
157 158 159 |
# File 'lib/musa-dsl/music/scales.rb', line 157 def a_frequency @a_frequency end |
#scale_system ⇒ Object (readonly)
Returns the value of attribute scale_system.
157 158 159 |
# File 'lib/musa-dsl/music/scales.rb', line 157 def scale_system @scale_system end |
Instance Method Details
#==(other) ⇒ Object
171 172 173 174 175 |
# File 'lib/musa-dsl/music/scales.rb', line 171 def ==(other) self.class == other.class && @scale_system == other.scale_system && @a_frequency == other.a_frequency end |
#[](scale_kind_class_id) ⇒ Object
159 160 161 |
# File 'lib/musa-dsl/music/scales.rb', line 159 def [](scale_kind_class_id) @scale_kinds[scale_kind_class_id] ||= @scale_system.scale_kind_class(scale_kind_class_id).new self end |
#chromatic ⇒ Object
163 164 165 |
# File 'lib/musa-dsl/music/scales.rb', line 163 def chromatic @chromatic_scale_kind end |
#frequency_of_pitch(pitch, root) ⇒ Object
167 168 169 |
# File 'lib/musa-dsl/music/scales.rb', line 167 def frequency_of_pitch(pitch, root) @scale_system.frequency_of_pitch(pitch, root, @a_frequency) end |
#inspect ⇒ Object Also known as: to_s
177 178 179 |
# File 'lib/musa-dsl/music/scales.rb', line 177 def inspect "<ScaleSystemTuning: scale_system = #{@scale_system} a_frequency = #{@a_frequency}>" end |