minuit 0.1.1

Midi library

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:


Minuit is a simple midi library for Windows and Linux in D.

Fetch port list

To get a list of all available midi ports, use mnFetchOutputs for midi output ports or mnFetchInputs for midi input ports.

import minuit;

void main(string[] args) {
  MnOutputPort[] outputPorts = mnFetchOutputs();

  writeln("List of output ports:");
  foreach(MnOutputPort port; outputPorts) {
  MnInputPort[] inputPorts = mnFetchInputs();

  writeln("List of input ports:");
  foreach(MnInputPort port; inputPorts) {

You can also directly fetch the names of the ports with mnFetchOutputsName and mnFetchInputsName.

import minuit;

void main(string[] args) {
  writeln("List of output ports: ", mnFetchOutputsName());
  writeln("List of input ports: ", mnFetchInputsName());

Open and close a port

Simply use mnOpenInput or mnOpenOutput with your port, it'll return you an handle to use the port. You can close it with mnCloseInput or mnCloseOutput by passing it the handle.

import minuit;

void main(string[] args) {
  MnOutputPort[] outputPorts = mnFetchOutputs();
  //Open the port.
  MnOutputHandle output = mnOpenOutput(outputPorts[0]);
  //Use the output here...
  //Then close it.

You can also open a port with its name or its index with the same function like:

MnOutputHande output1 = mnOpenOutput("SD-90 PART A");
MnOutputHande output2 = mnOpenOutput(0);
MnInputHandle input1 = mnOpenInput("Focusrite USB MIDI");
MnInputHandle input2 = mnOpenInput(0);

Send a message

Note (Version 0.1.1): On Linux, you cannot receive on a MnInputHandle yet (working on it). Note (Version 0.1.1): On Windows, you won't be able to receive messages more than 4 bytes long (like SysEx) (working on it).

Use mnSendOutput with your handle and up to 4 bytes of data, or an array of bytes.

MnOutputHandle output = mnOpenOutput(outputPorts[0]);

//Note On
mnSendOutput(output, 0x90, 0x41, 0x64); //Up to 4 bytes

//Note Off
mnSendOutput(output, [0x80, 0x41, 0x64]); //Or an array (no limit)

Receive a message

To receive, you can use mnCanReceiveInput to check whether there is messages to be read. Then you can use mnReceiveInput to get the actual message.

MnInputHandle input = mnOpenInput(outputPorts[0]);

while(true) {
  if(mnCanReceiveInput(input)) {

MnInput and MnOutput

These are classes that do everything above but within a class. The methods are open, close, send, canReceive, receive, etc.

  • Enalye
0.1.4 2019-Nov-25
0.1.3 2019-Oct-06
0.1.2 2019-Oct-06
0.1.1 2019-Sep-01
0.1.0 2019-Aug-26
Show all 8 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 52 downloads total

Short URL: