Class Note
Represents a musical note.
Assembly: Melanchall.DryWetMidi.dll
Syntax
public class Note : ILengthedObject, ITimedObject, IMusicalObject, INotifyTimeChanged, INotifyLengthChanged
Constructors
Note(SevenBitNumber)
Initializes a new instance of the
Note with the specified note number.
Declaration
public Note(SevenBitNumber noteNumber)
Parameters
Type |
Name |
Description |
SevenBitNumber |
noteNumber |
Number of the note (60 is middle C). |
Note(SevenBitNumber, Int64)
Initializes a new instance of the
Note with the specified
note number and length.
Declaration
public Note(SevenBitNumber noteNumber, long length)
Parameters
Type |
Name |
Description |
SevenBitNumber |
noteNumber |
Number of the note (60 is middle C). |
Int64 |
length |
Length of the note in units defined by time division of a MIDI file. |
Note(SevenBitNumber, Int64, Int64)
Initializes a new instance of the
Note with the specified
note number, length and absolute time.
Declaration
public Note(SevenBitNumber noteNumber, long length, long time)
Parameters
Type |
Name |
Description |
SevenBitNumber |
noteNumber |
Number of the note (60 is middle C). |
Int64 |
length |
Length of the note in units defined by time division of a MIDI file. |
Int64 |
time |
Absolute time of the note in units defined by the time division of a MIDI file. |
Note(TimedEvent, TimedEvent)
Initializes a new instance of the
Note with the specified pair of
timed events holding corresponding
NoteOnEvent and
NoteOffEvent events.
Declaration
public Note(TimedEvent timedNoteOnEvent, TimedEvent timedNoteOffEvent)
Parameters
Exceptions
Type |
Condition |
ArgumentOutOfRangeException |
One of the following errors occurred:
- Underlying event of the
timedNoteOnEvent is not NoteOnEvent. - Underlying event of the
timedNoteOffEvent is not NoteOffEvent. timedNoteOffEvent goes before timedNoteOnEvent .
|
Note(NoteName, Int32)
Initializes a new instance of the
Note with the specified
note name and octave.
Declaration
public Note(NoteName noteName, int octave)
Parameters
Type |
Name |
Description |
NoteName |
noteName |
Name of the note. |
Int32 |
octave |
Number of the octave in scientific pitch notation. |
Exceptions
Note(NoteName, Int32, Int64)
Initializes a new instance of the
Note with the specified
note name, octave and length.
Declaration
public Note(NoteName noteName, int octave, long length)
Parameters
Type |
Name |
Description |
NoteName |
noteName |
Name of the note. |
Int32 |
octave |
Number of the octave in scientific pitch notation. |
Int64 |
length |
Length of the note in units defined by time division of a MIDI file. |
Exceptions
Note(NoteName, Int32, Int64, Int64)
Initializes a new instance of the
Note with the specified
note name, octave, length and absolute time.
Declaration
public Note(NoteName noteName, int octave, long length, long time)
Parameters
Type |
Name |
Description |
NoteName |
noteName |
Name of the note. |
Int32 |
octave |
Number of the octave in scientific pitch notation. |
Int64 |
length |
Length of the note in units defined by time division of a MIDI file. |
Int64 |
time |
Absolute time of the note in units defined by the time division of a MIDI file. |
Exceptions
Fields
DefaultOffVelocity
Default off velocity (velocity of underlying
NoteOffEvent event).
Declaration
public static readonly SevenBitNumber DefaultOffVelocity
Field Value
DefaultVelocity
Default velocity (velocity of underlying
NoteOnEvent event).
Declaration
public static readonly SevenBitNumber DefaultVelocity
Field Value
Properties
Channel
Gets or sets channel to play the note on.
Declaration
public FourBitNumber Channel { get; set; }
Property Value
EndTime
Gets the end time of an object.
Declaration
public long EndTime { get; }
Property Value
Length
Gets or sets the length of the note in units defined by the time division of a MIDI file.
Declaration
public long Length { get; set; }
Property Value
Exceptions
NoteName
Gets name of the note.
Declaration
public NoteName NoteName { get; }
Property Value
NoteNumber
Gets or sets number of the note (60 is middle C).
Declaration
public SevenBitNumber NoteNumber { get; set; }
Property Value
Octave
Gets octave of the note.
Declaration
public int Octave { get; }
Property Value
OffVelocity
Declaration
public SevenBitNumber OffVelocity { get; set; }
Property Value
Time
Gets or sets absolute time of the note in units defined by the time division of a MIDI file.
Declaration
public long Time { get; set; }
Property Value
Exceptions
Velocity
Declaration
public SevenBitNumber Velocity { get; set; }
Property Value
Methods
Clone()
Clones object by creating a copy of it.
Declaration
public virtual ITimedObject Clone()
Returns
GetTimedNoteOffEvent()
Gets the 'Note Off' timed event of the current note.
Declaration
public TimedEvent GetTimedNoteOffEvent()
Returns
Type |
Description |
TimedEvent |
The 'Note Off' timed event of the current note. |
GetTimedNoteOnEvent()
Gets the 'Note On' timed event of the current note.
Declaration
public TimedEvent GetTimedNoteOnEvent()
Returns
Type |
Description |
TimedEvent |
The 'Note On' timed event of the current note. |
SetNoteNameAndOctave(NoteName, Int32)
Sets note name and octave for current
Note.
Declaration
public void SetNoteNameAndOctave(NoteName noteName, int octave)
Parameters
Type |
Name |
Description |
NoteName |
noteName |
Name of the note. |
Int32 |
octave |
Number of the octave in scientific pitch notation. |
Remarks
Exceptions
Split(Int64)
Splits the current object by the specified time.
Declaration
public SplitLengthedObject Split(long time)
Parameters
Type |
Name |
Description |
Int64 |
time |
Time to split the object at. |
Returns
Type |
Description |
SplitLengthedObject |
An object containing left and right parts of the split object.
Both parts have the same type as the original object. |
Exceptions
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
Events
LengthChanged
Occurs when the length of an object has been changed.
Declaration
public event EventHandler<LengthChangedEventArgs> LengthChanged
Event Type
TimeChanged
Occurs when the time of an object has been changed.
Declaration
public event EventHandler<TimeChangedEventArgs> TimeChanged
Event Type
Implements
Extension Methods