Melanchall Drywetmidi Versions Save

.NET library to read, write, process MIDI files and to work with MIDI devices

v6.0.0

2 years ago

Devices API available for macOS now

DryWetMIDI allows now work with MIDI devices on macOS! More than that, a couple of new classes are available for macOS only:

Also HighPrecisionTickGenerator implemented for macOS too so you can now use Playback with default settings on that platform. Its implementation for macOS is not good (in terms of performance) for now but will be optimized for the next release of the library.

Breaking changes

This version of the library has following breaking changes:

  • Melanchall.DryWetMidi.Devices namespace renamed to Melanchall.DryWetMidi.Multimedia to reflect its content more precisely since not only devices are there.
  • DriverManufacturer, ProductIdentifier and DriverVersion properties were removed from the MidiDevice class and replaced by GetProperty method for InputDevice and for OutputDevice.
  • Channels, DeviceType, NotesNumber, SupportsLeftRightVolumeControl, SupportsPatchCaching, SupportsVolumeControl, VoicesNumber and Volume properties were removed from OutputDevice and replaced by GetProperty method.
  • Removed InvalidSysExEventReceived and InvalidShortEventReceived events from InputDevice and replaced them with ErrorOccurred one.
  • All obsolete APIs were removed from the library.

New features

Small changes and bug fixes

v5.2.1

2 years ago

New features and improvements

Small changes and bug fixes

v5.2.0

3 years ago

Performance

Methods to get, process and remove timed events and notes now work faster and consume less memory. Full tables with benchmarks results can be found here:

New features and improvements

