Melanchall.DryWetMidi
8.0.3
Prefix Reserved
dotnet add package Melanchall.DryWetMidi --version 8.0.3
NuGet\Install-Package Melanchall.DryWetMidi -Version 8.0.3
<PackageReference Include="Melanchall.DryWetMidi" Version="8.0.3" />
<PackageVersion Include="Melanchall.DryWetMidi" Version="8.0.3" />
<PackageReference Include="Melanchall.DryWetMidi" />
paket add Melanchall.DryWetMidi --version 8.0.3
#r "nuget: Melanchall.DryWetMidi, 8.0.3"
#:package Melanchall.DryWetMidi@8.0.3
#addin nuget:?package=Melanchall.DryWetMidi&version=8.0.3
#tool nuget:?package=Melanchall.DryWetMidi&version=8.0.3

You can help to make the library better! Please take a quick survey.
DryWetMIDI is the .NET library to work with MIDI data and MIDI devices. It allows:
- Read, write and create Standard MIDI Files (SMF). It is also possible to:
- read RMID files where SMF wrapped to RIFF chunk;
- easily catch specific error when reading or writing a MIDI file since all possible errors in a file are presented as separate exception classes;
- finely adjust the process of reading and writing (it allows, for example, to read corrupted files and repair them, or build MIDI file validators);
- implement custom meta events and custom chunks that can be written to and read from MIDI files.
- Send MIDI events to/receive them from MIDI devices.
- Play MIDI data and record it.
- Manage MIDI data either with low-level objects, like a MIDI event, or high-level ones, like a note, using different time and length representations (read the High-level data managing section of the library docs).
- Build musical compositions (see Pattern page of the library docs) and use music theory API (see Music Theory - Overview article).
- Perform complex tasks like quantizing, notes splitting or converting MIDI file to CSV representation (see Tools page of the library docs).
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:
- Playtonik
Playtonik is an app designed and developed by 5of12. It uses physics-based interactions, immersive spatial audio and dynamic haptic feedback for a fun, relaxing experience. For the fidgeters, Playtonik comes with a selection of built in sounds and an on screen keyboard. Scale filters help keep you in tune, so you can focus on having fun! For the musicians, MIDI support lets you connect your favourite instrument. Playtonik can work as a note source or as a chaotic MIDI delay, great for adding texture to your sound. - EMU – Sound to Light Controller
EMU (DMXIS’s next generation) is a state-of-the-art, intuitive sound-to-light controller designed for professional live musicians and DJs. Easy to use software, EMU allows you to run automated or responsive DMX light shows, leaving you to focus on your show! - Musical Bits
Musical Bits creates software that helps you creating music. Our software uses latest technology, including AI, to model all layers of creativity of a human composer. These layers are implemented as reusable and combinable software components. Musical Bits software is available as co-pilot for producers and composers under the name KLANGMACHT and helps you create, drumsounds, beats, guitars, background choirs, lyrics and more. We even create and distribute full virtual bands, albums and songs. For example, check out the Frostbite Orckings. - CoyoteMIDI
CoyoteMIDI extends the functionality of your MIDI devices to include keyboard and mouse input, including complex key combinations and multi-step macros. - Clone Hero
Free rhythm game, which can be played with any 5 or 6 button guitar controller, game controllers, or just your standard computer keyboard. The game is a clone of Guitar Hero. - Electrophonics
A collection of virtual musical instruments that features real MIDI output. - Rustissimo
Using Rustissimo you can create a concert with your friends and play instruments with synchronization.
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 | Versions 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. |
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (9)
Showing the top 5 NuGet packages that depend on Melanchall.DryWetMidi:
| Package | Downloads |
|---|---|
|
Carbon.Feature.Media
Provides various document and media processing functions. |
|
|
OwnAudioSharp
Cross-platform audio engine library for desktop platforms (Windows, Linux, macOS) |
|
|
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. |
|
|
OwnAudioSharp.Mobile
Cross-platform audio engine library for mobile platforms (Android and iOS) |
|
|
BehringerXTouchExtender
Send and receive events with a Behringer X-Touch Extender DAW MIDI control surface over USB. |
GitHub repositories (13)
Showing the top 13 popular GitHub repositories that depend on Melanchall.DryWetMidi:
| Repository | Stars |
|---|---|
|
QL-Win/QuickLook
Bring macOS “Quick Look” feature to Windows
|
|
|
stakira/OpenUtau
Open singing synthesis platform / Open source UTAU successor
|
|
|
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.
|
|
|
xunkong/KeqingNiuza
刻记牛杂店
|
|
|
sabihoshi/GenshinLyreMidiPlayer
Genshin Impact Windsong Lyre, Floral Zither, & Vintage Lyre MIDI auto player in Modern Mica UI. Supports MIDI instruments & Playlist controls.
|
|
|
ImAxel0/Openthesia
Customizable midi visualization software kinda like Synthesia for Windows (Wine-compatible on Linux)
|
|
|
AmanoTooko/Daigassou
Transfer midi file to keyboard events in FFXIV bard performance solo and multiplayer
|
|
|
vocoder712/OpenUtauMobile
OpenUtau Mobile 是一个面向移动端的开源免费歌声合成软件; OpenUtau Mobile is a free and open-source singing voice synthesis software for mobile devices.
|
|
|
OpenNefia/OpenNefia
Moddable engine reimplementation of the Japanese roguelike Elona.
|
|
|
elgarf/vMixUTC
Customizable controller for vMix
|
|
|
Key2Joy/Key2Joy
Simulate a GameController/Joystick using your keyboard and mouse.
|
|
|
ianespana/ShawzinBot
Convert a MIDI input to a series of key presses for the Shawzin
|
|
|
akira0245/MidiBard
Bard performance plugin for FFXIV.
|