Search Results for

    Show / Hide Table of Contents

    Class Scale

    Represents a musical scale.
    Inheritance
    object
    Scale
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Melanchall.DryWetMidi.MusicTheory
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class Scale

    Constructors

    Scale(IEnumerable<Interval>, NoteName)

    Initializes a new instance of the Scale with the specified intervals and root note.
    Declaration
    public Scale(IEnumerable<Interval> intervals, NoteName rootNote)
    Parameters
    Type Name Description
    IEnumerable<Interval> intervals Intervals between adjacent notes of the scale.
    NoteName rootNote Root note (tonic) of the scale.
    Exceptions
    Type Condition
    ArgumentNullException intervals is null.
    InvalidEnumArgumentException rootNote specified an invalid value.

    Properties

    Intervals

    Gets intervals between adjacent notes of the current Scale.
    Declaration
    public IEnumerable<Interval> Intervals { get; }
    Property Value
    Type Description
    IEnumerable<Interval>

    RootNote

    Gets root note (tonic) of the current Scale.
    Declaration
    public NoteName RootNote { get; }
    Property Value
    Type Description
    NoteName

    Methods

    Equals(object)

    Determines whether the specified object is equal to the current object.
    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj The object to compare with the current object.
    Returns
    Type Description
    bool true if the specified object is equal to the current object; otherwise, false.
    Overrides
    object.Equals(object)

    GetHashCode()

    Serves as the default hash function.
    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int A hash code for the current object.
    Overrides
    object.GetHashCode()

    Parse(string)

    Converts the string representation of a musical scale to its Scale equivalent.
    Declaration
    public static Scale Parse(string input)
    Parameters
    Type Name Description
    string input A string containing a scale to convert.
    Returns
    Type Description
    Scale A Scale equivalent to the musical scale contained in input.
    Exceptions
    Type Condition
    ArgumentException input is null or contains white-spaces only.
    FormatException input has invalid format.

    ToString()

    Returns a string that represents the current object.
    Declaration
    public override string ToString()
    Returns
    Type Description
    string A string that represents the current object.
    Overrides
    object.ToString()

    TryParse(string, out Scale)

    Converts the string representation of a musical scale to its Scale equivalent. A return value indicates whether the conversion succeeded.
    Declaration
    public static bool TryParse(string input, out Scale scale)
    Parameters
    Type Name Description
    string input A string containing a scale to convert.
    Scale scale When this method returns, contains the Scale equivalent of the musical scale contained in input, if the conversion succeeded, or null if the conversion failed. The conversion fails if the input is null or Empty, or is not of the correct format. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
    Returns
    Type Description
    bool true if input was converted successfully; otherwise, false.

    Operators

    operator ==(Scale, Scale)

    Determines if two Scale objects are equal.
    Declaration
    public static bool operator ==(Scale scale1, Scale scale2)
    Parameters
    Type Name Description
    Scale scale1 The first Scale to compare.
    Scale scale2 The second Scale to compare.
    Returns
    Type Description
    bool true if the scales are equal, false otherwise.

    operator !=(Scale, Scale)

    Determines if two Scale objects are not equal.
    Declaration
    public static bool operator !=(Scale scale1, Scale scale2)
    Parameters
    Type Name Description
    Scale scale1 The first Scale to compare.
    Scale scale2 The second Scale to compare.
    Returns
    Type Description
    bool false if the scales are equal, true otherwise.

    Extension Methods

    ScaleUtilities.GetAscendingNotes(Scale, Note)
    ScaleUtilities.GetDegree(Scale, ScaleDegree)
    ScaleUtilities.GetDescendingNotes(Scale, Note)
    ScaleUtilities.GetNextNote(Scale, Note)
    ScaleUtilities.GetNotes(Scale)
    ScaleUtilities.GetNotesNames(Scale)
    ScaleUtilities.GetPreviousNote(Scale, Note)
    ScaleUtilities.GetStep(Scale, int)
    ScaleUtilities.IsNoteInScale(Scale, Note)
    In this article
    Back to top 2024 / Generated by DocFX