Small changes and bug fixes

  • Some methods are now obsolete:
    • GetTimedEventsAndNotesUtilities (OBS5);
    • GetNotesAndRestsUtilities (OBS6);
    • TimedEventsManagingUtilities.ToTrackChunk, NotesManagingUtilities.ToTrackChunk, ChordsManagingUtilities.ToTrackChunk (OBS7);
    • TimedEventsManagingUtilities.ToFile, NotesManagingUtilities.ToFile, ChordsManagingUtilities.ToFile (OBS8);
    • TimedEventsManagingUtilities.AddTimedEvents, NotesManagingUtilities.AddNotes, ChordsManagingUtilities.AddChords (OBS9).
  • Discard high resolution timer request on playback stop (#106).
  • Implemented ICollection<MidiEvent> on EventsCollection.
  • Implemented ICollection<MidiChunk> on ChunksCollection.
  • Fixed: PatternUtilities.CombineInParallel last action moves back to previous time (#112).
  • Fixed: Playback.MoveToNextSnapPoint works incorrectly for snap point at zero.
  • Fixed: MetricTimeSpan.Clone works incorrectly.
  • Fixed: Wrong order of actual and expected counts arguments on passing to UnexpectedTrackChunksCountException constructor.

v5.1.2

3 years ago

Obsolete API

New section has been added to documentation site: Obsolete. This section contains the list of methods and classes that are obsolete and thus will be removed by a next release.

The current list of obsolete API:

New features and improvements

Small changes and bug fixes

  • Added value validation in setters of some MIDI events classes properties.
  • Edge Note Off events will always be put to current part on MIDI file splitting (#99).
  • Fixed: Events transferred incorrectly between parts on MIDI file splitting (#99).
  • Fixed: SmpteOffsetEvent writes in wrong way.
  • Fixed: SmpteOffsetEvent equality check is wrong.
  • Fixed: Failed to use devices API in UWP app (#95).

v5.1.1

3 years ago

New features

Small changes and bug fixes

  • Chords parsing uses CNT now.
  • Fixed: Multi-thread access to active notes metadata inside Playback can cause exceptions.
  • Fixed: Playback.EventPlayed not fired for meta events (#82).
  • Fixed: Slash chord name contains Sharp instead of # for sharped notes as result of GetNames.

v5.1.0

4 years ago

Performance

MidiFile.Read and MidiFile.Write methods now work much faster (#64). For MidiFile.Read new setting ReadingSettings.ReaderSettings.ReadFromMemory was added:

MidiFile.Read("file.mid", new ReadingSettings
{
    ReaderSettings = new ReaderSettings
    {
        ReadFromMemory = true
    }
});

With ReadFromMemory set to true entire MIDI file will be put to memory and read from there which gives big speed up.

New features

  • Added IInputDevice interface (#54), all methods that accept InputDevice as an argument accept now IInputDevice, which implemented by InputDevice. This interface gives ability to create custom input device implementations.

  • Added IOutputDevice interface, all methods that accept OutputDevice as an argument accept now IOutputDevice, which implemented by OutputDevice. This interface gives ability to create custom output device implementations.

  • Added BytesToMidiEventConverter class to convert bytes to MIDI events (#55).

  • Added MidiEventToBytesConverter class to convert MIDI events to bytes.

  • Added Interaction.Chord.GetMusicTheoryChord method.

  • Added Interaction.Note.GetMusicTheoryNote method.

  • Added Interval.GetIntervalDefinitions method returning collection of IntervalDefinition which is interval number and quality.

  • Added Interval.FromDefinition method to create Interval from interval number and quality.

  • Added MusicTheory.Chord.GetNames method returning names of a chord (for example, A# or Ddim) (#58).

  • Added General MIDI Level 2 percussion API to Melanchall.DryWetMidi.Standards namespace (#65).

  • Added ReadingHandlers property to ReadingSettings which provides collection of objects that handle MIDI data reading. Also added three handler classes:

    • TimedEventsReadingHandler
    • NotesReadingHandler
    • TempoMapReadingHandler

    These classes can speed up getting MIDI data from a MIDI file since information will be gathered during MIDI data reading rather than after data is read which involves additional iteration over MIDI data.

    You can create custom reading handler and process MIDI file reading stages.

  • Added UnknownChannelEventPolicy property to ReadingSettings (#69) which specifies how reading engine should react on unknown channel event status byte. Also added UnknownChannelEvent property which specifies callback that will be called on unknown channel event if UnknownChannelEventPolicy set to UnknownChannelEventPolicy.UseCallback.

  • Added ReaderSettings property to ReadingSettings. ReaderSettings holds I/O settings for MIDI data reader.

  • Implemented reading MIDI file from non-seekable stream. Settings related to reading from such streams are placed at ReadingSettings.ReaderSettings. Names of properties corresponding to these settings are start with NonSeekableStream.

  • Added Equals static methods for MidiEvent, MidiChunk and MidiFile classes.

  • Added PatternUtilities.TransformNotes accepting NoteSelection which is predicate to select notes to transform.

  • Added PatternUtilities.TransformChords accepting ChordSelection which is predicate to select chords to transform.

  • Added PatternUtilities.SetNotesState method (#74).

  • Added PatternUtilities.SetChordsState method.

  • Pattern.Clone creates now deep copy instead of shallow one.

  • Added GetStandardChunkIds static method to MidiChunk.

  • Added GetStandardMetaEventStatusBytes static method to MetaEvent.

Small changes and bug fixes

  • Implemented IComparable on Interval.
  • Implemented IComparable on MusicTheory.Note.
  • Prevent creation of sysex event with status byte as a first data byte.
  • Fixed: Playback looped on current time change inside EventPlayed event handler (#56).
  • Fixed: CsvConverter closes passed stream after data is read or written (#73).
  • Fixed: OutputDevice.Volume get/set fails (#75).
  • Fixed: ResetEvent not received by input device.
  • Fixed: Fixed CSV parsing with \r and \n in texts of meta events.

v5.0.0

4 years ago

Breaking changes

This version of the library has breaking changes:

Documentation

From now you can read complete library documentation on https://melanchall.github.io/drywetmidi. Here you can find information about every class and members of the library. API documentation is placed in API Documentation section.

Right now it's not full replacement for the library Wiki so please don't forget to look at Wiki also when you want to get more information on some topic.

New features

Small changes and bug fixes

  • Improved GetHashCode implementation for the library classes.
  • Fixed: notes order is invalid on collecting by NotesManager when notes are overlapped.
  • Fixed: PatternBuilder.MoveToPreviousTime doesn't work.
  • Fixed: playback starts immidiately if first event is meta event with delta-time greater than zero (#37).

v4.1.1

4 years ago

This is a minor release. Changes are listed below.

  • Added DecodeTextCallback to ReadingSettings (#27).
  • Added GetChannels extension method for TrackChunk and MidiFile.
  • DevicesConnector allows connect one input device to several output devices now.
  • Added EventType property to MidiEvent which allow to check MIDI event type without using as or is operators.
  • Playback.OutputDevice is optional now and can be set to null.
  • Added SmfConstants.DefaultEncoding constant which holds default encoding of text in MIDI file.
  • Fixed: stream is disposed when passed to MidiFile.Read/MidiFile.Write.
  • Fixed: playback events are sorted incorrectly which leads to some notes are dropped on MIDI file playback.

v4.1.0

5 years ago

New features

  • Added GetTimedEvents, GetNotes and GetChords extension methods for IEnumerable<MidiEvent>.
  • Added IsEmpty extension method for MidiFile.
  • Added GetDuration extension method for MidiFile.
  • Removed NoteStopPolicy property from Playback.
  • Added InterruptNotesOnStop property to Playback.
  • Added TrackNotes property to Playback.
  • Added NotesPlaybackStarted/NotesPlaybackFinished events to Playback.
  • Added Playback constructor with IEnumerable<ITimedObject> as an argument.
  • Added SetTime extension method for TimedEvent.
  • Added SetTimeAndLength extension method for Note and Chord.
  • Added channel parameter to methods to get program change events by GM programs and to methods to get control change events.
  • Added GetPlayback/Play extension methods for IEnumerable<Note> and IEnumerable<Chord>.
  • Added setter to OutputDevice property of Playback.
  • Implemented parsing metric time spans in 'h m s ms' format (for example, 3h5m56s897ms).
  • Added BarBeatTimeSpan constructor that takes bars number only.
  • Added Notes class that holds all available Notes.
  • Added SkipPart and TakePart extension methods for MidiFile.
  • Implemented snapping features for Playback.
  • Added EndTimeAs extension method for ILengthedObject.

Small changes and bug fixes

  • Implemented IConvertible on FourBitNumber and SevenBitNumber.
  • Moved IGrid along with its implementations from Tools namespace to Smf.Interaction.
  • Fixed: channel not set on program change events in Pattern.
  • Fixed: last part of MidiFile is lost when splitting file with ArbitraryGrid.
  • Fixed: sameTimeEventsComparison is ignored when managing timed events.
  • Fixed: non-note events are not preceding note ones on exporting Pattern to TrackChunk.
  • Fixed: quantizing with musical distance calculation type is failed.
  • Fixed: musical time spans comparison can lead to long overflow.

v4.0.0

5 years ago

Devices API

DryWetMIDI 4.0.0 introduces API for working with MIDI devices. Now it is possible to send MIDI data to and receive it from a MIDI device. Also added methods to play MIDI files and capture incoming events from a device.

Read about working with devices on the library Wiki:

New features

  • Added GetTimedEventsAndNotes and GetNotesAndRests extension methods for TrackChunk and MidiFile.
  • Added conversion notes to/from CSV.
  • Added Parse/TryParse methods to FourBitNumber and SevenBitNumber.
  • Added ShiftEvents extension methods for TrackChunk and MidiFile which shifts MIDI events inside MidiFile by the specified distance.
  • Implemented resizing notes by ratio.
  • Added Resize extension method for MidiFile which resizes MidiFile to the specified length or by specified ratio (for example, 0.5 means shrinking to the half of the original length).
  • Implemented splitting notes/chords at distance.
  • Added GetChords extension method for IEnumerable<Note> which makes chords from notes collection.
  • Added new MIDI events classes: system common and system real-time.

Small changes and bug fixes

  • Fixed last chord missing on chords collection (#15).