musa-dsl 0.30.2 → 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 (158) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -1
  3. data/.version +6 -0
  4. data/.yardopts +7 -0
  5. data/Gemfile +0 -1
  6. data/README.md +227 -6
  7. data/docs/README.md +83 -0
  8. data/docs/api-reference.md +86 -0
  9. data/docs/getting-started/quick-start.md +93 -0
  10. data/docs/getting-started/tutorial.md +58 -0
  11. data/docs/subsystems/core-extensions.md +316 -0
  12. data/docs/subsystems/datasets.md +465 -0
  13. data/docs/subsystems/generative.md +290 -0
  14. data/docs/subsystems/matrix.md +63 -0
  15. data/docs/subsystems/midi.md +123 -0
  16. data/docs/subsystems/music.md +544 -0
  17. data/docs/subsystems/musicxml-builder.md +264 -0
  18. data/docs/subsystems/neumas.md +71 -0
  19. data/docs/subsystems/repl.md +135 -0
  20. data/docs/subsystems/sequencer.md +98 -0
  21. data/docs/subsystems/series.md +302 -0
  22. data/docs/subsystems/transcription.md +152 -0
  23. data/docs/subsystems/transport.md +177 -0
  24. data/lib/musa-dsl/core-ext/array-explode-ranges.rb +68 -0
  25. data/lib/musa-dsl/core-ext/arrayfy.rb +110 -0
  26. data/lib/musa-dsl/core-ext/attribute-builder.rb +91 -30
  27. data/lib/musa-dsl/core-ext/deep-copy.rb +125 -2
  28. data/lib/musa-dsl/core-ext/dynamic-proxy.rb +78 -0
  29. data/lib/musa-dsl/core-ext/extension.rb +53 -0
  30. data/lib/musa-dsl/core-ext/hashify.rb +162 -1
  31. data/lib/musa-dsl/core-ext/inspect-nice.rb +154 -0
  32. data/lib/musa-dsl/core-ext/smart-proc-binder.rb +117 -0
  33. data/lib/musa-dsl/core-ext/with.rb +114 -0
  34. data/lib/musa-dsl/datasets/dataset.rb +109 -0
  35. data/lib/musa-dsl/datasets/delta-d.rb +78 -0
  36. data/lib/musa-dsl/datasets/e.rb +186 -2
  37. data/lib/musa-dsl/datasets/gdv.rb +279 -2
  38. data/lib/musa-dsl/datasets/gdvd.rb +201 -0
  39. data/lib/musa-dsl/datasets/helper.rb +75 -0
  40. data/lib/musa-dsl/datasets/p.rb +177 -2
  41. data/lib/musa-dsl/datasets/packed-v.rb +91 -0
  42. data/lib/musa-dsl/datasets/pdv.rb +136 -1
  43. data/lib/musa-dsl/datasets/ps.rb +134 -4
  44. data/lib/musa-dsl/datasets/score/queriable.rb +143 -1
  45. data/lib/musa-dsl/datasets/score/render.rb +105 -1
  46. data/lib/musa-dsl/datasets/score/to-mxml/process-pdv.rb +138 -1
  47. data/lib/musa-dsl/datasets/score/to-mxml/process-ps.rb +111 -0
  48. data/lib/musa-dsl/datasets/score/to-mxml/process-time.rb +200 -1
  49. data/lib/musa-dsl/datasets/score/to-mxml/to-mxml.rb +145 -1
  50. data/lib/musa-dsl/datasets/score.rb +279 -0
  51. data/lib/musa-dsl/datasets/v.rb +88 -0
  52. data/lib/musa-dsl/generative/darwin.rb +215 -1
  53. data/lib/musa-dsl/generative/generative-grammar.rb +387 -0
  54. data/lib/musa-dsl/generative/markov.rb +135 -3
  55. data/lib/musa-dsl/generative/rules.rb +312 -4
  56. data/lib/musa-dsl/generative/variatio.rb +286 -2
  57. data/lib/musa-dsl/logger/logger.rb +267 -2
  58. data/lib/musa-dsl/matrix/matrix.rb +256 -10
  59. data/lib/musa-dsl/midi/midi-recorder.rb +113 -2
  60. data/lib/musa-dsl/midi/midi-voices.rb +275 -4
  61. data/lib/musa-dsl/music/chord-definition.rb +233 -1
  62. data/lib/musa-dsl/music/chord-definitions.rb +33 -6
  63. data/lib/musa-dsl/music/chords.rb +353 -2
  64. data/lib/musa-dsl/music/equally-tempered-12-tone-scale-system.rb +70 -206
  65. data/lib/musa-dsl/music/scale_kinds/bebop/bebop_dominant_scale_kind.rb +110 -0
  66. data/lib/musa-dsl/music/scale_kinds/bebop/bebop_major_scale_kind.rb +110 -0
  67. data/lib/musa-dsl/music/scale_kinds/bebop/bebop_minor_scale_kind.rb +110 -0
  68. data/lib/musa-dsl/music/scale_kinds/blues/blues_major_scale_kind.rb +100 -0
  69. data/lib/musa-dsl/music/scale_kinds/blues/blues_scale_kind.rb +99 -0
  70. data/lib/musa-dsl/music/scale_kinds/chromatic_scale_kind.rb +79 -0
  71. data/lib/musa-dsl/music/scale_kinds/ethnic/double_harmonic_scale_kind.rb +102 -0
  72. data/lib/musa-dsl/music/scale_kinds/ethnic/hungarian_minor_scale_kind.rb +102 -0
  73. data/lib/musa-dsl/music/scale_kinds/ethnic/neapolitan_major_scale_kind.rb +102 -0
  74. data/lib/musa-dsl/music/scale_kinds/ethnic/neapolitan_minor_scale_kind.rb +101 -0
  75. data/lib/musa-dsl/music/scale_kinds/ethnic/phrygian_dominant_scale_kind.rb +103 -0
  76. data/lib/musa-dsl/music/scale_kinds/harmonic_major/harmonic_major_scale_kind.rb +104 -0
  77. data/lib/musa-dsl/music/scale_kinds/major_scale_kind.rb +110 -0
  78. data/lib/musa-dsl/music/scale_kinds/melodic_minor/altered_scale_kind.rb +106 -0
  79. data/lib/musa-dsl/music/scale_kinds/melodic_minor/dorian_b2_scale_kind.rb +104 -0
  80. data/lib/musa-dsl/music/scale_kinds/melodic_minor/locrian_sharp2_scale_kind.rb +103 -0
  81. data/lib/musa-dsl/music/scale_kinds/melodic_minor/lydian_augmented_scale_kind.rb +103 -0
  82. data/lib/musa-dsl/music/scale_kinds/melodic_minor/lydian_dominant_scale_kind.rb +106 -0
  83. data/lib/musa-dsl/music/scale_kinds/melodic_minor/melodic_minor_scale_kind.rb +104 -0
  84. data/lib/musa-dsl/music/scale_kinds/melodic_minor/mixolydian_b6_scale_kind.rb +103 -0
  85. data/lib/musa-dsl/music/scale_kinds/minor_harmonic_scale_kind.rb +125 -0
  86. data/lib/musa-dsl/music/scale_kinds/minor_natural_scale_kind.rb +123 -0
  87. data/lib/musa-dsl/music/scale_kinds/modes/dorian_scale_kind.rb +111 -0
  88. data/lib/musa-dsl/music/scale_kinds/modes/locrian_scale_kind.rb +114 -0
  89. data/lib/musa-dsl/music/scale_kinds/modes/lydian_scale_kind.rb +111 -0
  90. data/lib/musa-dsl/music/scale_kinds/modes/mixolydian_scale_kind.rb +111 -0
  91. data/lib/musa-dsl/music/scale_kinds/modes/phrygian_scale_kind.rb +111 -0
  92. data/lib/musa-dsl/music/scale_kinds/pentatonic/pentatonic_major_scale_kind.rb +93 -0
  93. data/lib/musa-dsl/music/scale_kinds/pentatonic/pentatonic_minor_scale_kind.rb +99 -0
  94. data/lib/musa-dsl/music/scale_kinds/symmetric/diminished_hw_scale_kind.rb +110 -0
  95. data/lib/musa-dsl/music/scale_kinds/symmetric/diminished_wh_scale_kind.rb +110 -0
  96. data/lib/musa-dsl/music/scale_kinds/symmetric/whole_tone_scale_kind.rb +99 -0
  97. data/lib/musa-dsl/music/scale_systems/equally_tempered_12_tone_scale_system.rb +80 -0
  98. data/lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb +60 -0
  99. data/lib/musa-dsl/music/scales.rb +1384 -40
  100. data/lib/musa-dsl/musicxml/builder/attributes.rb +483 -3
  101. data/lib/musa-dsl/musicxml/builder/backup-forward.rb +166 -1
  102. data/lib/musa-dsl/musicxml/builder/direction.rb +243 -0
  103. data/lib/musa-dsl/musicxml/builder/helper.rb +240 -0
  104. data/lib/musa-dsl/musicxml/builder/measure.rb +284 -0
  105. data/lib/musa-dsl/musicxml/builder/note-complexities.rb +324 -8
  106. data/lib/musa-dsl/musicxml/builder/note.rb +285 -0
  107. data/lib/musa-dsl/musicxml/builder/part-group.rb +108 -1
  108. data/lib/musa-dsl/musicxml/builder/part.rb +139 -0
  109. data/lib/musa-dsl/musicxml/builder/pitched-note.rb +124 -0
  110. data/lib/musa-dsl/musicxml/builder/rest.rb +93 -0
  111. data/lib/musa-dsl/musicxml/builder/score-partwise.rb +276 -0
  112. data/lib/musa-dsl/musicxml/builder/typed-text.rb +62 -1
  113. data/lib/musa-dsl/musicxml/builder/unpitched-note.rb +83 -0
  114. data/lib/musa-dsl/neumalang/neumalang.rb +675 -0
  115. data/lib/musa-dsl/neumas/array-to-neumas.rb +149 -0
  116. data/lib/musa-dsl/neumas/neuma-decoder.rb +253 -0
  117. data/lib/musa-dsl/neumas/neuma-gdv-decoder.rb +142 -2
  118. data/lib/musa-dsl/neumas/neuma-gdvd-decoder.rb +82 -0
  119. data/lib/musa-dsl/neumas/neumas.rb +67 -0
  120. data/lib/musa-dsl/neumas/string-to-neumas.rb +233 -1
  121. data/lib/musa-dsl/repl/repl.rb +550 -0
  122. data/lib/musa-dsl/sequencer/base-sequencer-implementation-every.rb +118 -2
  123. data/lib/musa-dsl/sequencer/base-sequencer-implementation-move.rb +149 -2
  124. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +296 -0
  125. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +88 -2
  126. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play.rb +161 -0
  127. data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +263 -0
  128. data/lib/musa-dsl/sequencer/base-sequencer-tick-based.rb +173 -1
  129. data/lib/musa-dsl/sequencer/base-sequencer-tickless-based.rb +177 -0
  130. data/lib/musa-dsl/sequencer/base-sequencer.rb +710 -10
  131. data/lib/musa-dsl/sequencer/sequencer-dsl.rb +210 -0
  132. data/lib/musa-dsl/sequencer/timeslots.rb +79 -0
  133. data/lib/musa-dsl/series/array-to-serie.rb +37 -1
  134. data/lib/musa-dsl/series/base-series.rb +843 -5
  135. data/lib/musa-dsl/series/buffer-serie.rb +54 -0
  136. data/lib/musa-dsl/series/hash-or-array-serie-splitter.rb +64 -0
  137. data/lib/musa-dsl/series/main-serie-constructors.rb +398 -2
  138. data/lib/musa-dsl/series/main-serie-operations.rb +538 -16
  139. data/lib/musa-dsl/series/proxy-serie.rb +67 -0
  140. data/lib/musa-dsl/series/quantizer-serie.rb +57 -7
  141. data/lib/musa-dsl/series/queue-serie.rb +78 -0
  142. data/lib/musa-dsl/series/series-composer.rb +701 -0
  143. data/lib/musa-dsl/series/timed-serie.rb +473 -28
  144. data/lib/musa-dsl/transcription/from-gdv-to-midi.rb +404 -1
  145. data/lib/musa-dsl/transcription/from-gdv-to-musicxml.rb +118 -0
  146. data/lib/musa-dsl/transcription/from-gdv.rb +84 -1
  147. data/lib/musa-dsl/transcription/transcription.rb +265 -0
  148. data/lib/musa-dsl/transport/clock.rb +125 -0
  149. data/lib/musa-dsl/transport/dummy-clock.rb +89 -2
  150. data/lib/musa-dsl/transport/external-tick-clock.rb +91 -0
  151. data/lib/musa-dsl/transport/input-midi-clock.rb +133 -1
  152. data/lib/musa-dsl/transport/timer-clock.rb +183 -1
  153. data/lib/musa-dsl/transport/timer.rb +83 -0
  154. data/lib/musa-dsl/transport/transport.rb +318 -0
  155. data/lib/musa-dsl/version.rb +2 -1
  156. data/lib/musa-dsl.rb +132 -25
  157. data/musa-dsl.gemspec +25 -18
  158. metadata +158 -16
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Harmonic major scale kind.
6
+ #
7
+ # HarmonicMajorScaleKind defines the harmonic major scale, a major scale
8
+ # with a lowered sixth degree. It creates an augmented second between
9
+ # the sixth and seventh degrees, similar to harmonic minor but in a
10
+ # major context.
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** (leading): Major seventh (11 semitones)
25
+ #
26
+ # ## Key Feature
27
+ #
28
+ # The augmented second between b6 and natural 7 creates an exotic
29
+ # interval similar to harmonic minor, but in a major key context.
30
+ #
31
+ # ## Musical Character
32
+ #
33
+ # The harmonic major scale:
34
+ #
35
+ # - Major quality with exotic coloring
36
+ # - Augmented second (b6 to 7) adds drama
37
+ # - Used in classical, jazz, and film music
38
+ # - Creates unique diminished chord on bVI
39
+ #
40
+ # ## Usage
41
+ #
42
+ # c_harm_maj = Scales[:et12][440.0][:major_harmonic][60]
43
+ # c_harm_maj.tonic # C (60)
44
+ # c_harm_maj.VI # Ab (68) - minor sixth
45
+ # c_harm_maj.leading # B (71) - major seventh
46
+ # # Ab to B = augmented second (3 semitones)
47
+ #
48
+ # @see ScaleKind Abstract base class
49
+ # @see MajorScaleKind Major scale (with major 6th)
50
+ # @see MinorHarmonicScaleKind Harmonic minor (similar augmented second)
51
+ class HarmonicMajorScaleKind < ScaleKind
52
+ @base_metadata = {
53
+ family: :diatonic,
54
+ brightness: -1,
55
+ character: [:major_minor, :dramatic, :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: 4 },
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: 8 },
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 + 4 },
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 + 8 }].freeze
87
+
88
+ def pitches
89
+ @@pitches
90
+ end
91
+
92
+ def grades
93
+ 7
94
+ end
95
+
96
+ def id
97
+ :major_harmonic
98
+ end
99
+ end
100
+
101
+ EquallyTempered12ToneScaleSystem.register HarmonicMajorScaleKind
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Major scale kind (Ionian mode).
6
+ #
7
+ # MajorScaleKind defines the major scale, the fundamental scale of Western
8
+ # tonal music. It follows the pattern: W-W-H-W-W-W-H (whole-half steps)
9
+ # or intervals: M2-M2-m2-M2-M2-M2-m2 from the root.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 7 diatonic degrees plus extended harmony (8th-13th):
14
+ #
15
+ # **Scale Degrees** (Roman numerals, uppercase for major):
16
+ #
17
+ # - **I** (tonic): Root (0 semitones)
18
+ # - **II** (supertonic): Major second (2 semitones)
19
+ # - **III** (mediant): Major third (4 semitones)
20
+ # - **IV** (subdominant): Perfect fourth (5 semitones)
21
+ # - **V** (dominant): Perfect fifth (7 semitones)
22
+ # - **VI** (submediant): Major sixth (9 semitones, relative minor)
23
+ # - **VII** (leading): Major seventh (11 semitones)
24
+ #
25
+ # **Extended degrees** (for extended harmony):
26
+ #
27
+ # - VIII-XIII: Compound intervals (8th, 9th, 10th, 11th, 12th, 13th)
28
+ #
29
+ # ## Function Aliases
30
+ #
31
+ # Each degree has multiple function names:
32
+ #
33
+ # - **Numeric**: _1, _2, _3, _4, _5, _6, _7 (ordinal)
34
+ # - **Roman**: I, II, III, IV, V, VI, VII (harmonic analysis)
35
+ # - **Function**: tonic, supertonic, mediant, subdominant, dominant,
36
+ # submediant, leading
37
+ # - **Ordinal**: first, second, third, fourth, fifth, sixth, seventh
38
+ # - **Special**: relative/relative_minor for VI (relative minor root)
39
+ #
40
+ # ## Usage
41
+ #
42
+ # c_major = Scales[:et12][440.0][:major][60]
43
+ # c_major.tonic # C (60)
44
+ # c_major.dominant # G (67)
45
+ # c_major.VI # A (69) - relative minor root
46
+ # c_major.relative_minor.scale(:minor) # A minor scale
47
+ #
48
+ # @see ScaleKind Abstract base class
49
+ # @see MinorNaturalScaleKind Natural minor scale
50
+ # @see ChromaticScaleKind Chromatic scale
51
+ class MajorScaleKind < ScaleKind
52
+ @base_metadata = {
53
+ family: :diatonic,
54
+ brightness: 0,
55
+ character: [:bright, :stable, :resolved],
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: 4 },
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 relative relative_minor 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 + 4 },
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
+ # Pitch structure.
89
+ # @return [Array<Hash>] pitch definitions with functions and offsets
90
+ def pitches
91
+ @@pitches
92
+ end
93
+
94
+ # Number of diatonic degrees.
95
+ # @return [Integer] 7
96
+ def grades
97
+ 7
98
+ end
99
+
100
+ # Scale kind identifier.
101
+ # @return [Symbol] :major
102
+ def id
103
+ :major
104
+ end
105
+ end
106
+
107
+ EquallyTempered12ToneScaleSystem.register MajorScaleKind
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Altered scale kind (seventh mode of melodic minor).
6
+ #
7
+ # AlteredScaleKind defines the Altered scale (also called Super Locrian,
8
+ # Diminished Whole Tone, or Altered Dominant), the seventh mode of the
9
+ # melodic minor scale. It's the quintessential scale for altered dominant
10
+ # chords in jazz.
11
+ #
12
+ # ## Pitch Structure
13
+ #
14
+ # 7 diatonic degrees plus extended harmony:
15
+ #
16
+ # **Scale Degrees** (lowercase for diminished quality):
17
+ #
18
+ # - **i** (tonic): Root (0 semitones)
19
+ # - **ii** (supertonic): Minor second (1 semitone) ← b9
20
+ # - **iii** (mediant): Minor third (3 semitones) ← #9 (enharmonic)
21
+ # - **iv** (subdominant): Major third (4 semitones) ← b11 (3rd of chord)
22
+ # - **v** (dominant): Diminished fifth (6 semitones) ← b5/#11
23
+ # - **vi** (submediant): Minor sixth (8 semitones) ← #5/b13
24
+ # - **vii** (subtonic): Minor seventh (10 semitones) ← b7
25
+ #
26
+ # ## All Alterations Present
27
+ #
28
+ # Contains all possible alterations of a dominant chord:
29
+ # - b9, #9 (altered 9ths)
30
+ # - #11/b5 (altered 11th/5th)
31
+ # - b13/#5 (altered 13th/5th)
32
+ #
33
+ # ## Musical Character
34
+ #
35
+ # The Altered scale:
36
+ #
37
+ # - Maximum tension for dominant chords
38
+ # - Used over 7alt, 7#9, 7b9#11, etc.
39
+ # - Essential in bebop and modern jazz
40
+ # - Creates strong resolution to tonic
41
+ #
42
+ # ## Usage
43
+ #
44
+ # g_alt = Scales[:et12][440.0][:altered][67]
45
+ # g_alt.tonic # G (67)
46
+ # g_alt.ii # Ab (68) - b9
47
+ # g_alt.iii # Bb (70) - #9
48
+ # g_alt.v # Db (73) - b5
49
+ #
50
+ # @see ScaleKind Abstract base class
51
+ # @see MelodicMinorScaleKind Parent melodic minor scale
52
+ # @see DiminishedWHScaleKind Another altered dominant scale option
53
+ class AlteredScaleKind < ScaleKind
54
+ @base_metadata = {
55
+ family: :melodic_minor_modes,
56
+ brightness: -3,
57
+ character: [:altered_dominant, :jazz, :tension],
58
+ parent: { scale: :minor_melodic, degree: 7 }
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: 1 },
67
+ { functions: %i[iii _3 mediant third],
68
+ pitch: 3 },
69
+ { functions: %i[iv _4 subdominant fourth],
70
+ pitch: 4 },
71
+ { functions: %i[v _5 dominant fifth],
72
+ pitch: 6 },
73
+ { functions: %i[vi _6 submediant sixth],
74
+ pitch: 8 },
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 + 1 },
81
+ { functions: %i[x _10 tenth],
82
+ pitch: 12 + 3 },
83
+ { functions: %i[xi _11 eleventh],
84
+ pitch: 12 + 4 },
85
+ { functions: %i[xii _12 twelfth],
86
+ pitch: 12 + 6 },
87
+ { functions: %i[xiii _13 thirteenth],
88
+ pitch: 12 + 8 }].freeze
89
+
90
+ def pitches
91
+ @@pitches
92
+ end
93
+
94
+ def grades
95
+ 7
96
+ end
97
+
98
+ def id
99
+ :altered
100
+ end
101
+ end
102
+
103
+ EquallyTempered12ToneScaleSystem.register AlteredScaleKind
104
+ end
105
+ end
106
+ end
@@ -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