Nova Midi - A pure zig Midi I/O Library inpired by libremidi and minimidio

Nova Midi


Nova Midi is a midi I/O library that is inspired by libremidi and minimidio, providing a simple to use and unified function and interface to send and received midi messages across multiple backend. Currently, the library is still in a prototype and proof of concept phase where only winmm and alsa is supported.

https://codeberg.org/Logickin-Lambda/nova-midi

But… Why?

Like you have said before, there are libremidi and minimidio, and possibly many more; why even bother to build another midi library?

Well, I didn’t have no attempts on trying to link the existing solutions, but most of the existing solutions are written in c++ while they have heavy uses of operator overloading and templates, making to understand and to build the library difficult. Some solutions are C based, but there is no midi 2.0 support or the backend is selected at comptime which could crash the target device if they don’t have specific backend instead of safely escaping the problem with an error and let the program continue. Most of the zig solutions I could found are inactive, a few versions ago.

Because of the problems above, I decided to write my own solution, a midi library that is written zig so that zig users could easily maintain without touching other languages, while reducing a layer of translation.

Supported Zig versions

zig-0.16.0

Help wanted:

Currently, the library is still in an early phase, and because of lacking a mac and still attempting on understanding how different platforms handling their endingpoint connections, some part of the features are currently missing. If you have any interest, ideas, questions or even contributions, please let me know through the issues, pull requests and here down below.

2 Likes

Just FYI, not really sure how this is related exactly, but there is sample accurate MIDI in JACK:

I found a old article:

And some comments by Paul Davis:

Thanks! This could be useful when I start to touch jack audio, especially the api reference; in fact, the current design of the library is to support cross platform backend like these; though, I would put this aside since I need to sort out the missing features (like midi timestamp) and how to build an abstraction for ump endpoint for both alsa and midi service first.

For Windows, the ancient WinMM API is now essentially obsolete and exists purely for backward compatibility. New code should use the new (Midi 2.0) API. Mac, Linux and Windows all now support MIdi 2.0.

Yes, i agree that the newer service should be supported which I am currently exploring it, but just in case people still use windows older than windows 11 or when that “ensure midi service” function fails, the winmm acts as a fallback mechanism.

Similar story to linux which I often see people using a very old version that don’t include the ump features, so we still need to support the old api.

The library will be shifted focus toward more to midi 2.0 once I have figured out an api that plays well for all three major platforms which i am currently working on.