class

Mystic::Scale

Inherits Reference < Object

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

new(tonic : Mystic::Note, type : String, intervals : Array(Mystic::Interval))
Source
new(tonic_type : String, type : String)
Source
new(tonic : Mystic::Note, type : String)
Source

Instance methods

+(interval : Interval) : Scale

Returns a new scale transposed by the given interval

Source
intervals
Source
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")

Source
note_names

Returns the note names

Source
notes

Returns the notes of the scale

Source
to_s(io : IO) : Nil

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>
Source
tonic
Source
type
Source