Mystic::Scale
Represents a scale
A scale consists of a tonic note, type, and array of Intervals.
To create a scale:
# C major scale
Scale.new(Note.new("C"), "major")
# Can create a custom scale by supplying the intervals
Scale.new(Note.new("C"), "my custom scale", [Interval.new("M2"), Interval.new("M3")])
Constants
SCALE_ALIASES = {
ionian: "major",
aeolian: "minor",
"natural minor": "minor",
}
SCALE_INTERVALS = {
major: [WS, WS, HS, WS, WS, WS],
minor: [WS, HS, WS, WS, HS, WS],
"melodic minor": [WS, HS, WS, WS, WS, WS],
dorian: [WS, HS, WS, WS, WS, HS, WS],
phrygian: [HS, WS, WS, WS, HS, WS, WS],
lydian: [WS, WS, WS, HS, WS, WS, HS],
mixolydian: [WS, WS, HS, WS, WS, HS, WS],
locrian: [HS, WS, WS, HS, WS, WS, WS],
}
Constructors
Instance methods
intervals
Sourcename(include_octave = false) : String
Returns the name of the scale
For example: "C major"
If include_octave is true, will include the octave as part of the tonic note (e.g. "C4 major")
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>
tonic
Sourcetype
Source