Scale API Reference
Complete API documentation for the Scale
class.
Class Definition
Constructors
Scale(Note, ScaleType)
Creates a new scale with the specified root note and scale type.
Parameters:
root
: The root note of the scaletype
: The scale type (Major, Minor, Dorian, Blues, etc.)
Example:
Properties
Root
Gets the root note of the scale.
Type
Gets the scale type.
Instance Methods
GetNotes()
Generates all notes in the scale.
Returns: An infinite sequence of scale notes ascending from the root
Note: Use Take()
to limit the number of notes.
Example:
GetNoteByDegree(int)
Gets a specific scale degree.
Parameters:
degree
: The scale degree (1-based)
Returns: The note at the specified degree
Exceptions:
ArgumentOutOfRangeException
: If degree is less than 1
Example:
Contains(Note)
Determines if a note belongs to the scale.
Parameters:
note
: The note to check
Returns: True if the note (any octave) is in the scale
Example:
GetDegree(Note)
Gets the scale degree of a note.
Parameters:
note
: The note to find
Returns: The scale degree (1-7), or 0 if not in scale
Example:
Transpose(Interval, Direction?)
Transposes the scale by the specified interval.
Parameters:
interval
: The interval to transpose bydirection
: The direction (Up or Down), default is Up
Returns: A new Scale instance with transposed root
Example:
TransposeBySemitones(int)
Transposes the scale by a number of semitones.
Parameters:
semitones
: Number of semitones (positive = up, negative = down)
Returns: A new Scale instance
ToString()
Returns a string representation of the scale.
Format: "{Root} {Type}"
Examples:
"C Major"
"A NaturalMinor"
"D Dorian"
Equals(Scale?)
Determines if this scale equals another scale.
Note: Compares root note and scale type.
GetHashCode()
Returns the hash code for the scale.
Static Methods
GetIntervalPattern(ScaleType)
Gets the interval pattern for a scale type.
Parameters:
type
: The scale type
Returns: Array of semitone intervals
Example:
Operators
Equality Operators
Compare scales by root and type.
ScaleType Enumeration
The library supports 15+ scale types:
Traditional Scales
Major (Ionian)
NaturalMinor (Aeolian)
HarmonicMinor
MelodicMinor
Modal Scales
Ionian (same as Major)
Dorian
Phrygian
Lydian
Mixolydian
Aeolian (same as Natural Minor)
Locrian
Pentatonic Scales
MajorPentatonic
MinorPentatonic
Other Scales
Blues
Chromatic
WholeTone
Diminished (Octatonic)
Augmented
Scale Interval Patterns
Common Scale Patterns
Scale Type | Pattern | Example (C) |
---|---|---|
Major | W-W-H-W-W-W-H | C D E F G A B C |
Natural Minor | W-H-W-W-H-W-W | C D Eb F G Ab Bb C |
Harmonic Minor | W-H-W-W-H-Aug2-H | C D Eb F G Ab B C |
Melodic Minor | W-H-W-W-W-W-H | C D Eb F G A B C |
Dorian | W-H-W-W-W-H-W | C D Eb F G A Bb C |
Phrygian | H-W-W-W-H-W-W | C Db Eb F G Ab Bb C |
Lydian | W-W-W-H-W-W-H | C D E F# G A B C |
Mixolydian | W-W-H-W-W-H-W | C D E F G A Bb C |
Locrian | H-W-W-H-W-W-W | C Db Eb F Gb Ab Bb C |
(W = Whole step = 2 semitones, H = Half step = 1 semitone, Aug2 = 3 semitones)
Common Patterns
Creating Common Scales
Scale Analysis
Building Chords from Scales
Common Tones Between Scales
Performance Notes
GetNotes() uses lazy evaluation with yield return
Scale patterns are cached statically
Contains() method uses efficient note comparison
GetDegree() performs linear search (scales have max 7 unique notes)
Thread Safety
The Scale
class is immutable and thread-safe. Multiple threads can safely:
Read all properties
Call all methods
Share Scale instances
No synchronization is needed.
Validation
Root note must not be null
ScaleType must be a valid enum value
GetNoteByDegree validates degree >= 1