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
@@ -1,208 +1,72 @@
1
- require_relative 'scales'
2
-
3
- module Musa
4
- module Scales
5
- class TwelveSemitonesScaleSystem < ScaleSystem
6
- class << self
7
- @@intervals = { 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 }
8
-
9
- def id
10
- :et12
11
- end
12
-
13
- def notes_in_octave
14
- 12
15
- end
16
-
17
- def part_of_tone_size
18
- 1
19
- end
20
-
21
- def intervals
22
- @@intervals
23
- end
24
- end
25
- end
26
-
27
- class EquallyTempered12ToneScaleSystem < TwelveSemitonesScaleSystem
28
- class << self
29
- def frequency_of_pitch(pitch, _root_pitch, a_frequency)
30
- (a_frequency * Rational(2)**Rational(pitch - 69, 12)).to_f
31
- end
32
- end
33
-
34
- Scales.register EquallyTempered12ToneScaleSystem, default: true
35
- end
36
-
37
-
38
- class ChromaticScaleKind < ScaleKind
39
- class << self
40
- @@pitches =
41
- [{ functions: [:_1], pitch: 0 },
42
- { functions: [:_2], pitch: 1 },
43
- { functions: [:_3], pitch: 2 },
44
- { functions: [:_4], pitch: 3 },
45
- { functions: [:_5], pitch: 4 },
46
- { functions: [:_6], pitch: 5 },
47
- { functions: [:_7], pitch: 6 },
48
- { functions: [:_8], pitch: 7 },
49
- { functions: [:_9], pitch: 8 },
50
- { functions: [:_10], pitch: 9 },
51
- { functions: [:_11], pitch: 10 },
52
- { functions: [:_12], pitch: 11 }].freeze
53
-
54
- def pitches
55
- @@pitches
56
- end
57
-
58
- def id
59
- :chromatic
60
- end
61
-
62
- def chromatic?
63
- true
64
- end
65
- end
66
-
67
- EquallyTempered12ToneScaleSystem.register ChromaticScaleKind
68
- end
1
+ # frozen_string_literal: true
2
+
3
+ # Equal temperament 12-tone scale system and scale kinds.
4
+ #
5
+ # This file loads the complete ET12 scale system including:
6
+ # - TwelveSemitonesScaleSystem (base class)
7
+ # - EquallyTempered12ToneScaleSystem (concrete implementation)
8
+ # - All standard scale kinds (chromatic, major, minor, harmonic minor)
9
+ # - All Greek/church modes (dorian, phrygian, lydian, mixolydian, locrian)
10
+ # - Pentatonic scales (major, minor)
11
+ # - Blues scales (blues, blues major)
12
+ # - Symmetric scales (whole tone, diminished)
13
+ # - Melodic minor modes (melodic minor, dorian b2, lydian augmented, etc.)
14
+ # - Harmonic major
15
+ # - Ethnic scales (double harmonic, hungarian minor, phrygian dominant, etc.)
16
+ # - Bebop scales (dominant, major, minor)
69
17
 
