Class: Musa::Scales::TwelveSemitonesScaleSystem Abstract Private

Inherits:
ScaleSystem show all
Defined in:
lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.

Subclasses must implement ScaleSystem.frequency_of_pitch

Base class for 12-semitone scale systems.

TwelveSemitonesScaleSystem provides the foundation for any scale system using 12 semitones per octave. It defines intervals and structure but doesn't specify tuning (frequency calculation).

Concrete subclasses must implement frequency calculation:

Intervals

Defines standard interval names using semitone distances:

{ P0: 0, m2: 1, M2: 2, m3: 3, M3: 4, P4: 5, TT: 6,
  P5: 7, m6: 8, M6: 9, m7: 10, M7: 11, P8: 12 }

Direct Known Subclasses

EquallyTempered12ToneScaleSystem

Constant Summary collapse

@@intervals =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

{ P0: 0, m2: 1, M2: 2, m3: 3, M3: 4, P4: 5, TT: 6, P5: 7, m6: 8, M6: 9, m7: 10, M7: 11, P8: 12 }

Class Method Summary collapse

Class Method Details

.idSymbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

System identifier.

Returns:

  • (Symbol)

    :et12



31
32
33
# File 'lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb', line 31

def id
  :et12
end

.intervalsHash{Symbol => Integer}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Interval definitions.

Examples:

TwelveSemitonesScaleSystem.intervals[:P5]  # => 7 (perfect fifth)
TwelveSemitonesScaleSystem.intervals[:M3]  # => 4 (major third)

Returns:

  • (Hash{Symbol => Integer})

    interval name to semitones mapping



54
55
56
# File 'lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb', line 54

def intervals
  @@intervals
end

.notes_in_octaveInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Number of distinct notes per octave.

Returns:

  • (Integer)

    12



37
38
39
# File 'lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb', line 37

def notes_in_octave
  12
end

.part_of_tone_sizeInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Size of smallest pitch division.

Returns:

  • (Integer)

    1 (semitone)



43
44
45
# File 'lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb', line 43

def part_of_tone_size
  1
end