Releases: melanchall/drywetmidi
DryWetMIDI 5.1.0
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
IInputDeviceinterface (#54), all methods that acceptInputDeviceas an argument accept nowIInputDevice, which implemented byInputDevice. This interface gives ability to create custom input device implementations. -
Added
IOutputDeviceinterface, all methods that acceptOutputDeviceas an argument accept nowIOutputDevice, which implemented byOutputDevice. This interface gives ability to create custom output device implementations. -
Added
BytesToMidiEventConverterclass to convert bytes to MIDI events (#55). -
Added
MidiEventToBytesConverterclass to convert MIDI events to bytes. -
Added
Interaction.Chord.GetMusicTheoryChordmethod. -
Added
Interaction.Note.GetMusicTheoryNotemethod. -
Added
Interval.GetIntervalDefinitionsmethod returning collection ofIntervalDefinitionwhich is interval number and quality. -
Added
Interval.FromDefinitionmethod to createIntervalfrom interval number and quality. -
Added
MusicTheory.Chord.GetNamesmethod returning names of a chord (for example,A#orDdim) (#58). -
Added General MIDI Level 2 percussion API to
Melanchall.DryWetMidi.Standardsnamespace (#65). -
Added
ReadingHandlersproperty toReadingSettingswhich provides collection of objects that handle MIDI data reading. Also added three handler classes:TimedEventsReadingHandlerNotesReadingHandlerTempoMapReadingHandler
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
UnknownChannelEventPolicyproperty toReadingSettings(#69) which specifies how reading engine should react on unknown channel event status byte. Also addedUnknownChannelEventproperty which specifies callback that will be called on unknown channel event ifUnknownChannelEventPolicyset toUnknownChannelEventPolicy.UseCallback. -
Added
ReaderSettingsproperty toReadingSettings.ReaderSettingsholds 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 withNonSeekableStream. -
Added
Equalsstatic methods forMidiEvent,MidiChunkandMidiFileclasses. -
Added
PatternUtilities.TransformNotesacceptingNoteSelectionwhich is predicate to select notes to transform. -
Added
PatternUtilities.TransformChordsacceptingChordSelectionwhich is predicate to select chords to transform. -
Added
PatternUtilities.SetNotesStatemethod (#74). -
Added
PatternUtilities.SetChordsStatemethod. -
Pattern.Clonecreates now deep copy instead of shallow one. -
Added
GetStandardChunkIdsstatic method toMidiChunk. -
Added
GetStandardMetaEventStatusBytesstatic method toMetaEvent.
Small changes and bug fixes
- Implemented
IComparableonInterval. - Implemented
IComparableonMusicTheory.Note. - Prevent creation of sysex event with status byte as a first data byte.
- Fixed:
Playbacklooped on current time change insideEventPlayedevent handler (#56). - Fixed:
CsvConvertercloses passed stream after data is read or written (#73). - Fixed:
OutputDevice.Volumeget/set fails (#75). - Fixed:
ResetEventnot received by input device. - Fixed: Fixed CSV parsing with
\rand\nin texts of meta events.
DryWetMIDI 5.0.0
Breaking changes
This version of the library has breaking changes:
Melanchall.DryWetMidi.Smfnamespace renamed toMelanchall.DryWetMidi.Core.Melanchall.DryWetMidi.Smf.Interactionnamespace renamed toMelanchall.DryWetMidi.Interaction.- Pattern API moved to new namespace
Melanchall.DryWetMidi.Composing. BarBeatTimeSpanrenamed toBarBeatTicksTimeSpan.- Renamed
SetProgrammethods of thePatternBuilderclass toProgramChange. - Changed type of the parameter of
SetOctavemethod of thePatternBuilderclass frominttoOctave.
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
- Added
Chordclass toMelanchall.DryWetMidi.MusicTheorynamespace. - Added
ChordProgressionclass toMelanchall.DryWetMidi.MusicTheorynamespace. - Added
GetStepmethod toScaleUtilitiesthat getsNoteNamecorresponding to the specified step of a musical scale. - Added
GetNotesNamesmethod toScaleUtilitiesthat returns infinite collection of note names that belong to the specified scale. - Added
IntervalQualityenum toMelanchall.DryWetMidi.MusicTheorynamespace. - Added
Getmethod toIntervalclass which accepts interval number and quality. - Implemented parsing of
Intervalby number and quality (for example, "P8" which is perfect eight). - Added
Transposemethod toNoteUtilitiesclass which returns theNoteNametransposed by the specified interval. Notecan be parsed now from string with any number of sharps and flats.- Added
NoteCallbackproperty toPlaybackclass which allows to modify and filter every note to be played. - Added
EventCallbackproperty toPlaybackclass which allows to modify and filter every MIDI event to be played. - Added
EventPlayedevent toPlaybackclass to track MIDI events playing. - Added
PlaybackCurrentTimeWatcherclass which allows to watch current time of specified playbacks and report it in the specified units via corresponding event. - Added
BarBeatFractionTimeSpanwhich represents a beat as a fraction (for example0.5) instead of number of whole beats and number of MIDI ticks (used byBarBeatTicksTimeSpan). - Added
BarBeatUitilitieswhich contains methods:GetBarLengththat allows to get length of specified bar in terms of MIDI ticks;GetBeatLengththat allows to get length of a beat of specified bar in terms MIDI ticks.
- Added
Filterproperty to quantizing settings classes to filter out objects that should be quantized. - Added
Filterproperty to randomizing settings classes to filter out objects that should be randomized. - Added
MidiClockclass which allows to report ticks with the specified interval and speed. - Added
NoteIdclass that repesents a separately sounding note (note number and channel). - Added
PatternUtilitiesclass with methods:TransformNotesthat transforms notes within the specifiedPatternproducing new pattern;TransformChordsthat transforms chords within the specifiedPatternproducing new pattern;SplitAtAnchorthat splits a pattern into subpatterns in points where the specified anchor inserted;
*...
DryWetMIDI 4.1.1
This is a minor release. Changes are listed below.
- Added
DecodeTextCallbacktoReadingSettings(#27). - Added
GetChannelsextension method forTrackChunkandMidiFile. DevicesConnectorallows connect one input device to several output devices now.- Added
EventTypeproperty toMidiEventwhich allow to check MIDI event type without usingasorisoperators. Playback.OutputDeviceis optional now and can be set tonull.- Added
SmfConstants.DefaultEncodingconstant 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
New features
- Added
GetTimedEvents,GetNotesandGetChordsextension methods forIEnumerable<MidiEvent>. - Added
IsEmptyextension method forMidiFile. - Added
GetDurationextension method forMidiFile. - Removed
NoteStopPolicyproperty fromPlayback. - Added
InterruptNotesOnStopproperty toPlayback. - Added
TrackNotesproperty toPlayback. - Added
NotesPlaybackStarted/NotesPlaybackFinishedevents toPlayback. - Added
Playbackconstructor withIEnumerable<ITimedObject>as an argument. - Added
SetTimeextension method forTimedEvent. - Added
SetTimeAndLengthextension method forNoteandChord. - Added
channelparameter to methods to get program change events by GM programs and to methods to get control change events. - Added
GetPlayback/Playextension methods forIEnumerable<Note>andIEnumerable<Chord>. - Added setter to
OutputDeviceproperty ofPlayback. - Implemented parsing metric time spans in 'h m s ms' format (for example, 3h5m56s897ms).
- Added
BarBeatTimeSpanconstructor that takes bars number only. - Added
Notesclass that holds all availableNotes. - Added
SkipPartandTakePartextension methods forMidiFile. - Implemented snapping features for
Playback. - Added
EndTimeAsextension method forILengthedObject.
Small changes and bug fixes
- Implemented
IConvertibleonFourBitNumberandSevenBitNumber. - Moved
IGridalong with its implementations from Tools namespace to Smf.Interaction. - Fixed: channel not set on program change events in
Pattern. - Fixed: last part of
MidiFileis lost when splitting file withArbitraryGrid. - Fixed:
sameTimeEventsComparisonis ignored when managing timed events. - Fixed: non-note events are not preceding note ones on exporting
PatterntoTrackChunk. - Fixed: quantizing with musical distance calculation type is failed.
- Fixed: musical time spans comparison can lead to
longoverflow.
DryWetMIDI 4.0.0
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
GetTimedEventsAndNotesandGetNotesAndRestsextension methods forTrackChunkandMidiFile. - Added conversion notes to/from CSV.
- Added
Parse/TryParsemethods toFourBitNumberandSevenBitNumber. - Added
ShiftEventsextension methods forTrackChunkandMidiFilewhich shifts MIDI events insideMidiFileby the specified distance. - Implemented resizing notes by ratio.
- Added
Resizeextension method forMidiFilewhich resizesMidiFileto the specified length or by specified ratio (for example,0.5means shrinking to the half of the original length). - Implemented splitting notes/chords at distance.
- Added
GetChordsextension method forIEnumerable<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
New features
- New tools:
- notes merger to merge nearby notes;
- MIDI file splitter to split a MIDI file in different ways;
- CSV converter to convert MIDI objects to CSV representation and read them back.
ResizeNotesmethod to resize group of notes to the specified length treating all notes as single object.GetNotesAndRestsmethod to iterate through the specified collection of notes returning instances ofNoteandRestwhere rests calculated using the specified policy.OnObjectQuantizingmethod of the quantizer classes has nowquantizedTimeparameter of theQuantizedTimetype which holds information about new time for an object (see Custom quantizing to learn more).QuantizingLevelsetting was added to quantizer settings which allows to specify how close an object should be moved to nearest grid time.
Minor changes
MakeNotesmethod was renamed toGetTimedEventsAndNotes.- Added
Clonemethod toMidiFileandMidiChunk. - Added
Dividemethod toMidiTimeSpan,MetricTimeSpanandMusicalTimeSpanwhich takes another time span of the same type to produce ratio between time spans. - Added
ChangeDenominatormethod toMusicalTimeSpanwhich returns an instance of theMusicalTimeSpanthat represents the same time span as original one but with the specified denominator. - Removed setters from
ITimedObject.TimeandILengthedObject.Lengthproperties (setters on implementations still exist). - Implemented
IEnumerable<T>onValueLineand removedValuesproperty.
DryWetMIDI 3.0.0
New features
- Added tools to perform complex tasks. Please read Tools section of the Wiki to learn more and check
Melanchall.DryWetMidi.Toolsnamespace. These tools are: - Added music theory API. Check
Melanchall.DryWetMidi.MusicTheorynamespace. AlsoNoteDefinition,IntervalDefinitionandOctaveDefinitionclasses were renamed toNote,IntervalandOctaverespectively and moved to this new namespace. - Added General MIDI Level 1/2 support API. Check
Melanchall.DryWetMidi.Standardsnamespace. - Added
SetProgrammethod toPatternBuilderclass. This method can be used in conjunction with the new GM 1/2 support API mentioned above. - Added
AddNotes,AddChordsandAddTimedEventsmethods toTimedEventsManagingUtilities,NotesManagingUtilitiesandChordsManagingUtilitiesclasses respectively. - Added
ToFileandToTrackChunkmethods toTimedEventsManagingUtilities,NotesManagingUtilitiesandChordsManagingUtilitiesclasses respectively. - Added
Clonemethod toNote,ChordandTimedEventclasses. - Added
TimeAsandLengthAsnon-generic methods where the desired type of result should be passed as an argument of theTimeSpanTypetype. Added non-generic versions of methods insideTimeConverterandLengthConverterclasses that takeTimeSpanTypetoo. - Implemented
IComparable,IComparable<T>andIEquatable<T>on time span classes. - Added
MakeNotesmethod to theNotesManagingUtilitiesclass which iterates through the specified collection ofTimedEventreturningNotefor Note On/Note Off events pairs and originalTimedEventfor all other events.
Minor changes
- Time and length conversions between different representations were significantly speeded up.
- Eliminated unnecessary resorting in
ValueLine.Valuesgetter. - Eliminated reordering in
GetNotes,GetChordsandGetTimedEventsmethods. FourBitNumberandSevenBitNumbermoved to theMelanchall.DryWetMidi.Commonnamespace.
DryWetMIDI 2.0.1
This a minor release which has the following changes:
- Target .NET Framework version was changed to 4.5 from 4.6.1.
- 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
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:
MetricTimeSpanfor time span in terms of microseconds;BarBeatTimeSpanfor time span in terms of number of bars, beats and ticks;MusicalTimeSpanfor time span in terms of a fraction of the whole note length;MidiTimeSpanexists 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
LyricsandMarkermethods were added to thePatternBuilder.Chordmethods taking root note's name were added to thePatternBuilder.- Fixed combining of LSB and MSB of the
PitchBendEvent'sPitchValue.
DryWetMIDI 1.3.0
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
MathTimeandMathLength. - Added ability to manage new tempo map.
- Added ability to replace existing tempo map with another one.
- Added
Channel,VelocityandOffVelocityproperties to theChord. - Added setter to
Chord'sLengthproperty. - Methods of
LengthConvertercan now takeITimeas time argument. - Removed
EqualsandGetHashCodeoverridings from the event classes.
Fixed bugs
- Fixed chords search ignores channel of notes.
- Fixed wrong conversion to
MusicalTimeif time is exact start of a bar.