Skip to content

Releases: melanchall/drywetmidi

DryWetMIDI 5.1.0

13 Mar 17:43

Choose a tag to compare

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.

DryWetMIDI 5.0.0

21 Nov 17:34

Choose a tag to compare

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

Read more

DryWetMIDI 4.1.1

31 Jul 19:06

Choose a tag to compare

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.

DryWetMIDI 4.1.0

22 Apr 20:58

Choose a tag to compare

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.

DryWetMIDI 4.0.0

30 Jan 13:39

Choose a tag to compare

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).

DryWetMIDI 3.1.0

08 Jul 19:24

Choose a tag to compare

New features

  • New tools:
  • ResizeNotes method to resize group of notes to the specified length treating all notes as single object.
  • GetNotesAndRests method to iterate through the specified collection of notes returning instances of Note and Rest where rests calculated using the specified policy.
  • OnObjectQuantizing method of the quantizer classes has now quantizedTime parameter of the QuantizedTime type which holds information about new time for an object (see Custom quantizing to learn more).
  • QuantizingLevel setting was added to quantizer settings which allows to specify how close an object should be moved to nearest grid time.

Minor changes

  • MakeNotes method was renamed to GetTimedEventsAndNotes.
  • Added Clone method to MidiFile and MidiChunk.
  • Added Divide method to MidiTimeSpan, MetricTimeSpan and MusicalTimeSpan which takes another time span of the same type to produce ratio between time spans.
  • Added ChangeDenominator method to MusicalTimeSpan which returns an instance of the MusicalTimeSpan that represents the same time span as original one but with the specified denominator.
  • Removed setters from ITimedObject.Time and ILengthedObject.Length properties (setters on implementations still exist).
  • Implemented IEnumerable<T> on ValueLine and removed Values property.

DryWetMIDI 3.0.0

11 Jun 16:31

Choose a tag to compare

New features

  • Added tools to perform complex tasks. Please read Tools section of the Wiki to learn more and check Melanchall.DryWetMidi.Tools namespace. These tools are:
  • Added music theory API. Check Melanchall.DryWetMidi.MusicTheory namespace. Also NoteDefinition, IntervalDefinition and OctaveDefinition classes were renamed to Note, Interval and Octave respectively and moved to this new namespace.
  • Added General MIDI Level 1/2 support API. Check Melanchall.DryWetMidi.Standards namespace.
  • Added SetProgram method to PatternBuilder class. This method can be used in conjunction with the new GM 1/2 support API mentioned above.
  • Added AddNotes, AddChords and AddTimedEvents methods to TimedEventsManagingUtilities, NotesManagingUtilities and ChordsManagingUtilities classes respectively.
  • Added ToFile and ToTrackChunk methods to TimedEventsManagingUtilities, NotesManagingUtilities and ChordsManagingUtilities classes respectively.
  • Added Clone method to Note, Chord and TimedEvent classes.
  • Added TimeAs and LengthAs non-generic methods where the desired type of result should be passed as an argument of the TimeSpanType type. Added non-generic versions of methods inside TimeConverter and LengthConverter classes that take TimeSpanType too.
  • Implemented IComparable, IComparable<T> and IEquatable<T> on time span classes.
  • Added MakeNotes method to the NotesManagingUtilities class which iterates through the specified collection of TimedEvent returning Note for Note On/Note Off events pairs and original TimedEvent for all other events.

Minor changes

  • Time and length conversions between different representations were significantly speeded up.
  • Eliminated unnecessary resorting in ValueLine.Values getter.
  • Eliminated reordering in GetNotes, GetChords and GetTimedEvents methods.
  • FourBitNumber and SevenBitNumber moved to the Melanchall.DryWetMidi.Common namespace.

DryWetMIDI 2.0.1

03 Dec 19:46

Choose a tag to compare

This a minor release which has the following changes:

  1. Target .NET Framework version was changed to 4.5 from 4.6.1.
  2. C# language version was changed to 6 from 7.

.NET Framework 4.5 and C# 6 allow to cover more development cases. For example, it's now possible to use the library in Unity 2017.x.

DryWetMIDI 2.0.0

06 Nov 19:14

Choose a tag to compare

Breaking changes

Time and length classes were generalized with time span classes. Now there is no difference between time and length since time is just a length started at zero. Time span describes both time and length and has following representations:

  • MetricTimeSpan for time span in terms of microseconds;
  • BarBeatTimeSpan for time span in terms of number of bars, beats and ticks;
  • MusicalTimeSpan for time span in terms of a fraction of the whole note length;
  • MidiTimeSpan exists for unification purposes and simply holds long value in units defined by the time division of a file.

Read updated section of the Wiki about time and length to learn more.

Minor changes

  • Lyrics and Marker methods were added to the PatternBuilder.
  • Chord methods taking root note's name were added to the PatternBuilder.
  • Fixed combining of LSB and MSB of the PitchBendEvent's PitchValue.

DryWetMIDI 1.3.0

24 Aug 10:49

Choose a tag to compare

Pattern

DryWetMIDI provides now a way to program music compositions based on MIDI. The PatternBuilder allows to insert notes, chords and another Pattern objects built with the PatternBuilder. See more details in the Pattern page of the library Wiki.

A quick example of what you can do with patterns:

Pattern pattern = new PatternBuilder()
     
    // Insert a pause of 5 seconds
    .StepForward(new MetricLength(0, 0, 5))

    // Insert an eighth C# note of the 4th octave
    .Note(OctaveDefinition.Get(4).CSharp, (MusicalLength)MusicalFraction.Eighth)

    // Set default note length to triplet eighth and default octave to 5
    .SetNoteLength((MusicalLength)MusicalFraction.EighthTriplet)
    .SetOctave(5)

    // Now we can add triplet eighth notes of the 5th octave in a simple way
    .Note(NoteName.A)
    .Note(NoteName.B)
    .Note(NoteName.GSharp)

    // Get pattern
    .Build();

MidiFile midiFile = pattern.ToFile(TempoMap.Default);

Minor changes

  • Added MathTime and MathLength.
  • Added ability to manage new tempo map.
  • Added ability to replace existing tempo map with another one.
  • Added Channel, Velocity and OffVelocity properties to the Chord.
  • Added setter to Chord's Length property.
  • Methods of LengthConverter can now take ITime as time argument.
  • Removed Equals and GetHashCode overridings from the event classes.

Fixed bugs

  • Fixed chords search ignores channel of notes.
  • Fixed wrong conversion to MusicalTime if time is exact start of a bar.