Search Results for

    Show / Hide Table of Contents

    Class NoteEventUtilities

    Set of extension methods for NoteOnEvent and NoteOffEvent events.
    Inheritance
    object
    NoteEventUtilities
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Core
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public static class NoteEventUtilities

    Methods

    GetNoteName(NoteEvent)

    Gets name of the note presented by the specified NoteEvent.
    Declaration
    public static NoteName GetNoteName(this NoteEvent noteEvent)
    Parameters
    Type Name Description
    NoteEvent noteEvent Note event to get note name of.
    Returns
    Type Description
    NoteName Note name of the noteEvent.
    Exceptions
    Type Condition
    ArgumentNullException noteEvent is null.

    GetNoteOctave(NoteEvent)

    Gets octave of the note presented by the specified NoteOnEvent.
    Declaration
    public static int GetNoteOctave(this NoteEvent noteEvent)
    Parameters
    Type Name Description
    NoteEvent noteEvent Note event to get note octave of.
    Returns
    Type Description
    int Note octave of the noteEvent.
    Remarks
    Octave number will be returned in scientific pitch notation which means that 4 will be returned for 60 note number.
    Exceptions
    Type Condition
    ArgumentNullException noteEvent is null.

    IsNoteOnCorrespondToNoteOff(NoteOnEvent, NoteOffEvent)

    Checks if the specified NoteOnEvent corresponds to the specified NoteOffEvent.
    Declaration
    public static bool IsNoteOnCorrespondToNoteOff(NoteOnEvent noteOnEvent, NoteOffEvent noteOffEvent)
    Parameters
    Type Name Description
    NoteOnEvent noteOnEvent NoteOnEvent to check NoteOffEvent for.
    NoteOffEvent noteOffEvent NoteOffEvent to check NoteOnEvent for.
    Returns
    Type Description
    bool true if noteOnEvent corresponds to noteOffEvent.
    Remarks
    Note On event corresponds to Note Off one if it has the same note's number and channel, i.e. those events make up a note.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • noteOnEvent is null.
    • noteOffEvent is null.

    SetNoteNumber(NoteEvent, NoteName, int)

    Sets the note number of the NoteEvent with the specified note name and octave.
    Declaration
    public static void SetNoteNumber(this NoteEvent noteEvent, NoteName noteName, int octave)
    Parameters
    Type Name Description
    NoteEvent noteEvent Note event to set the note number of.
    NoteName noteName Name of the note.
    int octave Number of the octave.
    Remarks
    Octave number is specified in scientific pitch notation which means that 4 must be passed to get the number of the middle C.
    Exceptions
    Type Condition
    ArgumentNullException noteEvent is null.
    InvalidEnumArgumentException noteName specified an invalid value.
    ArgumentException Note number is out of range for the specified note name and octave.
    In this article
    Back to top 2024 / Generated by DocFX