git clone -v --recursive https://github.com/fxliang/midi.git
cd midi
xmake f -p windows
xmake git clone -v --recursive https://github.com/fxliang/midi.git
cd midi
xmake f -p mingw
xmake example code to run with lua.exe
-- for windows only
-- current directory of script
local script_dir = debug.getinfo(1, "S").source:match("@(.*[/\\])")
-- add DLL in cwd to package.cpath
package.cpath = package.cpath .. ";" .. script_dir .. "?.dll"
print(package.cpath)
local midi = require("midi")
-- print(midi) -- check if midi is loaded
local function sleep(n)
os.execute("sleep " .. tonumber(n))
end
midi.init()
midi.playNoteOn(42, 0x7f)
sleep(1)
midi.playNoteOff(42)
midi.fini()
- copy
midi.dllandplay.luato<path-to-user-data-dir>\lua\ - patch your schema, add
- lua_processor@*playtoengine/processors. - deploy and enjoy.
install dependences
pip install argparser
pip install mido
pip install pygameuse python script to get data file
python.exe .\get_notes.py -h
pygame 2.6.1 (SDL 2.28.4, Python 3.9.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
usage:
get track notes data to a lua file [-h] [--input INPUT] [--output OUTPUT] [--track TRACK] [--play PLAY]
optional arguments:
-h, --help show this help message and exit
--input INPUT str, input midi file
--output OUTPUT str, output data file
--track TRACK int, track index
--play PLAY bool, if to play a tracklua (MIT License)