Class Chord
Represents a musical chord.
Assembly: Melanchall.DryWetMidi.dll
Syntax
public class Chord : ILengthedObject, ITimedObject, IMusicalObject, INotifyTimeChanged, INotifyLengthChanged
Constructors
Chord()
Initializes a new instance of the
Chord.
Declaration
Chord(params Note[])
Initializes a new instance of the
Chord with the specified
collection of notes.
Declaration
public Chord(params Note[] notes)
Parameters
Type |
Name |
Description |
Note[] |
notes |
Notes to combine into a chord. |
Exceptions
Chord(IEnumerable<Note>)
Initializes a new instance of the
Chord with the specified
collection of notes.
Declaration
public Chord(IEnumerable<Note> notes)
Parameters
Type |
Name |
Description |
IEnumerable<Note> |
notes |
Notes to combine into a chord. |
Exceptions
Chord(IEnumerable<Note>, long)
Initializes a new instance of the
Chord with the specified
collection of notes and chord time.
Declaration
public Chord(IEnumerable<Note> notes, long time)
Parameters
Type |
Name |
Description |
IEnumerable<Note> |
notes |
Notes to combine into a chord. |
long |
time |
Time of the chord which is time of the earliest note of the notes . |
Exceptions
Properties
Channel
Gets or sets channel to play the chord on.
Declaration
public FourBitNumber Channel { get; set; }
Property Value
Exceptions
Type |
Condition |
InvalidOperationException |
One of the following errors occurred:
- Unable to get channel since a chord doesn't contain notes.
- Unable to get channel since chord's notes have different Velocity.
|
EndTime
Gets the end time of an object.
Declaration
public long EndTime { get; }
Property Value
Length
Gets or sets the length of the chord in units defined by the time division of a MIDI file.
Declaration
public long Length { get; set; }
Property Value
Exceptions
Notes
Declaration
public TimedObjectsCollection<Note> Notes { get; }
Property Value
OffVelocity
Gets or sets velocity of the underlying
NoteOffEvent events of a chord's notes.
Declaration
public SevenBitNumber OffVelocity { get; set; }
Property Value
Exceptions
Type |
Condition |
InvalidOperationException |
One of the following errors occurred:
- Unable to get off velocity since a chord doesn't contain notes.
- Unable to get off velocity since chord's notes have different OffVelocity.
|
Time
Gets or sets absolute time of the chord in units defined by the time division of a MIDI file.
Declaration
public long Time { get; set; }
Property Value
Exceptions
Velocity
Gets or sets velocity of the underlying
NoteOnEvent events of a chord's notes.
Declaration
public SevenBitNumber Velocity { get; set; }
Property Value
Exceptions
Type |
Condition |
InvalidOperationException |
One of the following errors occurred:
- Unable to get velocity since a chord doesn't contain notes.
- Unable to get velocity since chord's notes have different Velocity.
|
Methods
Clone()
Clones object by creating a copy of it.
Declaration
public virtual ITimedObject Clone()
Returns
Split(long)
Splits the current object by the specified time.
Declaration
public SplitLengthedObject Split(long time)
Parameters
Type |
Name |
Description |
long |
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
NotesCollectionChanged
Occurs when notes collection changes.
Declaration
public event TimedObjectsCollectionChangedEventHandler<Note> NotesCollectionChanged
Event Type
TimeChanged
Occurs when the time of an object has been changed.
Declaration
public event EventHandler<TimeChangedEventArgs> TimeChanged
Event Type
Implements
Extension Methods