KDMAPI (Keppy's Direct MIDI API) wrapper for Python
kdmapi provides both C bindings for OmniMIDI.dll and a Python-friendly wrapper for them
A Mido backend is also provided, instructions on how to use it are below
Requires Python 3.8 or greater
pip3 install kdmapiYou will also need to have OmniMIDI installed
fromkdmapiimportKDMAPI# Initialize the deviceKDMAPI.InitializeKDMAPIStream() # Send a short 32-bit MIDI message dataKDMAPI.SendDirectData(0x0) # Close the deviceKDMAPI.TerminateKDMAPIStream()You can use KDMAPI as a Mido output backend
importmido# Set KDMAPI as MIDO backendmido.set_backend("kdmapi.mido_backend") # Open MIDI filemidi_file=mido.MidiFile("your_file.mid") withmido.open_output() asout: formsginmidi_file.play(): out.send(msg)# # Copyright (C) 2022 Sebastiano Barezzi # # SPDX-License-Identifier: LGPL-3.0-or-later #