musa-dsl 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile +0 -1
  4. data/docs/subsystems/music.md +326 -15
  5. data/lib/musa-dsl/generative/darwin.rb +36 -1
  6. data/lib/musa-dsl/generative/generative-grammar.rb +28 -0
  7. data/lib/musa-dsl/generative/markov.rb +2 -0
  8. data/lib/musa-dsl/generative/rules.rb +54 -0
  9. data/lib/musa-dsl/generative/variatio.rb +69 -0
  10. data/lib/musa-dsl/midi/midi-recorder.rb +4 -0
  11. data/lib/musa-dsl/midi/midi-voices.rb +10 -0
  12. data/lib/musa-dsl/music/chords.rb +54 -9
  13. data/lib/musa-dsl/music/equally-tempered-12-tone-scale-system.rb +70 -521
  14. data/lib/musa-dsl/music/scale_kinds/bebop/bebop_dominant_scale_kind.rb +110 -0
  15. data/lib/musa-dsl/music/scale_kinds/bebop/bebop_major_scale_kind.rb +110 -0
  16. data/lib/musa-dsl/music/scale_kinds/bebop/bebop_minor_scale_kind.rb +110 -0
  17. data/lib/musa-dsl/music/scale_kinds/blues/blues_major_scale_kind.rb +100 -0
  18. data/lib/musa-dsl/music/scale_kinds/blues/blues_scale_kind.rb +99 -0
  19. data/lib/musa-dsl/music/scale_kinds/chromatic_scale_kind.rb +79 -0
  20. data/lib/musa-dsl/music/scale_kinds/ethnic/double_harmonic_scale_kind.rb +102 -0
  21. data/lib/musa-dsl/music/scale_kinds/ethnic/hungarian_minor_scale_kind.rb +102 -0
  22. data/lib/musa-dsl/music/scale_kinds/ethnic/neapolitan_major_scale_kind.rb +102 -0
  23. data/lib/musa-dsl/music/scale_kinds/ethnic/neapolitan_minor_scale_kind.rb +101 -0
  24. data/lib/musa-dsl/music/scale_kinds/ethnic/phrygian_dominant_scale_kind.rb +103 -0
  25. data/lib/musa-dsl/music/scale_kinds/harmonic_major/harmonic_major_scale_kind.rb +104 -0
  26. data/lib/musa-dsl/music/scale_kinds/major_scale_kind.rb +110 -0
  27. data/lib/musa-dsl/music/scale_kinds/melodic_minor/altered_scale_kind.rb +106 -0
  28. data/lib/musa-dsl/music/scale_kinds/melodic_minor/dorian_b2_scale_kind.rb +104 -0
  29. data/lib/musa-dsl/music/scale_kinds/melodic_minor/locrian_sharp2_scale_kind.rb +103 -0
  30. data/lib/musa-dsl/music/scale_kinds/melodic_minor/lydian_augmented_scale_kind.rb +103 -0
  31. data/lib/musa-dsl/music/scale_kinds/melodic_minor/lydian_dominant_scale_kind.rb +106 -0
  32. data/lib/musa-dsl/music/scale_kinds/melodic_minor/melodic_minor_scale_kind.rb +104 -0
  33. data/lib/musa-dsl/music/scale_kinds/melodic_minor/mixolydian_b6_scale_kind.rb +103 -0
  34. data/lib/musa-dsl/music/scale_kinds/minor_harmonic_scale_kind.rb +125 -0
  35. data/lib/musa-dsl/music/scale_kinds/minor_natural_scale_kind.rb +123 -0
  36. data/lib/musa-dsl/music/scale_kinds/modes/dorian_scale_kind.rb +111 -0
  37. data/lib/musa-dsl/music/scale_kinds/modes/locrian_scale_kind.rb +114 -0
  38. data/lib/musa-dsl/music/scale_kinds/modes/lydian_scale_kind.rb +111 -0
  39. data/lib/musa-dsl/music/scale_kinds/modes/mixolydian_scale_kind.rb +111 -0
  40. data/lib/musa-dsl/music/scale_kinds/modes/phrygian_scale_kind.rb +111 -0
  41. data/lib/musa-dsl/music/scale_kinds/pentatonic/pentatonic_major_scale_kind.rb +93 -0
  42. data/lib/musa-dsl/music/scale_kinds/pentatonic/pentatonic_minor_scale_kind.rb +99 -0
  43. data/lib/musa-dsl/music/scale_kinds/symmetric/diminished_hw_scale_kind.rb +110 -0
  44. data/lib/musa-dsl/music/scale_kinds/symmetric/diminished_wh_scale_kind.rb +110 -0
  45. data/lib/musa-dsl/music/scale_kinds/symmetric/whole_tone_scale_kind.rb +99 -0
  46. data/lib/musa-dsl/music/scale_systems/equally_tempered_12_tone_scale_system.rb +80 -0
  47. data/lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb +60 -0
  48. data/lib/musa-dsl/music/scales.rb +427 -0
  49. data/lib/musa-dsl/series/buffer-serie.rb +6 -0
  50. data/lib/musa-dsl/series/hash-or-array-serie-splitter.rb +23 -0
  51. data/lib/musa-dsl/series/quantizer-serie.rb +12 -0
  52. data/lib/musa-dsl/series/queue-serie.rb +13 -0
  53. data/lib/musa-dsl/version.rb +2 -1
  54. data/musa-dsl.gemspec +20 -15
  55. metadata +85 -22
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Dorian b2 scale kind (second mode of melodic minor).
6
+ #
7
+ # DorianB2ScaleKind defines the Dorian b2 scale (also called Phrygian #6
8
+ # or Javanese scale), the second mode of the melodic minor scale.
9
+ # It combines the Phrygian's lowered second with the Dorian's raised sixth.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 7 diatonic degrees plus extended harmony:
14
+ #
15
+ # **Scale Degrees** (lowercase for minor quality):
16
+ #
17
+ # - **i** (tonic): Root (0 semitones)
18
+ # - **ii** (supertonic): Minor second (1 semitone) ← CHARACTERISTIC (b2)
19
+ # - **iii** (mediant): Minor third (3 semitones)
20
+ # - **iv** (subdominant): Perfect fourth (5 semitones)
21
+ # - **v** (dominant): Perfect fifth (7 semitones)
22
+ # - **vi** (submediant): Major sixth (9 semitones) ← CHARACTERISTIC (#6)
23
+ # - **vii** (subtonic): Minor seventh (10 semitones)
24
+ #
25
+ # ## Relationship to Other Modes
26
+ #
27
+ # - Dorian with lowered 2nd
28
+ # - Phrygian with raised 6th
29
+ # - 2nd mode of melodic minor
30
+ #
31
+ # ## Musical Character
32
+ #
33
+ # The Dorian b2 scale:
34
+ #
35
+ # - Exotic, Eastern quality
36
+ # - Minor with both Phrygian darkness and Dorian brightness
37
+ # - Used over sus4(b9) chords in jazz
38
+ # - Common in contemporary jazz and fusion
39
+ #
40
+ # ## Usage
41
+ #
42
+ # d_dor_b2 = Scales[:et12][440.0][:dorian_b2][62]
43
+ # d_dor_b2.tonic # D (62)
44
+ # d_dor_b2.ii # Eb (63) - minor second
45
+ # d_dor_b2.vi # B (71) - major sixth
46
+ #
47
+ # @see ScaleKind Abstract base class
48
+ # @see DorianScaleKind Dorian mode
49
+ # @see PhrygianScaleKind Phrygian mode
50
+ # @see MelodicMinorScaleKind Parent melodic minor scale
51
+ class DorianB2ScaleKind < ScaleKind
52
+ @base_metadata = {
53
+ family: :melodic_minor_modes,
54
+ brightness: -2,
55
+ character: [:exotic, :phrygian_dorian],
56
+ parent: { scale: :minor_melodic, degree: 2 }
57
+ }.freeze
58
+
59
+ class << self
60
+ @@pitches =
61
+ [{ functions: %i[i _1 tonic first],
62
+ pitch: 0 },
63
+ { functions: %i[ii _2 supertonic second],
64
+ pitch: 1 },
65
+ { functions: %i[iii _3 mediant third],
66
+ pitch: 3 },
67
+ { functions: %i[iv _4 subdominant fourth],
68
+ pitch: 5 },
69
+ { functions: %i[v _5 dominant fifth],
70
+ pitch: 7 },
71
+ { functions: %i[vi _6 submediant sixth],
72
+ pitch: 9 },
73
+ { functions: %i[vii _7 subtonic seventh],
74
+ pitch: 10 },
75
+ { functions: %i[viii _8 eighth],
76
+ pitch: 12 },
77
+ { functions: %i[ix _9 ninth],
78
+ pitch: 12 + 1 },
79
+ { functions: %i[x _10 tenth],
80
+ pitch: 12 + 3 },
81
+ { functions: %i[xi _11 eleventh],
82
+ pitch: 12 + 5 },
83
+ { functions: %i[xii _12 twelfth],
84
+ pitch: 12 + 7 },
85
+ { functions: %i[xiii _13 thirteenth],
86
+ pitch: 12 + 9 }].freeze
87
+
88
+ def pitches
89
+ @@pitches
90
+ end
91
+
92
+ def grades
93
+ 7
94
+ end
95
+
96
+ def id
97
+ :dorian_b2
98
+ end
99
+ end
100
+
101
+ EquallyTempered12ToneScaleSystem.register DorianB2ScaleKind
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Locrian #2 scale kind (sixth mode of melodic minor).
6
+ #
7
+ # LocrianSharp2ScaleKind defines the Locrian #2 scale (also called
8
+ # Aeolian b5 or Half-Diminished scale), the sixth mode of the
9
+ # melodic minor scale. It's the primary scale for half-diminished chords.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 7 diatonic degrees plus extended harmony:
14
+ #
15
+ # **Scale Degrees** (lowercase for diminished quality):
16
+ #
17
+ # - **i** (tonic): Root (0 semitones)
18
+ # - **ii** (supertonic): Major second (2 semitones) ← #2 vs Locrian
19
+ # - **iii** (mediant): Minor third (3 semitones)
20
+ # - **iv** (subdominant): Perfect fourth (5 semitones)
21
+ # - **v** (dominant): Diminished fifth (6 semitones) ← DIMINISHED
22
+ # - **vi** (submediant): Minor sixth (8 semitones)
23
+ # - **vii** (subtonic): Minor seventh (10 semitones)
24
+ #
25
+ # ## Relationship to Other Modes
26
+ #
27
+ # - Locrian with raised 2nd (natural 9)
28
+ # - Aeolian with lowered 5th
29
+ # - 6th mode of melodic minor
30
+ #
31
+ # ## Musical Character
32
+ #
33
+ # The Locrian #2 scale:
34
+ #
35
+ # - Primary scale for m7b5 (half-diminished) chords
36
+ # - More usable than pure Locrian (has natural 9)
37
+ # - Essential in jazz ii-V-I in minor keys
38
+ # - Dark but functional
39
+ #
40
+ # ## Usage
41
+ #
42
+ # a_loc2 = Scales[:et12][440.0][:locrian_sharp2][69]
43
+ # a_loc2.tonic # A (69)
44
+ # a_loc2.ii # B (71) - major second (raised)
45
+ # a_loc2.v # Eb (75) - diminished fifth
46
+ #
47
+ # @see ScaleKind Abstract base class
48
+ # @see LocrianScaleKind Locrian mode (with minor 2nd)
49
+ # @see MelodicMinorScaleKind Parent melodic minor scale
50
+ class LocrianSharp2ScaleKind < ScaleKind
51
+ @base_metadata = {
52
+ family: :melodic_minor_modes,
53
+ brightness: -2,
54
+ character: [:half_diminished, :jazz],
55
+ parent: { scale: :minor_melodic, degree: 6 }
56
+ }.freeze
57
+
58
+ class << self
59
+ @@pitches =
60
+ [{ functions: %i[i _1 tonic first],
61
+ pitch: 0 },
62
+ { functions: %i[ii _2 supertonic second],
63
+ pitch: 2 },
64
+ { functions: %i[iii _3 mediant third],
65
+ pitch: 3 },
66
+ { functions: %i[iv _4 subdominant fourth],
67
+ pitch: 5 },
68
+ { functions: %i[v _5 dominant fifth],
69
+ pitch: 6 },
70
+ { functions: %i[vi _6 submediant sixth],
71
+ pitch: 8 },
72
+ { functions: %i[vii _7 subtonic seventh],
73
+ pitch: 10 },
74
+ { functions: %i[viii _8 eighth],
75
+ pitch: 12 },
76
+ { functions: %i[ix _9 ninth],
77
+ pitch: 12 + 2 },
78
+ { functions: %i[x _10 tenth],
79
+ pitch: 12 + 3 },
80
+ { functions: %i[xi _11 eleventh],
81
+ pitch: 12 + 5 },
82
+ { functions: %i[xii _12 twelfth],
83
+ pitch: 12 + 6 },
84
+ { functions: %i[xiii _13 thirteenth],
85
+ pitch: 12 + 8 }].freeze
86
+
87
+ def pitches
88
+ @@pitches
89
+ end
90
+
91
+ def grades
92
+ 7
93
+ end
94
+
95
+ def id
96
+ :locrian_sharp2
97
+ end
98
+ end
99
+
100
+ EquallyTempered12ToneScaleSystem.register LocrianSharp2ScaleKind
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Lydian augmented scale kind (third mode of melodic minor).
6
+ #
7
+ # LydianAugmentedScaleKind defines the Lydian augmented scale, the third
8
+ # mode of the melodic minor scale. It combines the Lydian's raised fourth
9
+ # with an augmented (raised) fifth.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 7 diatonic degrees plus extended harmony:
14
+ #
15
+ # **Scale Degrees** (uppercase for major quality):
16
+ #
17
+ # - **I** (tonic): Root (0 semitones)
18
+ # - **II** (supertonic): Major second (2 semitones)
19
+ # - **III** (mediant): Major third (4 semitones)
20
+ # - **IV** (subdominant): Augmented fourth (6 semitones) ← LYDIAN
21
+ # - **V** (dominant): Augmented fifth (8 semitones) ← AUGMENTED
22
+ # - **VI** (submediant): Major sixth (9 semitones)
23
+ # - **VII** (leading): Major seventh (11 semitones)
24
+ #
25
+ # ## Relationship to Other Modes
26
+ #
27
+ # - Lydian with augmented 5th
28
+ # - 3rd mode of melodic minor
29
+ # - Contains both #4 and #5
30
+ #
31
+ # ## Musical Character
32
+ #
33
+ # The Lydian augmented scale:
34
+ #
35
+ # - Extremely bright and ethereal
36
+ # - Used over maj7#5 and maj7#11 chords
37
+ # - Dreamy, floating quality
38
+ # - Common in contemporary jazz and film music
39
+ #
40
+ # ## Usage
41
+ #
42
+ # eb_lyd_aug = Scales[:et12][440.0][:lydian_augmented][63]
43
+ # eb_lyd_aug.tonic # Eb (63)
44
+ # eb_lyd_aug.IV # A (69) - augmented fourth
45
+ # eb_lyd_aug.V # B (71) - augmented fifth
46
+ #
47
+ # @see ScaleKind Abstract base class
48
+ # @see LydianScaleKind Lydian mode
49
+ # @see MelodicMinorScaleKind Parent melodic minor scale
50
+ class LydianAugmentedScaleKind < ScaleKind
51
+ @base_metadata = {
52
+ family: :melodic_minor_modes,
53
+ brightness: 3,
54
+ character: [:very_bright, :augmented, :ethereal],
55
+ parent: { scale: :minor_melodic, degree: 3 }
56
+ }.freeze
57
+
58
+ class << self
59
+ @@pitches =
60
+ [{ functions: %i[I _1 tonic first],
61
+ pitch: 0 },
62
+ { functions: %i[II _2 supertonic second],
63
+ pitch: 2 },
64
+ { functions: %i[III _3 mediant third],
65
+ pitch: 4 },
66
+ { functions: %i[IV _4 subdominant fourth],
67
+ pitch: 6 },
68
+ { functions: %i[V _5 dominant fifth],
69
+ pitch: 8 },
70
+ { functions: %i[VI _6 submediant sixth],
71
+ pitch: 9 },
72
+ { functions: %i[VII _7 leading seventh],
73
+ pitch: 11 },
74
+ { functions: %i[VIII _8 eighth],
75
+ pitch: 12 },
76
+ { functions: %i[IX _9 ninth],
77
+ pitch: 12 + 2 },
78
+ { functions: %i[X _10 tenth],
79
+ pitch: 12 + 4 },
80
+ { functions: %i[XI _11 eleventh],
81
+ pitch: 12 + 6 },
82
+ { functions: %i[XII _12 twelfth],
83
+ pitch: 12 + 8 },
84
+ { functions: %i[XIII _13 thirteenth],
85
+ pitch: 12 + 9 }].freeze
86
+
87
+ def pitches
88
+ @@pitches
89
+ end
90
+
91
+ def grades
92
+ 7
93
+ end
94
+
95
+ def id
96
+ :lydian_augmented
97
+ end
98
+ end
99
+
100
+ EquallyTempered12ToneScaleSystem.register LydianAugmentedScaleKind
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Lydian dominant scale kind (fourth mode of melodic minor).
6
+ #
7
+ # LydianDominantScaleKind defines the Lydian dominant scale (also called
8
+ # Lydian b7, Overtone scale, or Bartók scale), the fourth mode of the
9
+ # melodic minor scale. It combines the Lydian's raised fourth with a
10
+ # dominant seventh.
11
+ #
12
+ # ## Pitch Structure
13
+ #
14
+ # 7 diatonic degrees plus extended harmony:
15
+ #
16
+ # **Scale Degrees** (uppercase for major quality):
17
+ #
18
+ # - **I** (tonic): Root (0 semitones)
19
+ # - **II** (supertonic): Major second (2 semitones)
20
+ # - **III** (mediant): Major third (4 semitones)
21
+ # - **IV** (subdominant): Augmented fourth (6 semitones) ← LYDIAN (#4)
22
+ # - **V** (dominant): Perfect fifth (7 semitones)
23
+ # - **VI** (submediant): Major sixth (9 semitones)
24
+ # - **VII** (subtonic): Minor seventh (10 semitones) ← DOMINANT (b7)
25
+ #
26
+ # ## Relationship to Other Modes
27
+ #
28
+ # - Lydian with lowered 7th
29
+ # - Mixolydian with raised 4th
30
+ # - 4th mode of melodic minor
31
+ # - Matches the harmonic series closely
32
+ #
33
+ # ## Musical Character
34
+ #
35
+ # The Lydian dominant scale:
36
+ #
37
+ # - Bright but with dominant tension
38
+ # - Used over 7#11 chords
39
+ # - Common in jazz, Béla Bartók's music
40
+ # - Creates sophisticated dominant sound
41
+ #
42
+ # ## Usage
43
+ #
44
+ # f_lyd_dom = Scales[:et12][440.0][:lydian_dominant][65]
45
+ # f_lyd_dom.tonic # F (65)
46
+ # f_lyd_dom.IV # B (71) - augmented fourth
47
+ # f_lyd_dom.VII # Eb (75) - minor seventh
48
+ #
49
+ # @see ScaleKind Abstract base class
50
+ # @see LydianScaleKind Lydian mode (with major 7th)
51
+ # @see MixolydianScaleKind Mixolydian mode (with perfect 4th)
52
+ # @see MelodicMinorScaleKind Parent melodic minor scale
53
+ class LydianDominantScaleKind < ScaleKind
54
+ @base_metadata = {
55
+ family: :melodic_minor_modes,
56
+ brightness: 1,
57
+ character: [:bright, :dominant, :fusion],
58
+ parent: { scale: :minor_melodic, degree: 4 }
59
+ }.freeze
60
+
61
+ class << self
62
+ @@pitches =
63
+ [{ functions: %i[I _1 tonic first],
64
+ pitch: 0 },
65
+ { functions: %i[II _2 supertonic second],
66
+ pitch: 2 },
67
+ { functions: %i[III _3 mediant third],
68
+ pitch: 4 },
69
+ { functions: %i[IV _4 subdominant fourth],
70
+ pitch: 6 },
71
+ { functions: %i[V _5 dominant fifth],
72
+ pitch: 7 },
73
+ { functions: %i[VI _6 submediant sixth],
74
+ pitch: 9 },
75
+ { functions: %i[VII _7 subtonic seventh],
76
+ pitch: 10 },
77
+ { functions: %i[VIII _8 eighth],
78
+ pitch: 12 },
79
+ { functions: %i[IX _9 ninth],
80
+ pitch: 12 + 2 },
81
+ { functions: %i[X _10 tenth],
82
+ pitch: 12 + 4 },
83
+ { functions: %i[XI _11 eleventh],
84
+ pitch: 12 + 6 },
85
+ { functions: %i[XII _12 twelfth],
86
+ pitch: 12 + 7 },
87
+ { functions: %i[XIII _13 thirteenth],
88
+ pitch: 12 + 9 }].freeze
89
+
90
+ def pitches
91
+ @@pitches
92
+ end
93
+
94
+ def grades
95
+ 7
96
+ end
97
+
98
+ def id
99
+ :lydian_dominant
100
+ end
101
+ end
102
+
103
+ EquallyTempered12ToneScaleSystem.register LydianDominantScaleKind
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Melodic minor scale kind (ascending form).
6
+ #
7
+ # MelodicMinorScaleKind defines the melodic minor scale in its ascending
8
+ # form (also called jazz minor). It has a minor third but major sixth and
9
+ # seventh, creating a unique hybrid between minor and major qualities.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 7 diatonic degrees plus extended harmony:
14
+ #
15
+ # **Scale Degrees** (lowercase for minor quality):
16
+ #
17
+ # - **i** (tonic): Root (0 semitones)
18
+ # - **ii** (supertonic): Major second (2 semitones)
19
+ # - **iii** (mediant): Minor third (3 semitones) ← MINOR
20
+ # - **iv** (subdominant): Perfect fourth (5 semitones)
21
+ # - **v** (dominant): Perfect fifth (7 semitones)
22
+ # - **vi** (submediant): Major sixth (9 semitones) ← MAJOR
23
+ # - **vii** (leading): Major seventh (11 semitones) ← MAJOR
24
+ #
25
+ # ## Relationship to Other Scales
26
+ #
27
+ # - Minor third (like natural minor)
28
+ # - Major 6th and 7th (like major scale)
29
+ # - Parent scale for many jazz modes (Lydian Dominant, Altered, etc.)
30
+ #
31
+ # ## Musical Character
32
+ #
33
+ # The melodic minor scale:
34
+ #
35
+ # - Minor quality with major upper structure
36
+ # - Essential in jazz harmony
37
+ # - Less dark than harmonic minor (no augmented 2nd)
38
+ # - Smooth melodic contour
39
+ #
40
+ # ## Usage
41
+ #
42
+ # c_mel_min = Scales[:et12][440.0][:minor_melodic][60]
43
+ # c_mel_min.tonic # C (60)
44
+ # c_mel_min.mediant # Eb (63) - minor third
45
+ # c_mel_min.leading # B (71) - major seventh
46
+ #
47
+ # @see ScaleKind Abstract base class
48
+ # @see MinorNaturalScaleKind Natural minor
49
+ # @see MinorHarmonicScaleKind Harmonic minor
50
+ # @see AlteredScaleKind Altered scale (7th mode of melodic minor)
51
+ class MelodicMinorScaleKind < ScaleKind
52
+ @base_metadata = {
53
+ family: :melodic_minor_modes,
54
+ brightness: -1,
55
+ character: [:minor, :ascending, :classical],
56
+ parent: nil
57
+ }.freeze
58
+
59
+ class << self
60
+ @@pitches =
61
+ [{ functions: %i[i _1 tonic first],
62
+ pitch: 0 },
63
+ { functions: %i[ii _2 supertonic second],
64
+ pitch: 2 },
65
+ { functions: %i[iii _3 mediant third],
66
+ pitch: 3 },
67
+ { functions: %i[iv _4 subdominant fourth],
68
+ pitch: 5 },
69
+ { functions: %i[v _5 dominant fifth],
70
+ pitch: 7 },
71
+ { functions: %i[vi _6 submediant sixth],
72
+ pitch: 9 },
73
+ { functions: %i[vii _7 leading seventh],
74
+ pitch: 11 },
75
+ { functions: %i[viii _8 eighth],
76
+ pitch: 12 },
77
+ { functions: %i[ix _9 ninth],
78
+ pitch: 12 + 2 },
79
+ { functions: %i[x _10 tenth],
80
+ pitch: 12 + 3 },
81
+ { functions: %i[xi _11 eleventh],
82
+ pitch: 12 + 5 },
83
+ { functions: %i[xii _12 twelfth],
84
+ pitch: 12 + 7 },
85
+ { functions: %i[xiii _13 thirteenth],
86
+ pitch: 12 + 9 }].freeze
87
+
88
+ def pitches
89
+ @@pitches
90
+ end
91
+
92
+ def grades
93
+ 7
94
+ end
95
+
96
+ def id
97
+ :minor_melodic
98
+ end
99
+ end
100
+
101
+ EquallyTempered12ToneScaleSystem.register MelodicMinorScaleKind
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Mixolydian b6 scale kind (fifth mode of melodic minor).
6
+ #
7
+ # MixolydianB6ScaleKind defines the Mixolydian b6 scale (also called
8
+ # Melodic Major, Hindu scale, or Aeolian Dominant), the fifth mode of
9
+ # the melodic minor scale. It combines the Mixolydian's major quality
10
+ # with a minor sixth.
11
+ #
12
+ # ## Pitch Structure
13
+ #
14
+ # 7 diatonic degrees plus extended harmony:
15
+ #
16
+ # **Scale Degrees** (uppercase for major quality):
17
+ #
18
+ # - **I** (tonic): Root (0 semitones)
19
+ # - **II** (supertonic): Major second (2 semitones)
20
+ # - **III** (mediant): Major third (4 semitones)
21
+ # - **IV** (subdominant): Perfect fourth (5 semitones)
22
+ # - **V** (dominant): Perfect fifth (7 semitones)
23
+ # - **VI** (submediant): Minor sixth (8 semitones) ← CHARACTERISTIC (b6)
24
+ # - **VII** (subtonic): Minor seventh (10 semitones)
25
+ #
26
+ # ## Relationship to Other Modes
27
+ #
28
+ # - Mixolydian with lowered 6th
29
+ # - Major scale with b6 and b7
30
+ # - 5th mode of melodic minor
31
+ #
32
+ # ## Musical Character
33
+ #
34
+ # The Mixolydian b6 scale:
35
+ #
36
+ # - Melancholic major quality
37
+ # - Used over dominant 7th with b13 (V7b13)
38
+ # - Creates a beautiful tension in the upper structure
39
+ # - Common in jazz and contemporary music
40
+ #
41
+ # ## Usage
42
+ #
43
+ # g_mix_b6 = Scales[:et12][440.0][:mixolydian_b6][67]
44
+ # g_mix_b6.tonic # G (67)
45
+ # g_mix_b6.VI # Eb (75) - minor sixth
46
+ #
47
+ # @see ScaleKind Abstract base class
48
+ # @see MixolydianScaleKind Mixolydian mode (with major 6th)
49
+ # @see MelodicMinorScaleKind Parent melodic minor scale
50
+ class MixolydianB6ScaleKind < ScaleKind
51
+ @base_metadata = {
52
+ family: :melodic_minor_modes,
53
+ brightness: 0,
54
+ character: [:hindu, :dominant, :melodic],
55
+ parent: { scale: :minor_melodic, degree: 5 }
56
+ }.freeze
57
+
58
+ class << self
59
+ @@pitches =
60
+ [{ functions: %i[I _1 tonic first],
61
+ pitch: 0 },
62
+ { functions: %i[II _2 supertonic second],
63
+ pitch: 2 },
64
+ { functions: %i[III _3 mediant third],
65
+ pitch: 4 },
66
+ { functions: %i[IV _4 subdominant fourth],
67
+ pitch: 5 },
68
+ { functions: %i[V _5 dominant fifth],
69
+ pitch: 7 },
70
+ { functions: %i[VI _6 submediant sixth],
71
+ pitch: 8 },
72
+ { functions: %i[VII _7 subtonic seventh],
73
+ pitch: 10 },
74
+ { functions: %i[VIII _8 eighth],
75
+ pitch: 12 },
76
+ { functions: %i[IX _9 ninth],
77
+ pitch: 12 + 2 },
78
+ { functions: %i[X _10 tenth],
79
+ pitch: 12 + 4 },
80
+ { functions: %i[XI _11 eleventh],
81
+ pitch: 12 + 5 },
82
+ { functions: %i[XII _12 twelfth],
83
+ pitch: 12 + 7 },
84
+ { functions: %i[XIII _13 thirteenth],
85
+ pitch: 12 + 8 }].freeze
86
+
87
+ def pitches
88
+ @@pitches
89
+ end
90
+
91
+ def grades
92
+ 7
93
+ end
94
+
95
+ def id
96
+ :mixolydian_b6
97
+ end
98
+ end
99
+
100
+ EquallyTempered12ToneScaleSystem.register MixolydianB6ScaleKind
101
+ end
102
+ end
103
+ end