Module: MTK::Lang::Intervals
- Extended by:
- PseudoConstants
- Defined in:
- lib/mtk/lang/intervals.rb
Overview
Defines a constant for intervals up to an octave using diatonic naming conventions (see en.wikipedia.org/wiki/Interval_(music)#Main_intervals)
Naming conventions
P#: perfect interval
M#: major interval
m#: minor interval
TT: tritone (AKA augmented 4th or diminished 5th)
These can be thought of like constants, but in order to succinctly distinguish ‘m2’ (minor) from ‘M2’ (major), it was necessary to use lower-case names for some of the values and therefore define them as “pseudo constant” methods. The methods are available either through the module (MTK::Core::Intervals::m2) or via mixin (include MTK::Core::Intervals; m2)
Constant Summary collapse
- INTERVALS =
The values of all “psuedo constants” defined in this module
[P1, m2, M2, m3, M3, P4, TT, P5, m6, M6, m7, M7, P8].freeze
- INTERVAL_NAMES =
The names of all “psuedo constants” defined in this module
MTK::Core::Interval::NAMES
Instance Attribute Summary collapse
-
#M2 ⇒ MTK::Core::Interval[2]
readonly
major second.
-
#m2 ⇒ MTK::Core::Interval[1]
readonly
Number of semitones in the interval m2.
-
#M3 ⇒ MTK::Core::Interval[4]
readonly
major third.
-
#m3 ⇒ MTK::Core::Interval[3]
readonly
minor third.
-
#M6 ⇒ MTK::Core::Interval[9]
readonly
major sixth.
-
#m6 ⇒ MTK::Core::Interval[8]
readonly
minor sixth.
-
#m7 ⇒ MTK::Core::Interval[10]
readonly
minor seventh.
-
#M7 ⇒ MTK::Core::Interval[11]
readonly
major seventh.
-
#P1 ⇒ MTK::Core::Interval[0]
readonly
Number of semitones in the interval P1.
-
#P4 ⇒ MTK::Core::Interval[5]
readonly
pefect fourth.
-
#P5 ⇒ MTK::Core::Interval[7]
readonly
perfect fifth.
-
#P8 ⇒ MTK::Core::Interval[12]
readonly
pefect octave.
-
#TT ⇒ MTK::Core::Interval[6]
readonly
tritone (AKA augmented fourth or diminished fifth).
Method Summary
Methods included from PseudoConstants
Instance Attribute Details
#M2 ⇒ MTK::Core::Interval[2] (readonly)
major second
33 |
# File 'lib/mtk/lang/intervals.rb', line 33 define_constant 'M2', MTK::Core::Interval[2] |
#m2 ⇒ MTK::Core::Interval[1] (readonly)
Returns number of semitones in the interval m2.
30 |
# File 'lib/mtk/lang/intervals.rb', line 30 define_constant 'm2', MTK::Core::Interval[1] |
#M3 ⇒ MTK::Core::Interval[4] (readonly)
major third
39 |
# File 'lib/mtk/lang/intervals.rb', line 39 define_constant 'M3', MTK::Core::Interval[4] |
#m3 ⇒ MTK::Core::Interval[3] (readonly)
minor third
36 |
# File 'lib/mtk/lang/intervals.rb', line 36 define_constant 'm3', MTK::Core::Interval[3] |
#M6 ⇒ MTK::Core::Interval[9] (readonly)
major sixth
54 |
# File 'lib/mtk/lang/intervals.rb', line 54 define_constant 'M6', MTK::Core::Interval[9] |
#m6 ⇒ MTK::Core::Interval[8] (readonly)
minor sixth
51 |
# File 'lib/mtk/lang/intervals.rb', line 51 define_constant 'm6', MTK::Core::Interval[8] |
#m7 ⇒ MTK::Core::Interval[10] (readonly)
minor seventh
57 |
# File 'lib/mtk/lang/intervals.rb', line 57 define_constant 'm7', MTK::Core::Interval[10] |
#M7 ⇒ MTK::Core::Interval[11] (readonly)
major seventh
60 |
# File 'lib/mtk/lang/intervals.rb', line 60 define_constant 'M7', MTK::Core::Interval[11] |
#P1 ⇒ MTK::Core::Interval[0] (readonly)
Returns number of semitones in the interval P1.
24 |
# File 'lib/mtk/lang/intervals.rb', line 24 define_constant 'P1', MTK::Core::Interval[0] |
#P4 ⇒ MTK::Core::Interval[5] (readonly)
pefect fourth
42 |
# File 'lib/mtk/lang/intervals.rb', line 42 define_constant 'P4', MTK::Core::Interval[5] |
#P5 ⇒ MTK::Core::Interval[7] (readonly)
perfect fifth
48 |
# File 'lib/mtk/lang/intervals.rb', line 48 define_constant 'P5', MTK::Core::Interval[7] |
#P8 ⇒ MTK::Core::Interval[12] (readonly)
pefect octave
63 |
# File 'lib/mtk/lang/intervals.rb', line 63 define_constant 'P8', MTK::Core::Interval[12] |
#TT ⇒ MTK::Core::Interval[6] (readonly)
tritone (AKA augmented fourth or diminished fifth)
45 |
# File 'lib/mtk/lang/intervals.rb', line 45 define_constant 'TT', MTK::Core::Interval[6] |