Melanchall.DryWetMidi 8.0.3 (original) (raw)

DryWetMIDI Logo

NuGet (full) NuGet (nativeless) Unity asset (full) Unity asset (nativeless)



DryWetMIDI is the .NET library to work with MIDI data and MIDI devices. It allows:

Please see Getting started section below for quick jump into the library.

If you want to create an issue or a discussion, read this article first – Support.

Projects using DryWetMIDI

Here the list of noticeable projects that use the library:

If you find that DryWetMIDI has been useful for your project, please put a link to the library in your project's About section or something like that.

Getting Started

Let's see small examples of what you can do with the library.

It's possible to read a MIDI file, then collect all notes from it and print their time and length in the metric (hours, minutes, second, ...) format:

var midiFile = MidiFile.Read("MyFile.mid");
var tempoMap = midiFile.GetTempoMap();
 
foreach (var note in midiFile.GetNotes())
{
    var time = note.TimeAs<MetricTimeSpan>(tempoMap);
    var length = note.LengthAs<MetricTimeSpan>(tempoMap);
    Console.WriteLine($"{note} at {time} with length of {length}");
}

Or maybe you want to record data from a MIDI device, then quantize recorded events by the grid with step of 1/8, and play the data via the default Windows synth:

var inputDevice = InputDevice.GetByName("MyMidiKeyboard");
inputDevice.StartEventsListening();

var recording = new Recording(TempoMap.Default, inputDevice);
recording.Start();
 
// ...
 
recording.Stop();
inputDevice.Dispose();
 
var recordedFile = recording.ToFile();
recording.Dispose();
 
recordedFile.QuantizeObjects(
    ObjectType.TimedEvent,
    new SteppedGrid(MusicalTimeSpan.Eighth));
 
var outputDevice = OutputDevice.GetByName("Microsoft GS Wavetable Synth");
var playback = recordedFile.GetPlayback(outputDevice);
playback.Start();
 
// ...
 
playback.Dispose();
outputDevice.Dispose();

You can even build a musical composition:

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

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

    // Set default note length to triplet eighth and default octave to 5
    .SetNoteLength(MusicalTimeSpan.Eighth.Triplet())
    .SetOctave(Octave.Get(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)

    // Insert a simple drum pattern
    .PianoRoll(@"
        F#2   ||||||||
        D2    --|---|-
        C2    |---|---")
    .Repeat(9)

    // Get pattern
    .Build();

var midiFile = pattern.ToFile(TempoMap.Create(Tempo.FromBeatsPerMinute(240)));
midiFile.Write("DrumPattern.mid");

Also you can check out sample applications from CIRCE-EYES (see the profile, VB.NET is used)

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed.
.NET Core netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed.
.NET Standard netstandard2.0 is compatible. netstandard2.1 was computed.
.NET Framework net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed.
MonoAndroid monoandroid was computed.
MonoMac monomac was computed.
MonoTouch monotouch was computed.
Tizen tizen40 was computed. tizen60 was computed.
Xamarin.iOS xamarinios was computed.
Xamarin.Mac xamarinmac was computed.
Xamarin.TVOS xamarintvos was computed.
Xamarin.WatchOS xamarinwatchos was computed.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Melanchall.DryWetMidi:

Package Downloads
Carbon.Feature.Media Provides various document and media processing functions. 16.9K
launchpad-dot-net An extension of iUltimateLP's Launchpad DotNet library that adds support for the Launchpad Mini Mk3 and enables SysEx support. Ported to dotnet standard by pstaszko. 2.9K
BehringerXTouchExtender Send and receive events with a Behringer X-Touch Extender DAW MIDI control surface over USB. 1.6K
Sonora .NET Audio Framework for audio and MIDI playback, editing, and plugin integration. 816
Aura.NET .NET Audio Framework for audio and MIDI playback, editing, and plugin integration. 396

GitHub repositories (12)

Showing the top 12 popular GitHub repositories that depend on Melanchall.DryWetMidi:

Repository Stars
QL-Win/QuickLook Bring macOS “Quick Look” feature to Windows 23.8K
openutau/OpenUtau Open singing synthesis platform / Open source UTAU successor 4.0K
SciSharp/Keras.NET Keras.NET is a high-level neural networks API for C# and F#, with Python Binding and capable of running on top of TensorFlow, CNTK, or Theano. 618
xunkong/KeqingNiuza 刻记牛杂店 497
sabihoshi/GenshinLyreMidiPlayer Genshin Impact Windsong Lyre, Floral Zither, & Vintage Lyre MIDI auto player in Modern Mica UI. Supports MIDI instruments & Playlist controls. 273
vocoder712/OpenUtauMobile OpenUtau Mobile 是一个面向移动端的开源免费歌声合成软件; OpenUtau Mobile is a free and open-source singing voice synthesis software for mobile devices. 227
ImAxel0/Openthesia Customizable midi visualization software kinda like Synthesia for Windows (Wine-compatible on Linux) 200
AmanoTooko/Daigassou Transfer midi file to keyboard events in FFXIV bard performance solo and multiplayer 154
OpenNefia/OpenNefia Moddable engine reimplementation of the Japanese roguelike Elona. 146
elgarf/vMixUTC Customizable controller for vMix 135
ianespana/ShawzinBot Convert a MIDI input to a series of key presses for the Shawzin 125
akira0245/MidiBard Bard performance plugin for FFXIV. 108

Include prerelease

Include vulnerable

Include deprecated

Version Downloads Last Updated
9.0.0-prerelease8 113 5/30/2026
9.0.0-prerelease1 234 3/28/2026
8.0.3 10,324 12/15/2025
8.0.2 4,715 7/31/2025
8.0.1 2,980 6/23/2025
8.0.0 4,361 5/18/2025
7.2.0 41,682 9/5/2024
7.1.0 14,290 5/2/2024
7.0.2 13,069 12/22/2023
7.0.1 2,041 8/30/2023
7.0.0 4,481 6/26/2023
6.1.4 19,378 1/14/2023