class Mystic::Scale
- Mystic::Scale
- Reference
- Object
Overview
Represents a scale
A scale consists of a tonic note, type, and array of Interval
s.
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")])
Defined in:
mystic/scale.crConstant Summary
-
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
- .new(tonic : Mystic::Note, type : String, intervals : Array(Mystic::Interval))
- .new(tonic_type : String, type : String)
- .new(tonic : Mystic::Note, type : String)
Instance Method Summary
-
#+(interval : Interval) : Scale
Returns a new scale transposed by the given interval
- #intervals : Array(Interval)
-
#name(include_octave = false) : String
Returns the name of the scale
-
#note_names : Array(String)
Returns the note names
-
#notes : Array(Note)
Returns the notes of the scale
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
- #tonic : Note
- #type : String
Constructor Detail
Instance Method Detail
Returns a new scale transposed by the given interval
def name(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")
def to_s(io : IO) : Nil
#
Description copied from class Reference
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>