70
- class MajorScaleKind < ScaleKind
71
- class << self
72
- @@pitches =
73
- [{ functions: %i[I _1 tonic first],
74
- pitch: 0 },
75
- { functions: %i[II _2 supertonic second],
76
- pitch: 2 },
77
- { functions: %i[III _3 mediant third],
78
- pitch: 4 },
79
- { functions: %i[IV _4 subdominant fourth],
80
- pitch: 5 },
81
- { functions: %i[V _5 dominant fifth],
82
- pitch: 7 },
83
- { functions: %i[VI _6 submediant relative relative_minor sixth],
84
- pitch: 9 },
85
- { functions: %i[VII _7 leading seventh],
86
- pitch: 11 },
87
- { functions: %i[VIII _8 eighth],
88
- pitch: 12 },
89
- { functions: %i[IX _9 ninth],
90
- pitch: 12 + 2 },
91
- { functions: %i[X _10 tenth],
92
- pitch: 12 + 4 },
93
- { functions: %i[XI _11 eleventh],
94
- pitch: 12 + 5 },
95
- { functions: %i[XII _12 twelfth],
96
- pitch: 12 + 7 },
97
- { functions: %i[XIII _13 thirteenth],
98
- pitch: 12 + 9 }].freeze
99
-
100
- def pitches
101
- @@pitches
102
- end
103
-
104
- def grades
105
- 7
106
- end
107
-
108
- def id
109
- :major
110
- end
111
- end
112
-
113
- EquallyTempered12ToneScaleSystem.register MajorScaleKind
114
- end
115
-
116
- class MinorNaturalScaleKind < ScaleKind
117
- class << self
118
- @@pitches =
119
- [{ functions: %i[i _1 tonic first],
120
- pitch: 0 },
121
- { functions: %i[ii _2 supertonic second],
122
- pitch: 2 },
123
- { functions: %i[iii _3 mediant relative relative_major third],
124
- pitch: 3 },
125
- { functions: %i[iv _4 subdominant fourth],
126
- pitch: 5 },
127
- { functions: %i[v _5 dominant fifth],
128
- pitch: 7 },
129
- { functions: %i[vi _6 submediant sixth],
130
- pitch: 8 },
131
- { functions: %i[vii _7 seventh],
132
- pitch: 10 },
133
- { functions: %i[viii _8 eighth],
134
- pitch: 12 },
135
- { functions: %i[ix _9 ninth],
136
- pitch: 12 + 2 },
137
- { functions: %i[x _10 tenth],
138
- pitch: 12 + 3 },
139
- { functions: %i[xi _11 eleventh],
140
- pitch: 12 + 5 },
141
- { functions: %i[xii _12 twelfth],
142
- pitch: 12 + 7 },
143
- { functions: %i[xiii _13 thirteenth],
144
- pitch: 12 + 8 }].freeze
145
-
146
- def pitches
147
- @@pitches
148
- end
149
-
150
- def grades
151
- 7
152
- end
153
-
154
- def id
155
- :minor
156
- end
157
- end
158
-
159
- EquallyTempered12ToneScaleSystem.register MinorNaturalScaleKind
160
- end
161
-
162
- class MinorHarmonicScaleKind < ScaleKind
163
- class << self
164
- @@pitches =
165
- [{ functions: %i[i _1 tonic],
166
- pitch: 0 },
167
- { functions: %i[ii _2 supertonic],
168
- pitch: 2 },
169
- { functions: %i[iii _3 mediant relative relative_major],
170
- pitch: 3 },
171
- { functions: %i[iv _4 subdominant],
172
- pitch: 5 },
173
- { functions: %i[v _5 dominant],
174
- pitch: 7 },
175
- { functions: %i[vi _6 submediant],
176
- pitch: 8 },
177
- { functions: %i[vii _7 leading],
178
- pitch: 11 },
179
- { functions: %i[viii _8],
180
- pitch: 12 },
181
- { functions: %i[ix _9],
182
- pitch: 12 + 2 },
183
- { functions: %i[x _10],
184
- pitch: 12 + 3 },
185
- { functions: %i[xi _11],
186
- pitch: 12 + 5 },
187
- { functions: %i[xii _12],
188
- pitch: 12 + 7 },
189
- { functions: %i[xiii _13],
190
- pitch: 12 + 8 }].freeze
191
-
192
- def pitches
193
- @@pitches
194
- end
195
-
196
- def grades
197
- 7
198
- end
199
-
200
- def id
201
- :minor_harmonic
202
- end
203
- end
18
+ require_relative 'scales'
204
19
 
