Skip to content

Commit 99f998b

Browse files
committed
Add a General Minor scale
1 parent dd0039c commit 99f998b

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

scale_filter_generator.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
require 'fileutils'
22
require 'zlib'
33
require 'shellwords'
4+
require './scale_filter_note'
45
require './scale_filter_device'
56

67
class ScaleFilterGenerator
78
SCALE_NAMES = {
89
major: "Major (Ionian)",
910
natural_minor: "Natural Minor (Aeolian)",
11+
general_minor: "General Minor (Aeolian+Harmonic+Melodic)",
1012
dorian: "Dorian",
1113
phrygian: "Phrygian",
1214
lydian: "Lydian",
@@ -27,11 +29,11 @@ class ScaleFilterGenerator
2729

2830
class << self
2931
def flat_note_name(note)
30-
Note.flat_twelve_tones[note.value % 12]
32+
ScaleFilterNote.flat_twelve_tones[note.value % 12]
3133
end
3234

3335
def note_label(note_number)
34-
note = Note.new(note_number)
36+
note = ScaleFilterNote.new(note_number)
3537
octave = (note_number/12) - 2
3638
"\u2666 #{note.name}#{octave}"
3739
end
@@ -53,7 +55,7 @@ def generate_all
5355
path = "./output/Scale Filters/#{scale_name}"
5456
FileUtils.mkdir_p(path)
5557
12.times do |note_number|
56-
root_note = Note.new(note_number)
58+
root_note = ScaleFilterNote.new(note_number)
5759
scale = root_note.send("#{scale_identifier}_scale")
5860
generate_filter(path, "#{root_note.name} #{scale_name} Scale Filter", scale)
5961
generate_filter(path, "#{flat_note_name(root_note)} #{scale_name} Scale Filter", scale) unless root_note.name == flat_note_name(root_note)

scale_filter_note.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require './scale_filter_note_interval'
2+
3+
class ScaleFilterNote < Note
4+
def general_minor_scale
5+
intervals = ScaleFilterNoteInterval.general_minor_set
6+
Scale.new(self, intervals)
7+
end
8+
end

scale_filter_note_interval.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class ScaleFilterNoteInterval < NoteInterval
2+
def self.general_minor_set
3+
sets = NoteInterval::SCALE_SETS
4+
set = sets[:aeolian] | sets[:harmonic_minor] | sets[:melodic_minor]
5+
set.map { |n| NoteInterval.new(n) }
6+
end
7+
end

0 commit comments

Comments
 (0)