Search Results for

    Show / Hide Table of Contents

    Class Octave

    Represents an octave defined by its number.
    Inheritance
    object
    Octave
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Melanchall.DryWetMidi.MusicTheory
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class Octave

    Fields

    MaxOctaveNumber

    The largest possible value of an octave's number.
    Declaration
    public static readonly int MaxOctaveNumber
    Field Value
    Type Description
    int

    Middle

    The octave which contains the middle C note (C4).
    Declaration
    public static readonly Octave Middle
    Field Value
    Type Description
    Octave

    MinOctaveNumber

    The smallest possible value of an octave's number.
    Declaration
    public static readonly int MinOctaveNumber
    Field Value
    Type Description
    int

    OctaveSize

    The size of an octave, i.e. number of notes within an octave.
    Declaration
    public const int OctaveSize = 12
    Field Value
    Type Description
    int

    Properties

    A

    Gets the A note of an octave defined by the current Octave.
    Declaration
    public Note A { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    ASharp

    Gets the A# note of an octave defined by the current Octave.
    Declaration
    public Note ASharp { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    B

    Gets the B note of an octave defined by the current Octave.
    Declaration
    public Note B { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    C

    Gets the C note of an octave defined by the current Octave.
    Declaration
    public Note C { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    CSharp

    Gets the C# note of an octave defined by the current Octave.
    Declaration
    public Note CSharp { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    D

    Gets the D note of an octave defined by the current Octave.
    Declaration
    public Note D { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    DSharp

    Gets the D# note of an octave defined by the current Octave.
    Declaration
    public Note DSharp { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    E

    Gets the E note of an octave defined by the current Octave.
    Declaration
    public Note E { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    F

    Gets the F note of an octave defined by the current Octave.
    Declaration
    public Note F { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    FSharp

    Gets the F# note of an octave defined by the current Octave.
    Declaration
    public Note FSharp { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    G

    Gets the G note of an octave defined by the current Octave.
    Declaration
    public Note G { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    GSharp

    Gets the G# note of an octave defined by the current Octave.
    Declaration
    public Note GSharp { get; }
    Property Value
    Type Description
    Note
    Exceptions
    Type Condition
    InvalidOperationException Unable to get a note.

    Number

    Gets the number of an octave represented by the current Octave.
    Declaration
    public int Number { get; }
    Property Value
    Type Description
    int

    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)

    Get(int)

    Gets an octave by the specified octave number.
    Declaration
    public static Octave Get(int octaveNumber)
    Parameters
    Type Name Description
    int octaveNumber The number of an octave.
    Returns
    Type Description
    Octave An octave with the specified number.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException octaveNumber is out of valid range.

    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()

    GetNote(NoteName)

    Gets a note by the specified note name using current octave.
    Declaration
    public Note GetNote(NoteName noteName)
    Parameters
    Type Name Description
    NoteName noteName The name of a note.
    Returns
    Type Description
    Note Note with the specified note name and current octave.
    Exceptions
    Type Condition
    InvalidEnumArgumentException noteName specified an invalid value.
    InvalidOperationException Unable to get a note for the noteName.

    Parse(string)

    Converts the string representation of a musical octave to its Octave equivalent.
    Declaration
    public static Octave Parse(string input)
    Parameters
    Type Name Description
    string input A string containing an octave to convert.
    Returns
    Type Description
    Octave A Octave equivalent to the musical note 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 Octave)

    Converts the string representation of a musical octave to its Octave equivalent. A return value indicates whether the conversion succeeded.
    Declaration
    public static bool TryParse(string input, out Octave octave)
    Parameters
    Type Name Description
    string input A string containing an octave to convert.
    Octave octave When this method returns, contains the Octave equivalent of the musical octave 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 ==(Octave, Octave)

    Determines if two Octave objects are equal.
    Declaration
    public static bool operator ==(Octave octave1, Octave octave2)
    Parameters
    Type Name Description
    Octave octave1 The first Octave to compare.
    Octave octave2 The second Octave to compare.
    Returns
    Type Description
    bool true if the octaves are equal, false otherwise.

    operator !=(Octave, Octave)

    Determines if two Octave objects are not equal.
    Declaration
    public static bool operator !=(Octave octave1, Octave octave2)
    Parameters
    Type Name Description
    Octave octave1 The first Octave to compare.
    Octave octave2 The second Octave to compare.
    Returns
    Type Description
    bool false if the octaves are equal, true otherwise.
    In this article
    Back to top 2024 / Generated by DocFX