205
- EquallyTempered12ToneScaleSystem.register MinorHarmonicScaleKind
206
- end
207
- end
208
- end
20
+ # Scale systems
21
+ require_relative 'scale_systems/twelve_semitones_scale_system'
22
+ require_relative 'scale_systems/equally_tempered_12_tone_scale_system'
23
+
24
+ # Core scale kinds
25
+ require_relative 'scale_kinds/chromatic_scale_kind'
26
+ require_relative 'scale_kinds/major_scale_kind'
27
+ require_relative 'scale_kinds/minor_natural_scale_kind'
28
+ require_relative 'scale_kinds/minor_harmonic_scale_kind'
29
+
30
+ # Greek/church modes
31
+ require_relative 'scale_kinds/modes/dorian_scale_kind'
32
+ require_relative 'scale_kinds/modes/phrygian_scale_kind'
33
+ require_relative 'scale_kinds/modes/lydian_scale_kind'
34
+ require_relative 'scale_kinds/modes/mixolydian_scale_kind'
35
+ require_relative 'scale_kinds/modes/locrian_scale_kind'
36
+
37
+ # Pentatonic scales
38
+ require_relative 'scale_kinds/pentatonic/pentatonic_major_scale_kind'
39
+ require_relative 'scale_kinds/pentatonic/pentatonic_minor_scale_kind'
40
+
41
+ # Blues scales
42
+ require_relative 'scale_kinds/blues/blues_scale_kind'
43
+ require_relative 'scale_kinds/blues/blues_major_scale_kind'
44
+
45
+ # Symmetric scales
46
+ require_relative 'scale_kinds/symmetric/whole_tone_scale_kind'
47
+ require_relative 'scale_kinds/symmetric/diminished_hw_scale_kind'
48
+ require_relative 'scale_kinds/symmetric/diminished_wh_scale_kind'
49
+
50
+ # Melodic minor and modes
51
+ require_relative 'scale_kinds/melodic_minor/melodic_minor_scale_kind'
52
+ require_relative 'scale_kinds/melodic_minor/dorian_b2_scale_kind'
53
+ require_relative 'scale_kinds/melodic_minor/lydian_augmented_scale_kind'
54
+ require_relative 'scale_kinds/melodic_minor/lydian_dominant_scale_kind'
55
+ require_relative 'scale_kinds/melodic_minor/mixolydian_b6_scale_kind'
56
+ require_relative 'scale_kinds/melodic_minor/locrian_sharp2_scale_kind'
57
+ require_relative 'scale_kinds/melodic_minor/altered_scale_kind'
58
+
59
+ # Harmonic major
60
+ require_relative 'scale_kinds/harmonic_major/harmonic_major_scale_kind'
61
+
62
+ # Ethnic/exotic scales
63
+ require_relative 'scale_kinds/ethnic/double_harmonic_scale_kind'
64
+ require_relative 'scale_kinds/ethnic/hungarian_minor_scale_kind'
65
+ require_relative 'scale_kinds/ethnic/phrygian_dominant_scale_kind'
66
+ require_relative 'scale_kinds/ethnic/neapolitan_minor_scale_kind'
67
+ require_relative 'scale_kinds/ethnic/neapolitan_major_scale_kind'
68
+
69
+ # Bebop scales
70
+ require_relative 'scale_kinds/bebop/bebop_dominant_scale_kind'
71
+ require_relative 'scale_kinds/bebop/bebop_major_scale_kind'
72
+ require_relative 'scale_kinds/bebop/bebop_minor_scale_kind'
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Bebop dominant scale kind.
6
+ #
7
+ # BebopDominantScaleKind defines the bebop dominant scale, an eight-note
8
+ # scale that adds a chromatic passing tone (major 7th) to the Mixolydian
9
+ # mode. This allows chord tones to fall on downbeats during eighth-note runs.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 8 degrees plus extended:
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): Perfect fourth (5 semitones)
21
+ # - **V** (dominant): Perfect fifth (7 semitones)
22
+ # - **VI** (submediant): Major sixth (9 semitones)
23
+ # - **VII** (subtonic): Minor seventh (10 semitones)
24
+ # - **VII#** (leading): Major seventh (11 semitones) ← PASSING TONE
25
+ #
26
+ # ## Bebop Principle
27
+ #
28
+ # The added chromatic note ensures that:
29
+ # - Chord tones (1, 3, 5, b7) fall on strong beats
30
+ # - Non-chord tones fall on weak beats
31
+ # - Creates smooth voice leading at tempo
32
+ #
33
+ # ## Musical Character
34
+ #
35
+ # The bebop dominant scale:
36
+ #
37
+ # - Essential for jazz improvisation over dominant 7th chords
38
+ # - Creates characteristic bebop sound at fast tempos
39
+ # - Used by Charlie Parker, Dizzy Gillespie, and bebop masters
40
+ #
41
+ # ## Usage
42
+ #
43
+ # g_bebop = Scales[:et12][440.0][:bebop_dominant][67]
44
+ # g_bebop[0].pitch # G (67) - root
45
+ # g_bebop[6].pitch # F (77) - minor 7th
46
+ # g_bebop[7].pitch # F# (78) - major 7th (chromatic passing)
47
+ #
48
+ # @see ScaleKind Abstract base class
49
+ # @see MixolydianScaleKind Mixolydian (7-note parent)
50
+ # @see BebopMajorScaleKind Bebop major scale
51
+ class BebopDominantScaleKind < ScaleKind
52
+ @base_metadata = {
53
+ family: :bebop,
54
+ brightness: 1,
55
+ character: [:jazz, :chromatic_passing, :dominant],
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: 9 },
73
+ { functions: %i[VII _7 subtonic seventh],
74
+ pitch: 10 },
75
+ { functions: %i[VII# _8 leading eighth],
76
+ pitch: 11 },
77
+ { functions: %i[VIII _9 ninth],
78
+ pitch: 12 },
79
+ { functions: %i[IX _10 tenth],
80
+ pitch: 12 + 2 },
81
+ { functions: %i[X _11 eleventh],
82
+ pitch: 12 + 4 },
83
+ { functions: %i[XI _12 twelfth],
84
+ pitch: 12 + 5 },
85
+ { functions: %i[XII _13 thirteenth],
86
+ pitch: 12 + 7 },
87
+ { functions: %i[XIII _14 fourteenth],
88
+ pitch: 12 + 9 },
89
+ { functions: %i[XIV _15 fifteenth],
90
+ pitch: 12 + 10 },
91
+ { functions: %i[XV _16 sixteenth],
92
+ pitch: 12 + 11 }].freeze
93
+
94
+ def pitches
95
+ @@pitches
96
+ end
97
+
98
+ def grades
99
+ 8
100
+ end
101
+
102
+ def id
103
+ :bebop_dominant
104
+ end
105
+ end
106
+
107
+ EquallyTempered12ToneScaleSystem.register BebopDominantScaleKind
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Bebop major scale kind.
6
+ #
7
+ # BebopMajorScaleKind defines the bebop major scale, an eight-note
8
+ # scale that adds a chromatic passing tone (#5) to the major scale.
9
+ # This allows chord tones to fall on downbeats during eighth-note runs.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 8 degrees plus extended:
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): Perfect fourth (5 semitones)
21
+ # - **V** (dominant): Perfect fifth (7 semitones)
22
+ # - **V#** (passing): Augmented fifth (8 semitones) ← PASSING TONE
23
+ # - **VI** (submediant): Major sixth (9 semitones)
24
+ # - **VII** (leading): Major seventh (11 semitones)
25
+ #
26
+ # ## Bebop Principle
27
+ #
28
+ # The added #5 chromatic note ensures that:
29
+ # - Chord tones (1, 3, 5, 7) fall on strong beats
30
+ # - Non-chord tones fall on weak beats
31
+ # - Smooth chromatic connection between 5 and 6
32
+ #
33
+ # ## Musical Character
34
+ #
35
+ # The bebop major scale:
36
+ #
37
+ # - Used over major 7th and major 6th chords
38
+ # - Creates flowing eighth-note lines
39
+ # - Common in bebop and jazz standards
40
+ #
41
+ # ## Usage
42
+ #
43
+ # c_bebop_maj = Scales[:et12][440.0][:bebop_major][60]
44
+ # c_bebop_maj[4].pitch # G (67) - perfect 5th
45
+ # c_bebop_maj[5].pitch # G# (68) - augmented 5th (passing)
46
+ # c_bebop_maj[6].pitch # A (69) - major 6th
47
+ #
48
+ # @see ScaleKind Abstract base class
49
+ # @see MajorScaleKind Major scale (7-note parent)
50
+ # @see BebopDominantScaleKind Bebop dominant scale
51
+ class BebopMajorScaleKind < ScaleKind
52
+ @base_metadata = {
53
+ family: :bebop,
54
+ brightness: 0,
55
+ character: [:jazz, :chromatic_passing, :major],
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[V# _6 sixth],
72
+ pitch: 8 },
73
+ { functions: %i[VI _7 submediant seventh],
74
+ pitch: 9 },
75
+ { functions: %i[VII _8 leading eighth],
76
+ pitch: 11 },
77
+ { functions: %i[VIII _9 ninth],
78
+ pitch: 12 },
79
+ { functions: %i[IX _10 tenth],
80
+ pitch: 12 + 2 },
81
+ { functions: %i[X _11 eleventh],
82
+ pitch: 12 + 4 },
83
+ { functions: %i[XI _12 twelfth],
84
+ pitch: 12 + 5 },
85
+ { functions: %i[XII _13 thirteenth],
86
+ pitch: 12 + 7 },
87
+ { functions: %i[XII# _14 fourteenth],
88
+ pitch: 12 + 8 },
89
+ { functions: %i[XIII _15 fifteenth],
90
+ pitch: 12 + 9 },
91
+ { functions: %i[XIV _16 sixteenth],
92
+ pitch: 12 + 11 }].freeze
93
+
94
+ def pitches
95
+ @@pitches
96
+ end
97
+
98
+ def grades
99
+ 8
100
+ end
101
+
102
+ def id
103
+ :bebop_major
104
+ end
105
+ end
106
+
107
+ EquallyTempered12ToneScaleSystem.register BebopMajorScaleKind
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Bebop minor scale kind.
6
+ #
7
+ # BebopMinorScaleKind defines the bebop minor scale, an eight-note
8
+ # scale that adds a chromatic passing tone (major 7th) to the Dorian
9
+ # mode. This allows chord tones to fall on downbeats during eighth-note runs.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 8 degrees plus extended:
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)
20
+ # - **iv** (subdominant): Perfect fourth (5 semitones)
21
+ # - **v** (dominant): Perfect fifth (7 semitones)
22
+ # - **vi** (submediant): Major sixth (9 semitones) ← DORIAN
23
+ # - **vii** (subtonic): Minor seventh (10 semitones)
24
+ # - **vii#** (leading): Major seventh (11 semitones) ← PASSING TONE
25
+ #
26
+ # ## Bebop Principle
27
+ #
28
+ # The added major 7th chromatic note ensures that:
29
+ # - Chord tones (1, b3, 5, b7) fall on strong beats
30
+ # - Non-chord tones fall on weak beats
31
+ # - Smooth chromatic connection from b7 to root
32
+ #
33
+ # ## Musical Character
34
+ #
35
+ # The bebop minor scale:
36
+ #
37
+ # - Used over minor 7th chords
38
+ # - Based on Dorian mode (bright minor)
39
+ # - Common in jazz ii-V-I progressions
40
+ #
41
+ # ## Usage
42
+ #
43
+ # d_bebop_min = Scales[:et12][440.0][:bebop_minor][62]
44
+ # d_bebop_min[6].pitch # C (72) - minor 7th
45
+ # d_bebop_min[7].pitch # C# (73) - major 7th (passing)
46
+ # d_bebop_min[8].pitch # D (74) - octave
47
+ #
48
+ # @see ScaleKind Abstract base class
49
+ # @see DorianScaleKind Dorian mode (7-note parent)
50
+ # @see BebopDominantScaleKind Bebop dominant scale
51
+ class BebopMinorScaleKind < ScaleKind
52
+ @base_metadata = {
53
+ family: :bebop,
54
+ brightness: -1,
55
+ character: [:jazz, :chromatic_passing, :minor],
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 subtonic seventh],
74
+ pitch: 10 },
75
+ { functions: %i[vii# _8 leading eighth],
76
+ pitch: 11 },
77
+ { functions: %i[viii _9 ninth],
78
+ pitch: 12 },
79
+ { functions: %i[ix _10 tenth],
80
+ pitch: 12 + 2 },
81
+ { functions: %i[x _11 eleventh],
82
+ pitch: 12 + 3 },
83
+ { functions: %i[xi _12 twelfth],
84
+ pitch: 12 + 5 },
85
+ { functions: %i[xii _13 thirteenth],
86
+ pitch: 12 + 7 },
87
+ { functions: %i[xiii _14 fourteenth],
88
+ pitch: 12 + 9 },
89
+ { functions: %i[xiv _15 fifteenth],
90
+ pitch: 12 + 10 },
91
+ { functions: %i[xv _16 sixteenth],
92
+ pitch: 12 + 11 }].freeze
93
+
94
+ def pitches
95
+ @@pitches
96
+ end
97
+
98
+ def grades
99
+ 8
100
+ end
101
+
102
+ def id
103
+ :bebop_minor
104
+ end
105
+ end
106
+
107
+ EquallyTempered12ToneScaleSystem.register BebopMinorScaleKind
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Musa
4
+ module Scales
5
+ # Major blues scale kind.
6
+ #
7
+ # BluesMajorScaleKind defines the major blues scale, a six-note scale
8
+ # that adds the "blue note" (b3) to the major pentatonic scale.
9
+ # It provides a brighter blues sound than the minor blues scale.
10
+ #
11
+ # ## Pitch Structure
12
+ #
13
+ # 6 degrees plus extended:
14
+ #
15
+ # **Scale Degrees** (uppercase for major quality):
16
+ #
17
+ # - **I** (tonic): Root (0 semitones)
18
+ # - **II** (supertonic): Major second (2 semitones)
19
+ # - **blue** (blue note): Minor third (3 semitones) ← CHARACTERISTIC
20
+ # - **III** (mediant): Major third (4 semitones)
21
+ # - **V** (dominant): Perfect fifth (7 semitones)
22
+ # - **VI** (submediant): Major sixth (9 semitones)
23
+ #
24
+ # ## The Blue Note
25
+ #
26
+ # The b3 (minor third) is the blue note in the major blues scale.
27
+ # It creates tension that resolves up to the major third, providing
28
+ # the characteristic "bend" sound in blues guitar and vocals.
29
+ #
30
+ # ## Musical Character
31
+ #
32
+ # The major blues scale:
33
+ #
34
+ # - Brighter alternative to minor blues
35
+ # - Works well over major and dominant 7th chords
36
+ # - Common in country blues and jazz
37
+ # - The b3 to natural 3 movement is essential
38
+ #
39
+ # ## Usage
40
+ #
41
+ # c_blues_maj = Scales[:et12][440.0][:blues_major][60]
42
+ # c_blues_maj.tonic # C (60)
43
+ # c_blues_maj.blue # Eb (63) - the blue note
44
+ # c_blues_maj.mediant # E (64) - major third
45
+ #
46
+ # @see ScaleKind Abstract base class
47
+ # @see PentatonicMajorScaleKind Major pentatonic (without blue note)
48
+ # @see BluesScaleKind Minor blues scale
49
+ class BluesMajorScaleKind < ScaleKind
50
+ @base_metadata = {
51
+ family: :blues,
52
+ brightness: 0,
53
+ character: [:bluesy, :gospel, :major],
54
+ parent: nil
55
+ }.freeze
56
+
57
+ class << self
58
+ @@pitches =
59
+ [{ functions: %i[I _1 tonic first],
60
+ pitch: 0 },
61
+ { functions: %i[II _2 supertonic second],
62
+ pitch: 2 },
63
+ { functions: %i[blue _3 third],
64
+ pitch: 3 },
65
+ { functions: %i[III _4 mediant fourth],
66
+ pitch: 4 },
67
+ { functions: %i[V _5 dominant fifth],
68
+ pitch: 7 },
69
+ { functions: %i[VI _6 submediant sixth],
70
+ pitch: 9 },
71
+ { functions: %i[VIII _7 seventh],
72
+ pitch: 12 },
73
+ { functions: %i[IX _8 eighth],
74
+ pitch: 12 + 2 },
75
+ { functions: %i[blue2 _9 ninth],
76
+ pitch: 12 + 3 },
77
+ { functions: %i[X _10 tenth],
78
+ pitch: 12 + 4 },
79
+ { functions: %i[XII _11 eleventh],
80
+ pitch: 12 + 7 },
81
+ { functions: %i[XIII _12 twelfth],
82
+ pitch: 12 + 9 }].freeze
83
+
84
+ def pitches
85
+ @@pitches
86
+ end
87
+
88
+ def grades
89
+ 6
90
+ end
91
+
92
+ def id
93
+ :blues_major
94
+ end
95
+ end
96
+
97
+ EquallyTempered12ToneScaleSystem.register BluesMajorScaleKind
98
+ end
99
+ end
100
+ end