Class ChordsManagingUtilities
Extension methods for chords managing.
Inherited Members
Namespace: Melanchall.DryWetMidi.Interaction
Assembly: Melanchall.DryWetMidi.dll
Syntax
public static class ChordsManagingUtilities
Methods
GetChords(EventsCollection, ChordDetectionSettings)
Gets chords contained in the specified EventsCollection. More info in the
Getting objects: GetChords article.
Declaration
public static ICollection<Chord> GetChords(this EventsCollection eventsCollection, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for chords. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<Chord> | Collection of chords contained in eventsCollection ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | eventsCollection is null . |
See Also
GetChords(MidiFile, ChordDetectionSettings)
Gets chords contained in the specified MidiFile. More info in the
Getting objects: GetChords article.
Declaration
public static ICollection<Chord> GetChords(this MidiFile file, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for chords. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<Chord> | Collection of chords contained in file ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | file is null . |
See Also
GetChords(TrackChunk, ChordDetectionSettings)
Gets chords contained in the specified TrackChunk. More info in the
Getting objects: GetChords article.
Declaration
public static ICollection<Chord> GetChords(this TrackChunk trackChunk, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for chords. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<Chord> | Collection of chords contained in trackChunk ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunk is null . |
See Also
GetChords(IEnumerable<MidiEvent>, ChordDetectionSettings)
Gets chords contained in the specified collection of MidiEvent. More info in the
Getting objects: GetChords article.
Declaration
public static ICollection<Chord> GetChords(this IEnumerable<MidiEvent> midiEvents, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<MidiEvent> | midiEvents | Collection ofMidiFile to search for chords. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<Chord> | Collection of chords contained in midiEvents ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | midiEvents is null . |
GetChords(IEnumerable<TrackChunk>, ChordDetectionSettings)
Gets chords contained in the specified collection of TrackChunk. More info in the
Getting objects: GetChords article.
Declaration
public static ICollection<Chord> GetChords(this IEnumerable<TrackChunk> trackChunks, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Track chunks to search for chords. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<Chord> | Collection of chords contained in trackChunks ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunks is null . |
See Also
GetChords(IEnumerable<Note>, ChordDetectionSettings)
Creates chords from notes.
Declaration
public static IEnumerable<Chord> GetChords(this IEnumerable<Note> notes, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Note> | notes | Notes to create chords from. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
IEnumerable<Chord> | Collection of chords made up from notes . |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | notes is null . |
GetMusicTheoryChord(Chord)
Declaration
public static Chord GetMusicTheoryChord(this Chord chord)
Parameters
Type | Name | Description |
---|---|---|
Chord | chord | Chord to get music theory chord from. |
Returns
Type | Description |
---|---|
Chord | Chord containing notes of the chord . |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | chord is null . |
ManageChords(EventsCollection, ChordDetectionSettings, TimedObjectsComparer)
Creates an instance of the TimedObjectsManager<TObject> initializing it with the
specified events collection. More info in the Objects managers article.
Declaration
public static TimedObjectsManager<Chord> ManageChords(this EventsCollection eventsCollection, ChordDetectionSettings settings = null, TimedObjectsComparer comparer = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection that holds chords to manage. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
TimedObjectsComparer | comparer | Comparer that will be used to order objects on enumerating and saving objects
back to the eventsCollection via SaveChanges()
or Dispose(). |
Returns
Type | Description |
---|---|
TimedObjectsManager<Chord> | An instance of the TimedObjectsManager<TObject> that can be used to manage chords
represented by the eventsCollection . |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | eventsCollection is null . |
ManageChords(TrackChunk, ChordDetectionSettings, TimedObjectsComparer)
Creates an instance of the TimedObjectsManager<TObject> initializing it with the
events collection of the specified track chunk. More info in the
Objects managers article.
Declaration
public static TimedObjectsManager<Chord> ManageChords(this TrackChunk trackChunk, ChordDetectionSettings settings = null, TimedObjectsComparer comparer = null)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk that holds chords to manage. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
TimedObjectsComparer | comparer | Comparer that will be used to order objects on enumerating and saving objects
back to the trackChunk via SaveChanges()
or Dispose(). |
Returns
Type | Description |
---|---|
TimedObjectsManager<Chord> | An instance of the TimedObjectsManager<TObject> that can be used to manage
chords represented by the trackChunk . |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunk is null . |
ProcessChords(EventsCollection, Action<Chord>, ChordDetectionSettings, ChordProcessingHint)
Performs the specified action on each Chord contained in the EventsCollection.
Declaration
public static int ProcessChords(this EventsCollection eventsCollection, Action<Chord> action, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
eventsCollection . |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
ProcessChords(EventsCollection, Action<Chord>, Predicate<Chord>, ChordDetectionSettings, ChordProcessingHint)
Performs the specified action on each Chord contained in the EventsCollection.
Declaration
public static int ProcessChords(this EventsCollection eventsCollection, Action<Chord> action, Predicate<Chord> match, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
eventsCollection . |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to process. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
ProcessChords(MidiFile, Action<Chord>, ChordDetectionSettings, ChordProcessingHint)
Declaration
public static int ProcessChords(this MidiFile file, Action<Chord> action, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
file . |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
ProcessChords(MidiFile, Action<Chord>, Predicate<Chord>, ChordDetectionSettings, ChordProcessingHint)
Declaration
public static int ProcessChords(this MidiFile file, Action<Chord> action, Predicate<Chord> match, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
file . |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to process. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
ProcessChords(TrackChunk, Action<Chord>, ChordDetectionSettings, ChordProcessingHint)
Performs the specified action on each Chord contained in the TrackChunk.
Declaration
public static int ProcessChords(this TrackChunk trackChunk, Action<Chord> action, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
trackChunk . |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
ProcessChords(TrackChunk, Action<Chord>, Predicate<Chord>, ChordDetectionSettings, ChordProcessingHint)
Performs the specified action on each Chord contained in the TrackChunk.
Declaration
public static int ProcessChords(this TrackChunk trackChunk, Action<Chord> action, Predicate<Chord> match, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
trackChunk . |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to process. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
ProcessChords(IEnumerable<TrackChunk>, Action<Chord>, ChordDetectionSettings, ChordProcessingHint)
Performs the specified action on each Chord contained in the collection of
TrackChunk.
Declaration
public static int ProcessChords(this IEnumerable<TrackChunk> trackChunks, Action<Chord> action, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
trackChunks . |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
ProcessChords(IEnumerable<TrackChunk>, Action<Chord>, Predicate<Chord>, ChordDetectionSettings, ChordProcessingHint)
Performs the specified action on each Chord contained in the collection of
TrackChunk.
Declaration
public static int ProcessChords(this IEnumerable<TrackChunk> trackChunks, Action<Chord> action, Predicate<Chord> match, ChordDetectionSettings settings = null, ChordProcessingHint hint = ChordProcessingHint.TimeOrLengthCanBeChanged)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for chords to process. |
Action<Chord> | action | The action to perform on each Chord contained in the
trackChunks . |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to process. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
ChordProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
Int32 | Count of processed chords. |
Remarks
Note that you can always use an object manager to
perform any manipulations with chords but dedicated methods of the ChordsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
RemoveChords(EventsCollection, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this EventsCollection eventsCollection, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for chords to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | eventsCollection is null . |
RemoveChords(EventsCollection, Predicate<Chord>, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this EventsCollection eventsCollection, Predicate<Chord> match, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for chords to remove. |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
RemoveChords(MidiFile, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this MidiFile file, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for chords to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | file is null . |
RemoveChords(MidiFile, Predicate<Chord>, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this MidiFile file, Predicate<Chord> match, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for chords to remove. |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
RemoveChords(TrackChunk, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this TrackChunk trackChunk, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for chords to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunk is null . |
RemoveChords(TrackChunk, Predicate<Chord>, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this TrackChunk trackChunk, Predicate<Chord> match, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for chords to remove. |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|
RemoveChords(IEnumerable<TrackChunk>, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this IEnumerable<TrackChunk> trackChunks, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for chords to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunks is null . |
RemoveChords(IEnumerable<TrackChunk>, Predicate<Chord>, ChordDetectionSettings)
Removes all the Chord that match the conditions defined by the specified predicate.
Declaration
public static int RemoveChords(this IEnumerable<TrackChunk> trackChunks, Predicate<Chord> match, ChordDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for chords to remove. |
Predicate<Chord> | match | The predicate that defines the conditions of the Chord to remove. |
ChordDetectionSettings | settings | Settings according to which chords should be detected and built. |
Returns
Type | Description |
---|---|
Int32 | Count of removed chords. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
One of the following errors occurred:
|