Search Results for

    Show / Hide Table of Contents

    Class Tempo

    Represents tempo expressed in microseconds per quarter note or beats per minute.
    Inheritance
    object
    Tempo
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Melanchall.DryWetMidi.Interaction
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class Tempo

    Constructors

    Tempo(long)

    Initializes a new instance of the Tempo with the specified number of microseconds per quarter note.
    Declaration
    public Tempo(long microsecondsPerQuarterNote)
    Parameters
    Type Name Description
    long microsecondsPerQuarterNote Number of microseconds per quarter note.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException microsecondsPerQuarterNote is zero or negative.

    Fields

    Default

    Default tempo which is 500,000 microseconds per quarter note or 120 beats per minute.
    Declaration
    public static readonly Tempo Default
    Field Value
    Type Description
    Tempo

    Properties

    BeatsPerMinute

    Gets the number of beats per minute.
    Declaration
    public double BeatsPerMinute { get; }
    Property Value
    Type Description
    double

    MicrosecondsPerQuarterNote

    Gets number of microseconds per quarter note.
    Declaration
    public long MicrosecondsPerQuarterNote { get; }
    Property Value
    Type Description
    long

    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)

    FromBeatsPerMinute(double)

    Creates an instance of the Tempo with the specified number of beats per minute.
    Declaration
    public static Tempo FromBeatsPerMinute(double beatsPerMinute)
    Parameters
    Type Name Description
    double beatsPerMinute Number of beats per minute.
    Returns
    Type Description
    Tempo An instance of the Tempo which represents tempo as specified number of beats per minute.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException beatsPerMinute is zero or negative.

    FromMillisecondsPerQuarterNote(long)

    Creates an instance of the Tempo with the specified number of milliseconds per quarter note.
    Declaration
    public static Tempo FromMillisecondsPerQuarterNote(long millisecondsPerQuarterNote)
    Parameters
    Type Name Description
    long millisecondsPerQuarterNote Number of milliseconds per quarter note.
    Returns
    Type Description
    Tempo An instance of the Tempo which represents tempo as specified number of milliseconds per quarter note.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException millisecondsPerQuarterNote is zero or negative.

    GetHashCode()

    Returns the hash code for this instance.
    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int A 32-bit signed integer hash code.
    Overrides
    object.GetHashCode()

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

    Operators

    operator ==(Tempo, Tempo)

    Determines if two Tempo objects are equal.
    Declaration
    public static bool operator ==(Tempo tempo1, Tempo tempo2)
    Parameters
    Type Name Description
    Tempo tempo1 The first Tempo to compare.
    Tempo tempo2 The second Tempo to compare.
    Returns
    Type Description
    bool true if the tempos are equal, false otherwise.

    operator >(Tempo, Tempo)

    Indicates whether a specified Tempo is greater than another one.
    Declaration
    public static bool operator >(Tempo tempo1, Tempo tempo2)
    Parameters
    Type Name Description
    Tempo tempo1 The first Tempo to compare.
    Tempo tempo2 The second Tempo to compare.
    Returns
    Type Description
    bool true if the value of tempo1 is greater than the value of tempo2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • tempo1 is null.
    • tempo2 is null.

    operator >=(Tempo, Tempo)

    Indicates whether a specified Tempo is greater than or equal to another one.
    Declaration
    public static bool operator >=(Tempo tempo1, Tempo tempo2)
    Parameters
    Type Name Description
    Tempo tempo1 The first Tempo to compare.
    Tempo tempo2 The second Tempo to compare.
    Returns
    Type Description
    bool true if the value of tempo1 is greater than or equal to the value of tempo2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • tempo1 is null.
    • tempo2 is null.

    operator !=(Tempo, Tempo)

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

    operator <(Tempo, Tempo)

    Indicates whether a specified Tempo is less than another one.
    Declaration
    public static bool operator <(Tempo tempo1, Tempo tempo2)
    Parameters
    Type Name Description
    Tempo tempo1 The first Tempo to compare.
    Tempo tempo2 The second Tempo to compare.
    Returns
    Type Description
    bool true if the value of tempo1 is less than the value of tempo2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • tempo1 is null.
    • tempo2 is null.

    operator <=(Tempo, Tempo)

    Indicates whether a specified Tempo is less than or equal to another one.
    Declaration
    public static bool operator <=(Tempo tempo1, Tempo tempo2)
    Parameters
    Type Name Description
    Tempo tempo1 The first Tempo to compare.
    Tempo tempo2 The second Tempo to compare.
    Returns
    Type Description
    bool true if the value of tempo1 is less than or equal to the value of tempo2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • tempo1 is null.
    • tempo2 is null.

    See Also

    TempoMap
    In this article
    Back to top 2025 / Generated by DocFX