Search Results for

    Obsolete API

    Here the table of API that is obsolete and thus either will be removed from the library by a next release or already removed from the DryWetMIDI. Title of each obsolete API is just ID, please see description to see an old API and new replacement.

    OBS19

    Important

    API removed from the library by 7.0.0 release.

    Splitter.SplitByNotes method is now obsolere since it has been replaced by Splitter.SplitByObjects one which can split a MIDI file by objects of difefrent types and with more flexibility.

    Simple example of how to split a file by notes with the new tool:

    var newFiles = midiFile.SplitByObjects(ObjectType.Note);
    

    To split ignoring a note's channel:

    var newFiles = midiFile.SplitByObjects(
        ObjectType.Note,
        new SplitByObjectsSettings
        {
            KeySelector = obj => ObjectIdUtilities.GetObjectId(((Note)obj).NoteNumber)
        });
    

    To split by notes with all other events transferred to each new file:

    var newFiles = midiFile.SplitByObjects(
        ObjectType.Note | ObjectType.TimedEvent,
        new SplitByObjectsSettings
        {
            KeySelector = obj => ObjectIdUtilities.GetObjectId(((Note)obj).NoteNumber),
            WriteToAllFilesPredicate = obj => obj is TimedEvent
        });
    

    Obsolete from version 6.1.1.

    Old API

    • Splitter.SplitByNotes

    New API

    • Splitter.SplitByObjects

    OBS18

    Important

    API removed from the library by 7.0.0 release.

    ResizeNotesUtilities class and its methods have been generalized by the Resizer class which can resize groups of objects of different types simultaneously.

    Quick example of how to resize objects group using the new tool:

    objects.ResizeObjectsGroup(
        new MetricTimeSpan(0, 1, 0),
        TempoMap.Default,
        new ObjectsGroupResizingSettings
        {
            DistanceCalculationType = TimeSpanType.Metric
        });
    

    Obsolete from version 6.1.1.

    Old API

    • ResizeNotesUtilities

    New API

    • Resizer
    • Resizer.ResizeObjectsGroup

    OBS17

    Important

    API removed from the library by 7.0.0 release.

    NotesMerger class has been generalized by the Merger class which can merge objects of different types simultaneously.

    To merge objects within a collection of timed objects:

    var newObjects = objects.MergeObjects(
        TempoMap.Default,
        new ObjectsMergingSettings
        {
            Tolerance = new MetricTimeSpan(0, 0, 1)
        });
    

    Quick example of how to merge notes within a MIDI file with the new tool:

    midiFile.MergeObjects(
        ObjectType.Note,
        new ObjectsMergingSettings
        {
            VelocityMergingPolicy = VelocityMergingPolicy.Max,
            Tolerance = (MidiTimeSpan)0
        });
    

    Obsolete from version 6.1.1.

    Old API

    • NotesMerger
    • NotesMergerUtilities
    • NotesMergingSettings

    New API

    • Merger
    • Merger.MergeObjects

    OBS16

    Important

    API removed from the library by 7.0.0 release.

    TimedEventsManagingUtilities.AddEvent methods are now obsolete since they are nothing more than just calling TimedEvent constructor and adding a new instance to a collection:

    eventsCollection.Add(new TimedEvent(midiEvent, time));
    

    Obsolete from version 6.1.0.

    Old API

    • TimedEventsManagingUtilities.AddEvent

    New API

    • no

    OBS15

    Important

    API removed from the library by 7.0.0 release.

    SetTimeAndLength separate methods for notes and chords have been replaced with generic SetLength. Since SetTime method also exists, the new way to set time and length with one instruction is:

    note
        .SetTime(new MetricTimeSpan(0, 0, 0, 500), tempoMap)
        .SetLength(new MetricTimeSpan(0, 0, 10), tempoMap);
    

    Obsolete from version 6.1.0.

    Old API

    • NotesManagingUtilities.SetTimeAndLength*
    • ChordsManagingUtilities.SetTimeAndLength*

    New API

    • LengthedObjectUtilities.SetLength

    OBS14

    Important

    API removed from the library by 7.0.0 release.

    TimedEventsManagingUtilities.SetTime method has been replaced with generic TimedObjectUtilities.SetTime allowing to set time for objects of different types, not for only timed events.

    Small example:

    timedEvent.SetTime(new BarBeatTicksTimeSpan(2), tempoMap);
    note.SetTime(MusicalTimeSpan.Half.SingleDotted(), tempoMap);
    chord.SetTime(new MetricTimeSpan(0, 1, 10), tempoMap);
    

    Obsolete from version 6.1.0.

    Old API

    • TimedEventsManagingUtilities.SetTime

    New API

    • TimedObjectUtilities.SetTime

    OBS13

    Important

    API removed from the library by 7.0.0 release.

    Complex inheritance hierarchy of quantizer classes has been reduced to general-purpose new Quantizer class which can quantize objects of different types at the same time. More than that, it can quantize both start and end time simultaneously.

    For example, to quantize both ends of objects by the grid of 1/8 step:

    var quantizer = new Quantizer();
    quantizer.Quantize(
        objects,
        new SteppedGrid(MusicalTimeSpan.Eighth),
        TempoMap.Default,
        new QuantizingSettings
        {
            Target = QuantizerTarget.Start | QuantizerTarget.End
        });
    

    Of course, there is the new class with utility methods for quantizing objects within a MIDI file or track chunk � QuantizerUtilities. Following example shows how to quantize both ends of notes and chords by the grid of 1 second step within a MIDI file. We'll define a chord as a set of notes with minimum length of 2:

    midiFile.QuantizeObjects(
        ObjectType.Note | ObjectType.Chord,
        new SteppedGrid(new MetricTimeSpan(0, 0, 1)),
        new QuantizingSettings
        {
            Target = QuantizerTarget.Start | QuantizerTarget.End
        },
        new ObjectDetectionSettings
        {
            ChordDetectionSettings = new ChordDetectionSettings
            {
                NotesMinCount = 2
            }
        });
    

    Obsolete from version 6.1.0.

    Old API

    • Quantizer<TObject, TSettings>
    • QuantizingSettings<TObject>
    • LengthedObjectsQuantizer<TObject, TSettings>
    • LengthedObjectsQuantizingSettings<TObject>
    • TimedEventsQuantizer
    • NotesQuantizer
    • ChordsQuantizer
    • TimedEventsQuantizingSettings
    • NotesQuantizingSettings
    • ChordsQuantizingSettings
    • TimedEventsQuantizerUtilities
    • NotesQuantizerUtilities
    • ChordsQuantizerUtilities

    New API

    • Quantizer
    • QuantizingSettings
    • QuantizerUtilities

    OBS12

    Important

    API removed from the library by 7.0.0 release.

    Separate splitter classes for notes and chords have been replaced by Splitter class which can split objects of different types simultaneously.

    For example, to split notes and chords into 4 parts:

    midiFile.SplitObjectsByPartsNumber(
        ObjectType.Note | ObjectType.Chord,
        4,
        TimeSpanType.Metric);
    

    Obsolete from version 6.1.0.

    Old API

    • LengthedObjectsSplitter<TObject>
    • ChordsSplitter
    • NotesSplitter
    • ChordsSplitterUtilities
    • NotesSplitterUtilities

    New API

    • Splitter
    • Splitter.SplitObjectsByStep
    • Splitter.SplitObjectsByGrid
    • Splitter.SplitObjectsAtDistance
    • Splitter.SplitObjectsByPartsNumber

    OBS11

    Important

    API removed from the library by 7.0.0 release.

    Separate manager classes for each MIDI object type are replaced with TimedObjectsManager which can manage objects of different types simultaneously.

    For example, to manage just timed events:

    using (var objectsManager = new TimedObjectsManager(trackChunk.Events, ObjectType.TimedEvent))
    {
        var firstTimedEvent = (TimedEvent)objectsManager.Objects.FirstOrDefault();
    }
    

    or

    using (var objectsManager = new TimedObjectsManager<TimedEvent>(trackChunk.Events))
    {
        var firstTimedEvent = objectsManager.Objects.FirstOrDefault();
    }
    

    To manage both timed events and notes:

    using (var objectsManager = new TimedObjectsManager(trackChunk.Events, ObjectType.TimedEvent | ObjectType.Note))
    {
        var firstObject = objectsManager.Objects.FirstOrDefault();
        if (firstObject is Note note)
        {
            // do smth with note
        }
        else
        {
            // do smth with timed event
        }
    }
    

    Obsolete from version 6.1.0.

    Old API

    • TimedEventsManager
    • NotesManager
    • ChordsManager

    New API

    • TimedObjectsManager

    OBS10

    Important

    API removed from the library by 7.0.0 release.

    Randomizer tool is obsolete now. Randomization feature has been moved to Quantizer so you can quantize and randomize MIDI data at the same time.

    Following small example shows how to randomize timed events and start times of notes in range from -100 to +100 ticks:

    midiFile.QuantizeObjects(
        ObjectType.Note | ObjectType.TimedEvent,
        new ArbitraryGrid(),
        new QuantizingSettings
        {
            RandomizingSettings = new RandomizingSettings
            {
                Bounds = new ConstantBounds((MidiTimeSpan)100)
            }
        });
    

    Obsolete from version 6.1.0.

    Old API

    • Randomizer<TObject, TSettings>
    • RandomizingSettings<TObject>
    • LengthedObjectsRandomizer<TObject, TSettings>
    • LengthedObjectsRandomizingSettings<TObject>
    • TimedEventsRandomizer
    • NotesRandomizer
    • ChordsRandomizer
    • TimedEventsRandomizingSettings
    • NotesRandomizingSettings
    • ChordsRandomizingSettings
    • TimedEventsRandomizerUtilities
    • NotesRandomizerUtilities
    • ChordsRandomizerUtilities

    New API

    • Quantizer
    • QuantizingSettings
    • RandomizingSettings
    • QuantizingSettings.RandomizingSettings
    • QuantizerUtilities

    OBS9

    Important

    API removed from the library by 6.0.0 release.

    AddTimedEvents, AddNotes and AddChords methods are replaced now with single TimedObjectUtilities.AddObjects method which can save objects of different types to events collection or track chunk.

    Obsolete from version 5.2.0.

    Old API

    • TimedEventsManagingUtilities.AddTimedEvents
    • NotesManagingUtilities.AddNotes
    • ChordsManagingUtilities.AddChords

    New API

    • TimedObjectUtilities.AddObjects

    OBS8

    Important

    API removed from the library by 6.0.0 release.

    ToFile methods for collections of objects of one type (for example, collection of TimedEvent or Note instances) are replaced now with single TimedObjectUtilities.ToFile method which can save objects of different types to MIDI file.

    Obsolete from version 5.2.0.

    Old API

    • TimedEventsManagingUtilities.ToFile
    • NotesManagingUtilities.ToFile
    • ChordsManagingUtilities.ToFile

    New API

    • TimedObjectUtilities.ToFile

    OBS7

    Important

    API removed from the library by 6.0.0 release.

    ToTrackChunk methods for collections of objects of one type (for example, collection of TimedEvent or Note instances) are replaced now with single TimedObjectUtilities.ToTrackChunk method which can save objects of different types to track chunk.

    Obsolete from version 5.2.0.

    Old API

    • TimedEventsManagingUtilities.ToTrackChunk
    • NotesManagingUtilities.ToTrackChunk
    • ChordsManagingUtilities.ToTrackChunk

    New API

    • TimedObjectUtilities.ToTrackChunk

    OBS6

    Important

    API removed from the library by 6.0.0 release.

    Methods from GetNotesAndRestsUtilities are now obsolete and you should use GetObjects methods from GetObjectsUtilities. Example how you can get notes and rests:

    var notesAndRests = midiFile.GetObjects(ObjectType.Note | ObjectType.Rest);
    

    RestSeparationPolicy can be specified via ObjectDetectionSettings:

    var notesAndRests = midiFile.GetObjects(
        ObjectType.Note | ObjectType.Rest,
        new ObjectDetectionSettings
        {
            RestDetectionSettings = new RestDetectionSettings
            {
                RestSeparationPolicy = RestSeparationPolicy.SeparateByChannel
            }
        });
    

    Obsolete from version 5.2.0.

    Old API

    • GetNotesAndRestsUtilities

    New API

    • GetObjectsUtilities

    OBS5

    Important

    API removed from the library by 6.0.0 release.

    Methods from GetTimedEventsAndNotesUtilities are now obsolete and you should use GetObjects methods from GetObjectsUtilities. Example how you can get timed events and notes:

    var timedEventsAndNotes = midiFile.GetObjects(ObjectType.TimedEvent | ObjectType.Note);
    

    Obsolete from version 5.2.0.

    Old API

    • GetTimedEventsAndNotesUtilities

    New API

    • GetObjectsUtilities

    OBS4

    Important

    API removed from the library by 6.0.0 release.

    TempoMap.Tempo property has been replaced with more explicit and straightforward methods: GetTempoChanges and GetTempoAtTime:

    foreach (var tempoChange in tempoMap.GetTempoChanges())
    {
        var time = tempoChange.Time;
        var timeSignature = tempoChange.Value;
    }
    
    // ...
    
    tempoMap.GetTempoAtTime(MusicalTimeSpan.Whole);
    

    Obsolete from version 5.1.2.

    Old API

    • TempoMap.Tempo

    New API

    • TempoMap.GetTempoChanges
    • TempoMap.GetTempoAtTime

    OBS3

    Important

    API removed from the library by 6.0.0 release.

    TempoMap.TimeSignature property has been replaced with more explicit and straightforward methods: GetTimeSignatureChanges and GetTimeSignatureAtTime:

    foreach (var timeSignatureChange in tempoMap.GetTimeSignatureChanges())
    {
        var time = timeSignatureChange.Time;
        var timeSignature = timeSignatureChange.Value;
    }
    
    // ...
    
    tempoMap.GetTimeSignatureAtTime(MusicalTimeSpan.Whole);
    

    Obsolete from version 5.1.2.

    Old API

    • TempoMap.TimeSignature

    New API

    • TempoMap.GetTimeSignatureChanges
    • TempoMap.GetTimeSignatureAtTime

    OBS2

    Important

    API removed from the library by 6.0.0 release.

    Now MIDI file reading uses buffering by default so ReaderSettings.ReadFromMemory property is deprecated. By default buffering policy is BufferingPolicy.UseFixedSizeBuffer and BufferSize is 4096 which gives the same reading speed as putting all data in memory. But if you want, you can specify BufferingPolicy = BufferingPolicy.BufferAllData to achieve the same behavior as with ReadFromMemory:

    MidiFile.Read("Great MIDI file.mid", new ReadingSettings
    {
        ReaderSettings = new ReaderSettings
        {
            BufferingPolicy = BufferingPolicy.BufferAllData
        }
    });
    

    Obsolete from version 5.1.2.

    Old API

    • ReaderSettings.ReadFromMemory

    New API

    • ReaderSettings.BufferingPolicy
    • BufferingPolicy
    • BufferingPolicy.BufferAllData

    OBS1

    Important

    API removed from the library by 6.0.0 release.

    WritingSettings.CompressionPolicy has been replaced by corresponding properties of WritingSettings. No compression applied by default, as before.

    For example, to write using running status and write Note Off events as Note On ones with zero velocity we need to write:

    midiFile.Write("Great MIDI file.mid", settings: new WritingSettings
    {
        UseRunningStatus = true,
        NoteOffAsSilentNoteOn = true
    });
    

    Obsolete from version 5.1.2.

    Old API

    • WritingSettings.CompressionPolicy
    • CompressionPolicy

    New API

    • WritingSettings.DeleteDefaultKeySignature
    • WritingSettings.DeleteDefaultSetTempo
    • WritingSettings.DeleteDefaultTimeSignature
    • WritingSettings.DeleteUnknownChunks
    • WritingSettings.DeleteUnknownMetaEvents
    • WritingSettings.NoteOffAsSilentNoteOn
    • WritingSettings.UseRunningStatus
    In this article
    Back to top 2024 / Generated by DocFX