Search Results for

    Show / Hide Table of Contents

    Class Splitter

    Provides methods to split MIDI data in many different ways. More info in the Splitter article.
    Inheritance
    object
    Splitter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Tools
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public static class Splitter

    Methods

    CutPart(MidiFile, ITimeSpan, ITimeSpan, SliceMidiFileSettings)

    Cuts a part of the specified length from a MIDI file (starting at the specified time within the file) and returns a new instance of MidiFile which is the original one without the part. More info in the MIDI file splitting: CutPart article.
    Declaration
    public static MidiFile CutPart(this MidiFile midiFile, ITimeSpan partStart, ITimeSpan partLength, SliceMidiFileSettings settings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to cut part from.
    ITimeSpan partStart The start time of part to cut.
    ITimeSpan partLength The length of part to cut.
    SliceMidiFileSettings settings Settings according to which midiFile should be split.
    Returns
    Type Description
    MidiFile MidiFile which is the midiFile without a part defined by partStart and partLength.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • partStart is null.
    • partLength is null.

    SkipPart(MidiFile, ITimeSpan, SliceMidiFileSettings)

    Skips part of the specified length of MIDI file and returns remaining part as an instance of MidiFile. More info in the MIDI file splitting: SkipPart article.
    Declaration
    public static MidiFile SkipPart(this MidiFile midiFile, ITimeSpan partLength, SliceMidiFileSettings settings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to skip part of.
    ITimeSpan partLength The length of part to skip.
    SliceMidiFileSettings settings Settings according to which midiFile should be split.
    Returns
    Type Description
    MidiFile MidiFile which is result of skipping a part of the midiFile.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • partLength is null.

    SplitByChannel(MidiFile, SplitFileByChannelSettings)

    Splits MidiFile by channel. More info in the MIDI file splitting: SplitByChannel article.
    Declaration
    public static IEnumerable<MidiFile> SplitByChannel(this MidiFile midiFile, SplitFileByChannelSettings settings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split.
    SplitFileByChannelSettings settings Settings according to which MIDI file should be split.
    Returns
    Type Description
    IEnumerable<MidiFile> Collection of MidiFile where each file contains events for single channel and meta and sysex ones as defined by settings.
    Remarks
    All channel events (ChannelEvent) will be grouped by channel and then events for each channel will be placed to separate files. So each new file will contain channel events for single channel. If CopyNonChannelEventsToEachFile of settings set to true (default value), each new file will also contain all non-channel events from the original file. If an input file doesn't contain channel events, result file will be just a copy of the input one.
    Exceptions
    Type Condition
    ArgumentNullException midiFile is null.

    SplitByChunks(MidiFile, SplitFileByChunksSettings)

    Splits MidiFile by chunks within it.
    Declaration
    public static IEnumerable<MidiFile> SplitByChunks(this MidiFile midiFile, SplitFileByChunksSettings settings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split.
    SplitFileByChunksSettings settings Settings according to which MIDI file should be split.
    Returns
    Type Description
    IEnumerable<MidiFile> Collection of MidiFile where each file contains single chunk from the original file.
    Exceptions
    Type Condition
    ArgumentNullException midiFile is null.

    SplitByGrid(MidiFile, IGrid, SliceMidiFileSettings)

    Splits MidiFile by the specified grid. More info in the MIDI file splitting: SplitByGrid article.
    Declaration
    public static IEnumerable<MidiFile> SplitByGrid(this MidiFile midiFile, IGrid grid, SliceMidiFileSettings settings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split.
    IGrid grid Grid to split midiFile by.
    SliceMidiFileSettings settings Settings according to which file should be split.
    Returns
    Type Description
    IEnumerable<MidiFile> Collection of MidiFile produced during splitting the input file by grid.
    Remarks
    Non-track chunks will not be copied to any of the new files.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • grid is null.

    SplitByObjects(MidiFile, ObjectType, SplitByObjectsSettings, ObjectDetectionSettings)

    Splits MidiFile by objects. More info in the MIDI file splitting: SplitByObjects article.
    Declaration
    public static IEnumerable<MidiFile> SplitByObjects(this MidiFile midiFile, ObjectType objectType, SplitByObjectsSettings settings = null, ObjectDetectionSettings objectDetectionSettings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split.
    ObjectType objectType Combination of desired types of objects to split by.
    SplitByObjectsSettings settings Settings according to which notes should be detected and built.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Returns
    Type Description
    IEnumerable<MidiFile> Collection of MidiFile where each file contains objects as defined by settings.
    Exceptions
    Type Condition
    ArgumentNullException midiFile is null.

    SplitObjectsAtDistance(MidiFile, ObjectType, ITimeSpan, LengthedObjectTarget, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a MidiFile at the specified distance from an object's start or end. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static void SplitObjectsAtDistance(this MidiFile midiFile, ObjectType objectType, ITimeSpan distance, LengthedObjectTarget from, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split objects within.
    ObjectType objectType The type of objects to split.
    ITimeSpan distance Distance to split objects at.
    LengthedObjectTarget from Point of an object distance should be measured from.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • distance is null.
    InvalidEnumArgumentException from specified an invalid value.

    SplitObjectsAtDistance(MidiFile, ObjectType, double, TimeSpanType, LengthedObjectTarget, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a MidiFile by the specified ratio of an object's length measuring it from the object's start or end. For example, 0.5 means splitting at the center of an object. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static void SplitObjectsAtDistance(this MidiFile midiFile, ObjectType objectType, double ratio, TimeSpanType lengthType, LengthedObjectTarget from, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split objects within.
    ObjectType objectType The type of objects to split.
    double ratio Ratio of an object's length to split by. Valid values are from 0 to 1.
    TimeSpanType lengthType The type an object's length should be processed according to.
    LengthedObjectTarget from Point of an object distance should be measured from.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Exceptions
    Type Condition
    ArgumentNullException midiFile is null.
    ArgumentOutOfRangeException ratio is out of valid range.
    InvalidEnumArgumentException

    One of the following errors occurred:

    • lengthType specified an invalid value.
    • from specified an invalid value.

    SplitObjectsAtDistance(TrackChunk, ObjectType, ITimeSpan, LengthedObjectTarget, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a TrackChunk at the specified distance from an object's start or end. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static void SplitObjectsAtDistance(this TrackChunk trackChunk, ObjectType objectType, ITimeSpan distance, LengthedObjectTarget from, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    TrackChunk trackChunk TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    ITimeSpan distance Distance to split objects at.
    LengthedObjectTarget from Point of an object distance should be measured from.
    TempoMap tempoMap Tempo map used for distances calculations.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunk is null.
    • distance is null.
    • tempoMap is null.
    InvalidEnumArgumentException from specified an invalid value.

    SplitObjectsAtDistance(TrackChunk, ObjectType, double, TimeSpanType, LengthedObjectTarget, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a TrackChunk by the specified ratio of an object's length measuring it from the object's start or end. For example, 0.5 means splitting at the center of an object. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static void SplitObjectsAtDistance(this TrackChunk trackChunk, ObjectType objectType, double ratio, TimeSpanType lengthType, LengthedObjectTarget from, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    TrackChunk trackChunk TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    double ratio Ratio of an object's length to split by. Valid values are from 0 to 1.
    TimeSpanType lengthType The type an object's length should be processed according to.
    LengthedObjectTarget from Point of an object distance should be measured from.
    TempoMap tempoMap Tempo map used for distances calculations.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunk is null.
    • tempoMap is null.
    ArgumentOutOfRangeException ratio is out of valid range.
    InvalidEnumArgumentException

    One of the following errors occurred:

    • lengthType specified an invalid value.
    • from specified an invalid value.

    SplitObjectsAtDistance(IEnumerable<TrackChunk>, ObjectType, ITimeSpan, LengthedObjectTarget, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a collection of TrackChunk at the specified distance from an object's start or end. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static void SplitObjectsAtDistance(this IEnumerable<TrackChunk> trackChunks, ObjectType objectType, ITimeSpan distance, LengthedObjectTarget from, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<TrackChunk> trackChunks A collection of TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    ITimeSpan distance Distance to split objects at.
    LengthedObjectTarget from Point of an object distance should be measured from.
    TempoMap tempoMap Tempo map used for distances calculations.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunks is null.
    • distance is null.
    • tempoMap is null.
    InvalidEnumArgumentException from specified an invalid value.

    SplitObjectsAtDistance(IEnumerable<TrackChunk>, ObjectType, double, TimeSpanType, LengthedObjectTarget, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a collection of TrackChunk by the specified ratio of an object's length measuring it from the object's start or end. For example, 0.5 means splitting at the center of an object. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static void SplitObjectsAtDistance(this IEnumerable<TrackChunk> trackChunks, ObjectType objectType, double ratio, TimeSpanType lengthType, LengthedObjectTarget from, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<TrackChunk> trackChunks A collection of TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    double ratio Ratio of an object's length to split by. Valid values are from 0 to 1.
    TimeSpanType lengthType The type an object's length should be processed according to.
    LengthedObjectTarget from Point of an object distance should be measured from.
    TempoMap tempoMap Tempo map used for distances calculations.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunks is null.
    • tempoMap is null.
    ArgumentOutOfRangeException ratio is out of valid range.
    InvalidEnumArgumentException

    One of the following errors occurred:

    • lengthType specified an invalid value.
    • from specified an invalid value.

    SplitObjectsAtDistance(IEnumerable<ITimedObject>, ITimeSpan, LengthedObjectTarget, TempoMap, Predicate<ITimedObject>)

    Splits objects at the specified distance from an object's start or end. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static IEnumerable<ITimedObject> SplitObjectsAtDistance(this IEnumerable<ITimedObject> objects, ITimeSpan distance, LengthedObjectTarget from, TempoMap tempoMap, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<ITimedObject> objects Objects to split.
    ITimeSpan distance Distance to split objects at.
    LengthedObjectTarget from Point of an object distance should be measured from.
    TempoMap tempoMap Tempo map used for distances calculations.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Returns
    Type Description
    IEnumerable<ITimedObject> Objects that are result of splitting objects going in the same order as elements of objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • objects is null.
    • distance is null.
    • tempoMap is null.
    InvalidEnumArgumentException from specified an invalid value.

    SplitObjectsAtDistance(IEnumerable<ITimedObject>, double, TimeSpanType, LengthedObjectTarget, TempoMap, Predicate<ITimedObject>)

    Splits objects by the specified ratio of an object's length measuring it from the object's start or end. For example, 0.5 means splitting at the center of an object. More info in the Objects splitting: SplitObjectsAtDistance article.
    Declaration
    public static IEnumerable<ITimedObject> SplitObjectsAtDistance(this IEnumerable<ITimedObject> objects, double ratio, TimeSpanType lengthType, LengthedObjectTarget from, TempoMap tempoMap, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<ITimedObject> objects Objects to split.
    double ratio Ratio of an object's length to split by. Valid values are from 0 to 1.
    TimeSpanType lengthType The type an object's length should be processed according to.
    LengthedObjectTarget from Point of an object distance should be measured from.
    TempoMap tempoMap Tempo map used for distances calculations.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Returns
    Type Description
    IEnumerable<ITimedObject> Objects that are result of splitting objects going in the same order as elements of objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • objects is null.
    • tempoMap is null.
    ArgumentOutOfRangeException ratio is out of valid range.
    InvalidEnumArgumentException

    One of the following errors occurred:

    • lengthType specified an invalid value.
    • from specified an invalid value.

    SplitObjectsByGrid(MidiFile, ObjectType, IGrid, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a MidiFile by the specified grid. More info in the Objects splitting: SplitObjectsByGrid article.
    Declaration
    public static void SplitObjectsByGrid(this MidiFile midiFile, ObjectType objectType, IGrid grid, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split objects within.
    ObjectType objectType The type of objects to split.
    IGrid grid Grid to split objects by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls will not be split and will be returned as nulls.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • grid is null.

    SplitObjectsByGrid(TrackChunk, ObjectType, IGrid, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a TrackChunk by the specified grid. More info in the Objects splitting: SplitObjectsByGrid article.
    Declaration
    public static void SplitObjectsByGrid(this TrackChunk trackChunk, ObjectType objectType, IGrid grid, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    TrackChunk trackChunk TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    IGrid grid Grid to split objects by.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls will not be split and will be returned as nulls.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunk is null.
    • grid is null.
    • tempoMap is null.

    SplitObjectsByGrid(IEnumerable<TrackChunk>, ObjectType, IGrid, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a collection of TrackChunk by the specified grid. More info in the Objects splitting: SplitObjectsByGrid article.
    Declaration
    public static void SplitObjectsByGrid(this IEnumerable<TrackChunk> trackChunks, ObjectType objectType, IGrid grid, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<TrackChunk> trackChunks A collection of TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    IGrid grid Grid to split objects by.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls will not be split and will be returned as nulls.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunks is null.
    • grid is null.
    • tempoMap is null.

    SplitObjectsByGrid(IEnumerable<ITimedObject>, IGrid, TempoMap, Predicate<ITimedObject>)

    Splits objects by the specified grid. More info in the Objects splitting: SplitObjectsByGrid article.
    Declaration
    public static IEnumerable<ITimedObject> SplitObjectsByGrid(this IEnumerable<ITimedObject> objects, IGrid grid, TempoMap tempoMap, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<ITimedObject> objects Objects to split.
    IGrid grid Grid to split objects by.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Returns
    Type Description
    IEnumerable<ITimedObject> Objects that are result of splitting objects going in the same order as elements of objects.
    Remarks
    Nulls will not be split and will be returned as nulls.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • objects is null.
    • grid is null.
    • tempoMap is null.

    SplitObjectsByPartsNumber(MidiFile, ObjectType, int, TimeSpanType, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a MidiFile into the specified number of parts of the equal length. More info in the Objects splitting: SplitObjectsByPartsNumber article.
    Declaration
    public static void SplitObjectsByPartsNumber(this MidiFile midiFile, ObjectType objectType, int partsNumber, TimeSpanType lengthType, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split objects within.
    ObjectType objectType The type of objects to split.
    int partsNumber The number of parts to split objects into.
    TimeSpanType lengthType Type of a part's length.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls will not be split and will be returned as nulls. If an object has zero length, it will be split into the specified number of parts of zero length.
    Exceptions
    Type Condition
    ArgumentNullException midiFile is null.
    ArgumentOutOfRangeException partsNumber is zero or negative.
    InvalidEnumArgumentException lengthType specified an invalid value.

    SplitObjectsByPartsNumber(TrackChunk, ObjectType, int, TimeSpanType, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a TrackChunk into the specified number of parts of the equal length. More info in the Objects splitting: SplitObjectsByPartsNumber article.
    Declaration
    public static void SplitObjectsByPartsNumber(this TrackChunk trackChunk, ObjectType objectType, int partsNumber, TimeSpanType lengthType, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    TrackChunk trackChunk TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    int partsNumber The number of parts to split objects into.
    TimeSpanType lengthType Type of a part's length.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls will not be split and will be returned as nulls. If an object has zero length, it will be split into the specified number of parts of zero length.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunk is null.
    • tempoMap is null.
    ArgumentOutOfRangeException partsNumber is zero or negative.
    InvalidEnumArgumentException lengthType specified an invalid value.

    SplitObjectsByPartsNumber(IEnumerable<TrackChunk>, ObjectType, int, TimeSpanType, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a collection of TrackChunk into the specified number of parts of the equal length. More info in the Objects splitting: SplitObjectsByPartsNumber article.
    Declaration
    public static void SplitObjectsByPartsNumber(this IEnumerable<TrackChunk> trackChunks, ObjectType objectType, int partsNumber, TimeSpanType lengthType, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<TrackChunk> trackChunks A collection of TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    int partsNumber The number of parts to split objects into.
    TimeSpanType lengthType Type of a part's length.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls will not be split and will be returned as nulls. If an object has zero length, it will be split into the specified number of parts of zero length.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunks is null.
    • tempoMap is null.
    ArgumentOutOfRangeException partsNumber is zero or negative.
    InvalidEnumArgumentException lengthType specified an invalid value.

    SplitObjectsByPartsNumber(IEnumerable<ITimedObject>, int, TimeSpanType, TempoMap, Predicate<ITimedObject>)

    Splits objects into the specified number of parts of the equal length. More info in the Objects splitting: SplitObjectsByPartsNumber article.
    Declaration
    public static IEnumerable<ITimedObject> SplitObjectsByPartsNumber(this IEnumerable<ITimedObject> objects, int partsNumber, TimeSpanType lengthType, TempoMap tempoMap, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<ITimedObject> objects Objects to split.
    int partsNumber The number of parts to split objects into.
    TimeSpanType lengthType Type of a part's length.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Returns
    Type Description
    IEnumerable<ITimedObject> Objects that are result of splitting objects going in the same order as elements of objects.
    Remarks
    Nulls will not be split and will be returned as nulls. If an object has zero length, it will be split into the specified number of parts of zero length.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • objects is null.
    • tempoMap is null.
    ArgumentOutOfRangeException partsNumber is zero or negative.
    InvalidEnumArgumentException lengthType specified an invalid value.

    SplitObjectsByStep(MidiFile, ObjectType, ITimeSpan, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a MidiFile by the specified step so every object will be split at points equally distanced from each other starting from the object's start time. More info in the Objects splitting: SplitObjectsByStep article.
    Declaration
    public static void SplitObjectsByStep(this MidiFile midiFile, ObjectType objectType, ITimeSpan step, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to split objects within.
    ObjectType objectType The type of objects to split.
    ITimeSpan step Step to split objects by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls, objects with zero length and objects with length smaller than step will not be split and will be returned as clones of the input objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • step is null.

    SplitObjectsByStep(TrackChunk, ObjectType, ITimeSpan, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a TrackChunk by the specified step so every object will be split at points equally distanced from each other starting from the object's start time. More info in the Objects splitting: SplitObjectsByStep article.
    Declaration
    public static void SplitObjectsByStep(this TrackChunk trackChunk, ObjectType objectType, ITimeSpan step, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    TrackChunk trackChunk TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    ITimeSpan step Step to split objects by.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls, objects with zero length and objects with length smaller than step will not be split and will be returned as clones of the input objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunk is null.
    • step is null.
    • tempoMap is null.

    SplitObjectsByStep(IEnumerable<TrackChunk>, ObjectType, ITimeSpan, TempoMap, ObjectDetectionSettings, Predicate<ITimedObject>)

    Splits objects within a collection of TrackChunk by the specified step so every object will be split at points equally distanced from each other starting from the object's start time. More info in the Objects splitting: SplitObjectsByStep article.
    Declaration
    public static void SplitObjectsByStep(this IEnumerable<TrackChunk> trackChunks, ObjectType objectType, ITimeSpan step, TempoMap tempoMap, ObjectDetectionSettings objectDetectionSettings = null, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<TrackChunk> trackChunks A collection of TrackChunk to split objects within.
    ObjectType objectType The type of objects to split.
    ITimeSpan step Step to split objects by.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    ObjectDetectionSettings objectDetectionSettings Settings according to which objects should be detected and built.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Remarks
    Nulls, objects with zero length and objects with length smaller than step will not be split and will be returned as clones of the input objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • trackChunks is null.
    • step is null.
    • tempoMap is null.

    SplitObjectsByStep(IEnumerable<ITimedObject>, ITimeSpan, TempoMap, Predicate<ITimedObject>)

    Splits objects by the specified step so every object will be split at points equally distanced from each other starting from the object's start time. More info in the Objects splitting: SplitObjectsByStep article.
    Declaration
    public static IEnumerable<ITimedObject> SplitObjectsByStep(this IEnumerable<ITimedObject> objects, ITimeSpan step, TempoMap tempoMap, Predicate<ITimedObject> filter = null)
    Parameters
    Type Name Description
    IEnumerable<ITimedObject> objects Objects to split.
    ITimeSpan step Step to split objects by.
    TempoMap tempoMap Tempo map used to calculate times to split by.
    Predicate<ITimedObject> filter Predicate used to determine whether an object should be split or not. true as a return value of the predicate means an object should be split; false means don't split it. null (the default value) can be passed to the parameter to process all objects.
    Returns
    Type Description
    IEnumerable<ITimedObject> Objects that are result of splitting objects going in the same order as elements of objects.
    Remarks
    Nulls, objects with zero length and objects with length smaller than step will not be split and will be returned as clones of the input objects.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • objects is null.
    • step is null.
    • tempoMap is null.

    TakePart(MidiFile, ITimeSpan, ITimeSpan, SliceMidiFileSettings)

    Takes a part of the specified length of a MIDI file (starting at the specified time within the file) and returns it as an instance of MidiFile. More info in the MIDI file splitting: TakePart article.
    Declaration
    public static MidiFile TakePart(this MidiFile midiFile, ITimeSpan partStart, ITimeSpan partLength, SliceMidiFileSettings settings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to take part of.
    ITimeSpan partStart The start time of part to take.
    ITimeSpan partLength The length of part to take.
    SliceMidiFileSettings settings Settings according to which midiFile should be split.
    Returns
    Type Description
    MidiFile MidiFile which is part of the midiFile.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • partStart is null.
    • partLength is null.

    TakePart(MidiFile, ITimeSpan, SliceMidiFileSettings)

    Takes part of the specified length of a MIDI file (starting at the beginning of the file) and returns it as an instance of MidiFile. More info in the MIDI file splitting: TakePart article.
    Declaration
    public static MidiFile TakePart(this MidiFile midiFile, ITimeSpan partLength, SliceMidiFileSettings settings = null)
    Parameters
    Type Name Description
    MidiFile midiFile MidiFile to take part of.
    ITimeSpan partLength The length of part to take.
    SliceMidiFileSettings settings Settings according to which midiFile should be split.
    Returns
    Type Description
    MidiFile MidiFile which is part of the midiFile.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • midiFile is null.
    • partLength is null.
    In this article
    Back to top 2024 / Generated by DocFX