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.
- checksums.yaml +4 -4
- data/.gitignore +5 -1
- data/.version +6 -0
- data/.yardopts +7 -0
- data/Gemfile +0 -1
- data/README.md +227 -6
- data/docs/README.md +83 -0
- data/docs/api-reference.md +86 -0
- data/docs/getting-started/quick-start.md +93 -0
- data/docs/getting-started/tutorial.md +58 -0
- data/docs/subsystems/core-extensions.md +316 -0
- data/docs/subsystems/datasets.md +465 -0
- data/docs/subsystems/generative.md +290 -0
- data/docs/subsystems/matrix.md +63 -0
- data/docs/subsystems/midi.md +123 -0
- data/docs/subsystems/music.md +544 -0
- data/docs/subsystems/musicxml-builder.md +264 -0
- data/docs/subsystems/neumas.md +71 -0
- data/docs/subsystems/repl.md +135 -0
- data/docs/subsystems/sequencer.md +98 -0
- data/docs/subsystems/series.md +302 -0
- data/docs/subsystems/transcription.md +152 -0
- data/docs/subsystems/transport.md +177 -0
- data/lib/musa-dsl/core-ext/array-explode-ranges.rb +68 -0
- data/lib/musa-dsl/core-ext/arrayfy.rb +110 -0
- data/lib/musa-dsl/core-ext/attribute-builder.rb +91 -30
- data/lib/musa-dsl/core-ext/deep-copy.rb +125 -2
- data/lib/musa-dsl/core-ext/dynamic-proxy.rb +78 -0
- data/lib/musa-dsl/core-ext/extension.rb +53 -0
- data/lib/musa-dsl/core-ext/hashify.rb +162 -1
- data/lib/musa-dsl/core-ext/inspect-nice.rb +154 -0
- data/lib/musa-dsl/core-ext/smart-proc-binder.rb +117 -0
- data/lib/musa-dsl/core-ext/with.rb +114 -0
- data/lib/musa-dsl/datasets/dataset.rb +109 -0
- data/lib/musa-dsl/datasets/delta-d.rb +78 -0
- data/lib/musa-dsl/datasets/e.rb +186 -2
- data/lib/musa-dsl/datasets/gdv.rb +279 -2
- data/lib/musa-dsl/datasets/gdvd.rb +201 -0
- data/lib/musa-dsl/datasets/helper.rb +75 -0
- data/lib/musa-dsl/datasets/p.rb +177 -2
- data/lib/musa-dsl/datasets/packed-v.rb +91 -0
- data/lib/musa-dsl/datasets/pdv.rb +136 -1
- data/lib/musa-dsl/datasets/ps.rb +134 -4
- data/lib/musa-dsl/datasets/score/queriable.rb +143 -1
- data/lib/musa-dsl/datasets/score/render.rb +105 -1
- data/lib/musa-dsl/datasets/score/to-mxml/process-pdv.rb +138 -1
- data/lib/musa-dsl/datasets/score/to-mxml/process-ps.rb +111 -0
- data/lib/musa-dsl/datasets/score/to-mxml/process-time.rb +200 -1
- data/lib/musa-dsl/datasets/score/to-mxml/to-mxml.rb +145 -1
- data/lib/musa-dsl/datasets/score.rb +279 -0
- data/lib/musa-dsl/datasets/v.rb +88 -0
- data/lib/musa-dsl/generative/darwin.rb +215 -1
- data/lib/musa-dsl/generative/generative-grammar.rb +387 -0
- data/lib/musa-dsl/generative/markov.rb +135 -3
- data/lib/musa-dsl/generative/rules.rb +312 -4
- data/lib/musa-dsl/generative/variatio.rb +286 -2
- data/lib/musa-dsl/logger/logger.rb +267 -2
- data/lib/musa-dsl/matrix/matrix.rb +256 -10
- data/lib/musa-dsl/midi/midi-recorder.rb +113 -2
- data/lib/musa-dsl/midi/midi-voices.rb +275 -4
- data/lib/musa-dsl/music/chord-definition.rb +233 -1
- data/lib/musa-dsl/music/chord-definitions.rb +33 -6
- data/lib/musa-dsl/music/chords.rb +353 -2
- data/lib/musa-dsl/music/equally-tempered-12-tone-scale-system.rb +70 -206
- data/lib/musa-dsl/music/scale_kinds/bebop/bebop_dominant_scale_kind.rb +110 -0
- data/lib/musa-dsl/music/scale_kinds/bebop/bebop_major_scale_kind.rb +110 -0
- data/lib/musa-dsl/music/scale_kinds/bebop/bebop_minor_scale_kind.rb +110 -0
- data/lib/musa-dsl/music/scale_kinds/blues/blues_major_scale_kind.rb +100 -0
- data/lib/musa-dsl/music/scale_kinds/blues/blues_scale_kind.rb +99 -0
- data/lib/musa-dsl/music/scale_kinds/chromatic_scale_kind.rb +79 -0
- data/lib/musa-dsl/music/scale_kinds/ethnic/double_harmonic_scale_kind.rb +102 -0
- data/lib/musa-dsl/music/scale_kinds/ethnic/hungarian_minor_scale_kind.rb +102 -0
- data/lib/musa-dsl/music/scale_kinds/ethnic/neapolitan_major_scale_kind.rb +102 -0
- data/lib/musa-dsl/music/scale_kinds/ethnic/neapolitan_minor_scale_kind.rb +101 -0
- data/lib/musa-dsl/music/scale_kinds/ethnic/phrygian_dominant_scale_kind.rb +103 -0
- data/lib/musa-dsl/music/scale_kinds/harmonic_major/harmonic_major_scale_kind.rb +104 -0
- data/lib/musa-dsl/music/scale_kinds/major_scale_kind.rb +110 -0
- data/lib/musa-dsl/music/scale_kinds/melodic_minor/altered_scale_kind.rb +106 -0
- data/lib/musa-dsl/music/scale_kinds/melodic_minor/dorian_b2_scale_kind.rb +104 -0
- data/lib/musa-dsl/music/scale_kinds/melodic_minor/locrian_sharp2_scale_kind.rb +103 -0
- data/lib/musa-dsl/music/scale_kinds/melodic_minor/lydian_augmented_scale_kind.rb +103 -0
- data/lib/musa-dsl/music/scale_kinds/melodic_minor/lydian_dominant_scale_kind.rb +106 -0
- data/lib/musa-dsl/music/scale_kinds/melodic_minor/melodic_minor_scale_kind.rb +104 -0
- data/lib/musa-dsl/music/scale_kinds/melodic_minor/mixolydian_b6_scale_kind.rb +103 -0
- data/lib/musa-dsl/music/scale_kinds/minor_harmonic_scale_kind.rb +125 -0
- data/lib/musa-dsl/music/scale_kinds/minor_natural_scale_kind.rb +123 -0
- data/lib/musa-dsl/music/scale_kinds/modes/dorian_scale_kind.rb +111 -0
- data/lib/musa-dsl/music/scale_kinds/modes/locrian_scale_kind.rb +114 -0
- data/lib/musa-dsl/music/scale_kinds/modes/lydian_scale_kind.rb +111 -0
- data/lib/musa-dsl/music/scale_kinds/modes/mixolydian_scale_kind.rb +111 -0
- data/lib/musa-dsl/music/scale_kinds/modes/phrygian_scale_kind.rb +111 -0
- data/lib/musa-dsl/music/scale_kinds/pentatonic/pentatonic_major_scale_kind.rb +93 -0
- data/lib/musa-dsl/music/scale_kinds/pentatonic/pentatonic_minor_scale_kind.rb +99 -0
- data/lib/musa-dsl/music/scale_kinds/symmetric/diminished_hw_scale_kind.rb +110 -0
- data/lib/musa-dsl/music/scale_kinds/symmetric/diminished_wh_scale_kind.rb +110 -0
- data/lib/musa-dsl/music/scale_kinds/symmetric/whole_tone_scale_kind.rb +99 -0
- data/lib/musa-dsl/music/scale_systems/equally_tempered_12_tone_scale_system.rb +80 -0
- data/lib/musa-dsl/music/scale_systems/twelve_semitones_scale_system.rb +60 -0
- data/lib/musa-dsl/music/scales.rb +1384 -40
- data/lib/musa-dsl/musicxml/builder/attributes.rb +483 -3
- data/lib/musa-dsl/musicxml/builder/backup-forward.rb +166 -1
- data/lib/musa-dsl/musicxml/builder/direction.rb +243 -0
- data/lib/musa-dsl/musicxml/builder/helper.rb +240 -0
- data/lib/musa-dsl/musicxml/builder/measure.rb +284 -0
- data/lib/musa-dsl/musicxml/builder/note-complexities.rb +324 -8
- data/lib/musa-dsl/musicxml/builder/note.rb +285 -0
- data/lib/musa-dsl/musicxml/builder/part-group.rb +108 -1
- data/lib/musa-dsl/musicxml/builder/part.rb +139 -0
- data/lib/musa-dsl/musicxml/builder/pitched-note.rb +124 -0
- data/lib/musa-dsl/musicxml/builder/rest.rb +93 -0
- data/lib/musa-dsl/musicxml/builder/score-partwise.rb +276 -0
- data/lib/musa-dsl/musicxml/builder/typed-text.rb +62 -1
- data/lib/musa-dsl/musicxml/builder/unpitched-note.rb +83 -0
- data/lib/musa-dsl/neumalang/neumalang.rb +675 -0
- data/lib/musa-dsl/neumas/array-to-neumas.rb +149 -0
- data/lib/musa-dsl/neumas/neuma-decoder.rb +253 -0
- data/lib/musa-dsl/neumas/neuma-gdv-decoder.rb +142 -2
- data/lib/musa-dsl/neumas/neuma-gdvd-decoder.rb +82 -0
- data/lib/musa-dsl/neumas/neumas.rb +67 -0
- data/lib/musa-dsl/neumas/string-to-neumas.rb +233 -1
- data/lib/musa-dsl/repl/repl.rb +550 -0
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-every.rb +118 -2
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-move.rb +149 -2
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +296 -0
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +88 -2
- data/lib/musa-dsl/sequencer/base-sequencer-implementation-play.rb +161 -0
- data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +263 -0
- data/lib/musa-dsl/sequencer/base-sequencer-tick-based.rb +173 -1
- data/lib/musa-dsl/sequencer/base-sequencer-tickless-based.rb +177 -0
- data/lib/musa-dsl/sequencer/base-sequencer.rb +710 -10
- data/lib/musa-dsl/sequencer/sequencer-dsl.rb +210 -0
- data/lib/musa-dsl/sequencer/timeslots.rb +79 -0
- data/lib/musa-dsl/series/array-to-serie.rb +37 -1
- data/lib/musa-dsl/series/base-series.rb +843 -5
- data/lib/musa-dsl/series/buffer-serie.rb +54 -0
- data/lib/musa-dsl/series/hash-or-array-serie-splitter.rb +64 -0
- data/lib/musa-dsl/series/main-serie-constructors.rb +398 -2
- data/lib/musa-dsl/series/main-serie-operations.rb +538 -16
- data/lib/musa-dsl/series/proxy-serie.rb +67 -0
- data/lib/musa-dsl/series/quantizer-serie.rb +57 -7
- data/lib/musa-dsl/series/queue-serie.rb +78 -0
- data/lib/musa-dsl/series/series-composer.rb +701 -0
- data/lib/musa-dsl/series/timed-serie.rb +473 -28
- data/lib/musa-dsl/transcription/from-gdv-to-midi.rb +404 -1
- data/lib/musa-dsl/transcription/from-gdv-to-musicxml.rb +118 -0
- data/lib/musa-dsl/transcription/from-gdv.rb +84 -1
- data/lib/musa-dsl/transcription/transcription.rb +265 -0
- data/lib/musa-dsl/transport/clock.rb +125 -0
- data/lib/musa-dsl/transport/dummy-clock.rb +89 -2
- data/lib/musa-dsl/transport/external-tick-clock.rb +91 -0
- data/lib/musa-dsl/transport/input-midi-clock.rb +133 -1
- data/lib/musa-dsl/transport/timer-clock.rb +183 -1
- data/lib/musa-dsl/transport/timer.rb +83 -0
- data/lib/musa-dsl/transport/transport.rb +318 -0
- data/lib/musa-dsl/version.rb +2 -1
- data/lib/musa-dsl.rb +132 -25
- data/musa-dsl.gemspec +25 -18
- metadata +158 -16
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Musa
|
|
4
|
+
module Scales
|
|
5
|
+
# Locrian mode (seventh mode of major scale).
|
|
6
|
+
#
|
|
7
|
+
# LocrianScaleKind defines the Locrian mode, a diminished mode with a
|
|
8
|
+
# characteristic lowered second and fifth degrees. It's built on the
|
|
9
|
+
# seventh degree of the major scale and has an unstable, dissonant quality.
|
|
10
|
+
#
|
|
11
|
+
# ## Pitch Structure
|
|
12
|
+
#
|
|
13
|
+
# 7 diatonic degrees plus extended harmony (8th-13th):
|
|
14
|
+
#
|
|
15
|
+
# **Scale Degrees** (Roman numerals, lowercase for diminished):
|
|
16
|
+
#
|
|
17
|
+
# - **i** (tonic): Root (0 semitones)
|
|
18
|
+
# - **ii** (supertonic): **Minor second** (1 semitone) ← CHARACTERISTIC
|
|
19
|
+
# - **iii** (mediant): Minor third (3 semitones)
|
|
20
|
+
# - **iv** (subdominant): Perfect fourth (5 semitones)
|
|
21
|
+
# - **v** (dominant): **Diminished fifth** (6 semitones) ← CHARACTERISTIC
|
|
22
|
+
# - **vi** (submediant): Minor sixth (8 semitones)
|
|
23
|
+
# - **vii** (subtonic): Minor seventh (10 semitones)
|
|
24
|
+
#
|
|
25
|
+
# ## Key Differences from Natural Minor
|
|
26
|
+
#
|
|
27
|
+
# Two degrees are altered:
|
|
28
|
+
# - **ii** lowered from 2 to 1 semitone (minor second)
|
|
29
|
+
# - **v** lowered from 7 to 6 semitones (diminished fifth/tritone)
|
|
30
|
+
#
|
|
31
|
+
# This creates:
|
|
32
|
+
# - A highly unstable, dissonant quality
|
|
33
|
+
# - No stable perfect fifth above the tonic
|
|
34
|
+
# - Rarely used as a tonal center
|
|
35
|
+
#
|
|
36
|
+
# ## Musical Character
|
|
37
|
+
#
|
|
38
|
+
# The Locrian mode:
|
|
39
|
+
#
|
|
40
|
+
# - Has diminished quality (minor third + diminished fifth)
|
|
41
|
+
# - The most unstable of the seven modes
|
|
42
|
+
# - Used sparingly, often for tension or dissonance
|
|
43
|
+
# - Common over half-diminished (m7b5) chords in jazz
|
|
44
|
+
#
|
|
45
|
+
# ## Usage
|
|
46
|
+
#
|
|
47
|
+
# b_locrian = Scales[:et12][440.0][:locrian][71]
|
|
48
|
+
# b_locrian.tonic # B (71)
|
|
49
|
+
# b_locrian.ii # C (72) - minor second (characteristic)
|
|
50
|
+
# b_locrian.v # F (77) - diminished fifth (characteristic)
|
|
51
|
+
#
|
|
52
|
+
# @see ScaleKind Abstract base class
|
|
53
|
+
# @see MinorNaturalScaleKind Natural minor
|
|
54
|
+
# @see PhrygianScaleKind Phrygian mode (also has minor 2nd)
|
|
55
|
+
class LocrianScaleKind < ScaleKind
|
|
56
|
+
@base_metadata = {
|
|
57
|
+
family: :greek_modes,
|
|
58
|
+
brightness: -3,
|
|
59
|
+
character: [:unstable, :diminished, :tense],
|
|
60
|
+
parent: { scale: :major, degree: 7 }
|
|
61
|
+
}.freeze
|
|
62
|
+
|
|
63
|
+
class << self
|
|
64
|
+
@@pitches =
|
|
65
|
+
[{ functions: %i[i _1 tonic first],
|
|
66
|
+
pitch: 0 },
|
|
67
|
+
{ functions: %i[ii _2 supertonic second],
|
|
68
|
+
pitch: 1 },
|
|
69
|
+
{ functions: %i[iii _3 mediant third],
|
|
70
|
+
pitch: 3 },
|
|
71
|
+
{ functions: %i[iv _4 subdominant fourth],
|
|
72
|
+
pitch: 5 },
|
|
73
|
+
{ functions: %i[v _5 dominant fifth],
|
|
74
|
+
pitch: 6 },
|
|
75
|
+
{ functions: %i[vi _6 submediant sixth],
|
|
76
|
+
pitch: 8 },
|
|
77
|
+
{ functions: %i[vii _7 subtonic seventh],
|
|
78
|
+
pitch: 10 },
|
|
79
|
+
{ functions: %i[viii _8 eighth],
|
|
80
|
+
pitch: 12 },
|
|
81
|
+
{ functions: %i[ix _9 ninth],
|
|
82
|
+
pitch: 12 + 1 },
|
|
83
|
+
{ functions: %i[x _10 tenth],
|
|
84
|
+
pitch: 12 + 3 },
|
|
85
|
+
{ functions: %i[xi _11 eleventh],
|
|
86
|
+
pitch: 12 + 5 },
|
|
87
|
+
{ functions: %i[xii _12 twelfth],
|
|
88
|
+
pitch: 12 + 6 },
|
|
89
|
+
{ functions: %i[xiii _13 thirteenth],
|
|
90
|
+
pitch: 12 + 8 }].freeze
|
|
91
|
+
|
|
92
|
+
# Pitch structure.
|
|
93
|
+
# @return [Array<Hash>] pitch definitions with functions and offsets
|
|
94
|
+
def pitches
|
|
95
|
+
@@pitches
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Number of diatonic degrees.
|
|
99
|
+
# @return [Integer] 7
|
|
100
|
+
def grades
|
|
101
|
+
7
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Scale kind identifier.
|
|
105
|
+
# @return [Symbol] :locrian
|
|
106
|
+
def id
|
|
107
|
+
:locrian
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
EquallyTempered12ToneScaleSystem.register LocrianScaleKind
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Musa
|
|
4
|
+
module Scales
|
|
5
|
+
# Lydian mode (fourth mode of major scale).
|
|
6
|
+
#
|
|
7
|
+
# LydianScaleKind defines the Lydian mode, a major mode with a characteristic
|
|
8
|
+
# raised fourth degree. It's built on the fourth degree of the major scale
|
|
9
|
+
# and has a bright, dreamy, floating quality.
|
|
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): **Augmented fourth** (6 semitones) ← CHARACTERISTIC
|
|
21
|
+
# - **V** (dominant): Perfect fifth (7 semitones)
|
|
22
|
+
# - **VI** (submediant): Major sixth (9 semitones)
|
|
23
|
+
# - **VII** (leading): Major seventh (11 semitones)
|
|
24
|
+
#
|
|
25
|
+
# ## Key Difference from Major
|
|
26
|
+
#
|
|
27
|
+
# The **IV** degree is raised from 5 semitones (perfect fourth) to
|
|
28
|
+
# 6 semitones (augmented fourth/tritone), creating:
|
|
29
|
+
#
|
|
30
|
+
# - A bright, ethereal quality
|
|
31
|
+
# - The characteristic "Lydian color"
|
|
32
|
+
# - A sense of floating or suspension
|
|
33
|
+
#
|
|
34
|
+
# ## Musical Character
|
|
35
|
+
#
|
|
36
|
+
# The Lydian mode:
|
|
37
|
+
#
|
|
38
|
+
# - Maintains major quality (major third)
|
|
39
|
+
# - Has a raised 4th that adds brightness and tension
|
|
40
|
+
# - Common in film scores and jazz (especially over maj7#11 chords)
|
|
41
|
+
# - Creates a dreamy, otherworldly atmosphere
|
|
42
|
+
#
|
|
43
|
+
# ## Usage
|
|
44
|
+
#
|
|
45
|
+
# f_lydian = Scales[:et12][440.0][:lydian][65]
|
|
46
|
+
# f_lydian.tonic # F (65)
|
|
47
|
+
# f_lydian.IV # B (71) - augmented fourth (characteristic)
|
|
48
|
+
#
|
|
49
|
+
# @see ScaleKind Abstract base class
|
|
50
|
+
# @see MajorScaleKind Major scale (with perfect 4th)
|
|
51
|
+
# @see MixolydianScaleKind Mixolydian mode
|
|
52
|
+
class LydianScaleKind < ScaleKind
|
|
53
|
+
@base_metadata = {
|
|
54
|
+
family: :greek_modes,
|
|
55
|
+
brightness: 2,
|
|
56
|
+
character: [:bright, :dreamy, :floating],
|
|
57
|
+
parent: { scale: :major, degree: 4 }
|
|
58
|
+
}.freeze
|
|
59
|
+
|
|
60
|
+
class << self
|
|
61
|
+
@@pitches =
|
|
62
|
+
[{ functions: %i[I _1 tonic first],
|
|
63
|
+
pitch: 0 },
|
|
64
|
+
{ functions: %i[II _2 supertonic second],
|
|
65
|
+
pitch: 2 },
|
|
66
|
+
{ functions: %i[III _3 mediant third],
|
|
67
|
+
pitch: 4 },
|
|
68
|
+
{ functions: %i[IV _4 subdominant fourth],
|
|
69
|
+
pitch: 6 },
|
|
70
|
+
{ functions: %i[V _5 dominant fifth],
|
|
71
|
+
pitch: 7 },
|
|
72
|
+
{ functions: %i[VI _6 submediant sixth],
|
|
73
|
+
pitch: 9 },
|
|
74
|
+
{ functions: %i[VII _7 leading seventh],
|
|
75
|
+
pitch: 11 },
|
|
76
|
+
{ functions: %i[VIII _8 eighth],
|
|
77
|
+
pitch: 12 },
|
|
78
|
+
{ functions: %i[IX _9 ninth],
|
|
79
|
+
pitch: 12 + 2 },
|
|
80
|
+
{ functions: %i[X _10 tenth],
|
|
81
|
+
pitch: 12 + 4 },
|
|
82
|
+
{ functions: %i[XI _11 eleventh],
|
|
83
|
+
pitch: 12 + 6 },
|
|
84
|
+
{ functions: %i[XII _12 twelfth],
|
|
85
|
+
pitch: 12 + 7 },
|
|
86
|
+
{ functions: %i[XIII _13 thirteenth],
|
|
87
|
+
pitch: 12 + 9 }].freeze
|
|
88
|
+
|
|
89
|
+
# Pitch structure.
|
|
90
|
+
# @return [Array<Hash>] pitch definitions with functions and offsets
|
|
91
|
+
def pitches
|
|
92
|
+
@@pitches
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Number of diatonic degrees.
|
|
96
|
+
# @return [Integer] 7
|
|
97
|
+
def grades
|
|
98
|
+
7
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Scale kind identifier.
|
|
102
|
+
# @return [Symbol] :lydian
|
|
103
|
+
def id
|
|
104
|
+
:lydian
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
EquallyTempered12ToneScaleSystem.register LydianScaleKind
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Musa
|
|
4
|
+
module Scales
|
|
5
|
+
# Mixolydian mode (fifth mode of major scale).
|
|
6
|
+
#
|
|
7
|
+
# MixolydianScaleKind defines the Mixolydian mode, a major mode with a
|
|
8
|
+
# characteristic lowered seventh degree. It's built on the fifth degree
|
|
9
|
+
# of the major scale and has a bluesy, rock quality.
|
|
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)
|
|
23
|
+
# - **VII** (subtonic): **Minor seventh** (10 semitones) ← CHARACTERISTIC
|
|
24
|
+
#
|
|
25
|
+
# ## Key Difference from Major
|
|
26
|
+
#
|
|
27
|
+
# The **VII** degree is lowered from 11 semitones (major seventh) to
|
|
28
|
+
# 10 semitones (minor seventh), creating:
|
|
29
|
+
#
|
|
30
|
+
# - A bluesy, rock quality
|
|
31
|
+
# - The characteristic "Mixolydian color"
|
|
32
|
+
# - Natural dominant seventh sound
|
|
33
|
+
#
|
|
34
|
+
# ## Musical Character
|
|
35
|
+
#
|
|
36
|
+
# The Mixolydian mode:
|
|
37
|
+
#
|
|
38
|
+
# - Maintains major quality (major third)
|
|
39
|
+
# - Has a lowered 7th that removes the leading tone tension
|
|
40
|
+
# - Common in rock, blues, funk, and folk music
|
|
41
|
+
# - Natural mode for dominant seventh chords
|
|
42
|
+
#
|
|
43
|
+
# ## Usage
|
|
44
|
+
#
|
|
45
|
+
# g_mixolydian = Scales[:et12][440.0][:mixolydian][67]
|
|
46
|
+
# g_mixolydian.tonic # G (67)
|
|
47
|
+
# g_mixolydian.VII # F (77) - minor seventh (characteristic)
|
|
48
|
+
#
|
|
49
|
+
# @see ScaleKind Abstract base class
|
|
50
|
+
# @see MajorScaleKind Major scale (with major 7th)
|
|
51
|
+
# @see LydianScaleKind Lydian mode
|
|
52
|
+
class MixolydianScaleKind < ScaleKind
|
|
53
|
+
@base_metadata = {
|
|
54
|
+
family: :greek_modes,
|
|
55
|
+
brightness: 1,
|
|
56
|
+
character: [:bluesy, :rock, :dominant],
|
|
57
|
+
parent: { scale: :major, degree: 5 }
|
|
58
|
+
}.freeze
|
|
59
|
+
|
|
60
|
+
class << self
|
|
61
|
+
@@pitches =
|
|
62
|
+
[{ functions: %i[I _1 tonic first],
|
|
63
|
+
pitch: 0 },
|
|
64
|
+
{ functions: %i[II _2 supertonic second],
|
|
65
|
+
pitch: 2 },
|
|
66
|
+
{ functions: %i[III _3 mediant third],
|
|
67
|
+
pitch: 4 },
|
|
68
|
+
{ functions: %i[IV _4 subdominant fourth],
|
|
69
|
+
pitch: 5 },
|
|
70
|
+
{ functions: %i[V _5 dominant fifth],
|
|
71
|
+
pitch: 7 },
|
|
72
|
+
{ functions: %i[VI _6 submediant sixth],
|
|
73
|
+
pitch: 9 },
|
|
74
|
+
{ functions: %i[VII _7 subtonic seventh],
|
|
75
|
+
pitch: 10 },
|
|
76
|
+
{ functions: %i[VIII _8 eighth],
|
|
77
|
+
pitch: 12 },
|
|
78
|
+
{ functions: %i[IX _9 ninth],
|
|
79
|
+
pitch: 12 + 2 },
|
|
80
|
+
{ functions: %i[X _10 tenth],
|
|
81
|
+
pitch: 12 + 4 },
|
|
82
|
+
{ functions: %i[XI _11 eleventh],
|
|
83
|
+
pitch: 12 + 5 },
|
|
84
|
+
{ functions: %i[XII _12 twelfth],
|
|
85
|
+
pitch: 12 + 7 },
|
|
86
|
+
{ functions: %i[XIII _13 thirteenth],
|
|
87
|
+
pitch: 12 + 9 }].freeze
|
|
88
|
+
|
|
89
|
+
# Pitch structure.
|
|
90
|
+
# @return [Array<Hash>] pitch definitions with functions and offsets
|
|
91
|
+
def pitches
|
|
92
|
+
@@pitches
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Number of diatonic degrees.
|
|
96
|
+
# @return [Integer] 7
|
|
97
|
+
def grades
|
|
98
|
+
7
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Scale kind identifier.
|
|
102
|
+
# @return [Symbol] :mixolydian
|
|
103
|
+
def id
|
|
104
|
+
:mixolydian
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
EquallyTempered12ToneScaleSystem.register MixolydianScaleKind
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Musa
|
|
4
|
+
module Scales
|
|
5
|
+
# Phrygian mode (third mode of major scale).
|
|
6
|
+
#
|
|
7
|
+
# PhrygianScaleKind defines the Phrygian mode, a minor mode with a characteristic
|
|
8
|
+
# lowered second degree. It's built on the third degree of the major scale
|
|
9
|
+
# and has a dark, exotic, Spanish/Middle Eastern quality.
|
|
10
|
+
#
|
|
11
|
+
# ## Pitch Structure
|
|
12
|
+
#
|
|
13
|
+
# 7 diatonic degrees plus extended harmony (8th-13th):
|
|
14
|
+
#
|
|
15
|
+
# **Scale Degrees** (Roman numerals, lowercase for minor):
|
|
16
|
+
#
|
|
17
|
+
# - **i** (tonic): Root (0 semitones)
|
|
18
|
+
# - **ii** (supertonic): **Minor second** (1 semitone) ← CHARACTERISTIC
|
|
19
|
+
# - **iii** (mediant): Minor third (3 semitones)
|
|
20
|
+
# - **iv** (subdominant): Perfect fourth (5 semitones)
|
|
21
|
+
# - **v** (dominant): Perfect fifth (7 semitones)
|
|
22
|
+
# - **vi** (submediant): Minor sixth (8 semitones)
|
|
23
|
+
# - **vii** (subtonic): Minor seventh (10 semitones)
|
|
24
|
+
#
|
|
25
|
+
# ## Key Difference from Natural Minor
|
|
26
|
+
#
|
|
27
|
+
# The **ii** degree is lowered from 2 semitones (major second) to
|
|
28
|
+
# 1 semitone (minor second), creating:
|
|
29
|
+
#
|
|
30
|
+
# - A dark, exotic quality
|
|
31
|
+
# - The characteristic "Phrygian color"
|
|
32
|
+
# - Strong association with Spanish/Flamenco music
|
|
33
|
+
#
|
|
34
|
+
# ## Musical Character
|
|
35
|
+
#
|
|
36
|
+
# The Phrygian mode:
|
|
37
|
+
#
|
|
38
|
+
# - Maintains minor quality (minor third)
|
|
39
|
+
# - Has a lowered 2nd that creates tension
|
|
40
|
+
# - Common in flamenco, metal, and Middle Eastern music
|
|
41
|
+
# - The half-step from ii to i creates strong resolution
|
|
42
|
+
#
|
|
43
|
+
# ## Usage
|
|
44
|
+
#
|
|
45
|
+
# e_phrygian = Scales[:et12][440.0][:phrygian][64]
|
|
46
|
+
# e_phrygian.tonic # E (64)
|
|
47
|
+
# e_phrygian.ii # F (65) - minor second (characteristic)
|
|
48
|
+
#
|
|
49
|
+
# @see ScaleKind Abstract base class
|
|
50
|
+
# @see MinorNaturalScaleKind Natural minor (with major 2nd)
|
|
51
|
+
# @see DorianScaleKind Dorian mode
|
|
52
|
+
class PhrygianScaleKind < ScaleKind
|
|
53
|
+
@base_metadata = {
|
|
54
|
+
family: :greek_modes,
|
|
55
|
+
brightness: -2,
|
|
56
|
+
character: [:dark, :spanish, :exotic],
|
|
57
|
+
parent: { scale: :major, degree: 3 }
|
|
58
|
+
}.freeze
|
|
59
|
+
|
|
60
|
+
class << self
|
|
61
|
+
@@pitches =
|
|
62
|
+
[{ functions: %i[i _1 tonic first],
|
|
63
|
+
pitch: 0 },
|
|
64
|
+
{ functions: %i[ii _2 supertonic second],
|
|
65
|
+
pitch: 1 },
|
|
66
|
+
{ functions: %i[iii _3 mediant third],
|
|
67
|
+
pitch: 3 },
|
|
68
|
+
{ functions: %i[iv _4 subdominant fourth],
|
|
69
|
+
pitch: 5 },
|
|
70
|
+
{ functions: %i[v _5 dominant fifth],
|
|
71
|
+
pitch: 7 },
|
|
72
|
+
{ functions: %i[vi _6 submediant sixth],
|
|
73
|
+
pitch: 8 },
|
|
74
|
+
{ functions: %i[vii _7 subtonic seventh],
|
|
75
|
+
pitch: 10 },
|
|
76
|
+
{ functions: %i[viii _8 eighth],
|
|
77
|
+
pitch: 12 },
|
|
78
|
+
{ functions: %i[ix _9 ninth],
|
|
79
|
+
pitch: 12 + 1 },
|
|
80
|
+
{ functions: %i[x _10 tenth],
|
|
81
|
+
pitch: 12 + 3 },
|
|
82
|
+
{ functions: %i[xi _11 eleventh],
|
|
83
|
+
pitch: 12 + 5 },
|
|
84
|
+
{ functions: %i[xii _12 twelfth],
|
|
85
|
+
pitch: 12 + 7 },
|
|
86
|
+
{ functions: %i[xiii _13 thirteenth],
|
|
87
|
+
pitch: 12 + 8 }].freeze
|
|
88
|
+
|
|
89
|
+
# Pitch structure.
|
|
90
|
+
# @return [Array<Hash>] pitch definitions with functions and offsets
|
|
91
|
+
def pitches
|
|
92
|
+
@@pitches
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Number of diatonic degrees.
|
|
96
|
+
# @return [Integer] 7
|
|
97
|
+
def grades
|
|
98
|
+
7
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Scale kind identifier.
|
|
102
|
+
# @return [Symbol] :phrygian
|
|
103
|
+
def id
|
|
104
|
+
:phrygian
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
EquallyTempered12ToneScaleSystem.register PhrygianScaleKind
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Musa
|
|
4
|
+
module Scales
|
|
5
|
+
# Major pentatonic scale kind.
|
|
6
|
+
#
|
|
7
|
+
# PentatonicMajorScaleKind defines the major pentatonic scale, a five-note
|
|
8
|
+
# scale derived from the major scale by omitting the 4th and 7th degrees.
|
|
9
|
+
# It has a bright, open sound and is extremely common in folk, rock, and blues.
|
|
10
|
+
#
|
|
11
|
+
# ## Pitch Structure
|
|
12
|
+
#
|
|
13
|
+
# 5 diatonic degrees plus extended (6th-10th):
|
|
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
|
+
# - **V** (dominant): Perfect fifth (7 semitones)
|
|
21
|
+
# - **VI** (submediant): Major sixth (9 semitones)
|
|
22
|
+
#
|
|
23
|
+
# ## Relationship to Major Scale
|
|
24
|
+
#
|
|
25
|
+
# Major pentatonic = Major scale minus 4th and 7th degrees.
|
|
26
|
+
# This removes all semitone intervals, creating a scale with no dissonance.
|
|
27
|
+
#
|
|
28
|
+
# ## Musical Character
|
|
29
|
+
#
|
|
30
|
+
# The major pentatonic:
|
|
31
|
+
#
|
|
32
|
+
# - Has a bright, happy, open quality
|
|
33
|
+
# - No semitones = no tension or dissonance
|
|
34
|
+
# - Universal across cultures (found in music worldwide)
|
|
35
|
+
# - Common in folk, country, rock, pop, and blues
|
|
36
|
+
#
|
|
37
|
+
# ## Usage
|
|
38
|
+
#
|
|
39
|
+
# c_pent = Scales[:et12][440.0][:pentatonic_major][60]
|
|
40
|
+
# c_pent.tonic # C (60)
|
|
41
|
+
# c_pent.dominant # G (67)
|
|
42
|
+
#
|
|
43
|
+
# @see ScaleKind Abstract base class
|
|
44
|
+
# @see MajorScaleKind Major scale
|
|
45
|
+
# @see PentatonicMinorScaleKind Minor pentatonic
|
|
46
|
+
class PentatonicMajorScaleKind < ScaleKind
|
|
47
|
+
@base_metadata = {
|
|
48
|
+
family: :pentatonic,
|
|
49
|
+
brightness: 1,
|
|
50
|
+
character: [:bright, :simple, :folk],
|
|
51
|
+
parent: nil
|
|
52
|
+
}.freeze
|
|
53
|
+
|
|
54
|
+
class << self
|
|
55
|
+
@@pitches =
|
|
56
|
+
[{ functions: %i[I _1 tonic first],
|
|
57
|
+
pitch: 0 },
|
|
58
|
+
{ functions: %i[II _2 supertonic second],
|
|
59
|
+
pitch: 2 },
|
|
60
|
+
{ functions: %i[III _3 mediant third],
|
|
61
|
+
pitch: 4 },
|
|
62
|
+
{ functions: %i[V _4 dominant fourth],
|
|
63
|
+
pitch: 7 },
|
|
64
|
+
{ functions: %i[VI _5 submediant fifth],
|
|
65
|
+
pitch: 9 },
|
|
66
|
+
{ functions: %i[VIII _6 sixth],
|
|
67
|
+
pitch: 12 },
|
|
68
|
+
{ functions: %i[IX _7 seventh],
|
|
69
|
+
pitch: 12 + 2 },
|
|
70
|
+
{ functions: %i[X _8 eighth],
|
|
71
|
+
pitch: 12 + 4 },
|
|
72
|
+
{ functions: %i[XII _9 ninth],
|
|
73
|
+
pitch: 12 + 7 },
|
|
74
|
+
{ functions: %i[XIII _10 tenth],
|
|
75
|
+
pitch: 12 + 9 }].freeze
|
|
76
|
+
|
|
77
|
+
def pitches
|
|
78
|
+
@@pitches
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def grades
|
|
82
|
+
5
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def id
|
|
86
|
+
:pentatonic_major
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
EquallyTempered12ToneScaleSystem.register PentatonicMajorScaleKind
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Musa
|
|
4
|
+
module Scales
|
|
5
|
+
# Minor pentatonic scale kind.
|
|
6
|
+
#
|
|
7
|
+
# PentatonicMinorScaleKind defines the minor pentatonic scale, a five-note
|
|
8
|
+
# scale derived from the natural minor scale by omitting the 2nd and 6th degrees.
|
|
9
|
+
# It's the foundation of blues and rock improvisation.
|
|
10
|
+
#
|
|
11
|
+
# ## Pitch Structure
|
|
12
|
+
#
|
|
13
|
+
# 5 diatonic degrees plus extended (6th-10th):
|
|
14
|
+
#
|
|
15
|
+
# **Scale Degrees** (Roman numerals, lowercase for minor):
|
|
16
|
+
#
|
|
17
|
+
# - **i** (tonic): Root (0 semitones)
|
|
18
|
+
# - **iii** (mediant): Minor third (3 semitones)
|
|
19
|
+
# - **iv** (subdominant): Perfect fourth (5 semitones)
|
|
20
|
+
# - **v** (dominant): Perfect fifth (7 semitones)
|
|
21
|
+
# - **vii** (subtonic): Minor seventh (10 semitones)
|
|
22
|
+
#
|
|
23
|
+
# ## Relationship to Natural Minor
|
|
24
|
+
#
|
|
25
|
+
# Minor pentatonic = Natural minor minus 2nd and 6th degrees.
|
|
26
|
+
# This removes all semitone intervals, creating a scale with no dissonance.
|
|
27
|
+
#
|
|
28
|
+
# ## Relative Major Pentatonic
|
|
29
|
+
#
|
|
30
|
+
# A minor pentatonic shares the same notes as C major pentatonic.
|
|
31
|
+
# They are relative scales.
|
|
32
|
+
#
|
|
33
|
+
# ## Musical Character
|
|
34
|
+
#
|
|
35
|
+
# The minor pentatonic:
|
|
36
|
+
#
|
|
37
|
+
# - Has a bluesy, soulful quality
|
|
38
|
+
# - Foundation of blues and rock guitar solos
|
|
39
|
+
# - Works over both minor and dominant 7th chords
|
|
40
|
+
# - Easy to improvise with (no "wrong" notes)
|
|
41
|
+
#
|
|
42
|
+
# ## Usage
|
|
43
|
+
#
|
|
44
|
+
# a_pent = Scales[:et12][440.0][:pentatonic_minor][69]
|
|
45
|
+
# a_pent.tonic # A (69)
|
|
46
|
+
# a_pent.dominant # E (76)
|
|
47
|
+
#
|
|
48
|
+
# @see ScaleKind Abstract base class
|
|
49
|
+
# @see MinorNaturalScaleKind Natural minor scale
|
|
50
|
+
# @see PentatonicMajorScaleKind Major pentatonic
|
|
51
|
+
# @see BluesScaleKind Blues scale (pentatonic + blue note)
|
|
52
|
+
class PentatonicMinorScaleKind < ScaleKind
|
|
53
|
+
@base_metadata = {
|
|
54
|
+
family: :pentatonic,
|
|
55
|
+
brightness: -1,
|
|
56
|
+
character: [:bluesy, :simple, :rock],
|
|
57
|
+
parent: nil
|
|
58
|
+
}.freeze
|
|
59
|
+
|
|
60
|
+
class << self
|
|
61
|
+
@@pitches =
|
|
62
|
+
[{ functions: %i[i _1 tonic first],
|
|
63
|
+
pitch: 0 },
|
|
64
|
+
{ functions: %i[iii _2 mediant second],
|
|
65
|
+
pitch: 3 },
|
|
66
|
+
{ functions: %i[iv _3 subdominant third],
|
|
67
|
+
pitch: 5 },
|
|
68
|
+
{ functions: %i[v _4 dominant fourth],
|
|
69
|
+
pitch: 7 },
|
|
70
|
+
{ functions: %i[vii _5 subtonic fifth],
|
|
71
|
+
pitch: 10 },
|
|
72
|
+
{ functions: %i[viii _6 sixth],
|
|
73
|
+
pitch: 12 },
|
|
74
|
+
{ functions: %i[x _7 seventh],
|
|
75
|
+
pitch: 12 + 3 },
|
|
76
|
+
{ functions: %i[xi _8 eighth],
|
|
77
|
+
pitch: 12 + 5 },
|
|
78
|
+
{ functions: %i[xii _9 ninth],
|
|
79
|
+
pitch: 12 + 7 },
|
|
80
|
+
{ functions: %i[xiv _10 tenth],
|
|
81
|
+
pitch: 12 + 10 }].freeze
|
|
82
|
+
|
|
83
|
+
def pitches
|
|
84
|
+
@@pitches
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def grades
|
|
88
|
+
5
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def id
|
|
92
|
+
:pentatonic_minor
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
EquallyTempered12ToneScaleSystem.register PentatonicMinorScaleKind
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|