Midi2lua ^new^ -

I use midi2lua to control DMX lights. I draw the "chase" pattern in a MIDI clip (C4 = Red, D4 = Blue), convert it to Lua, and let the script run the light show. No expensive lighting software required. A Simple Example (Love2D) Assume you have a file called song.lua that was generated by midi2lua .

Want a boss in your RPG to cast spells on specific beats of the background music? Convert the MIDI percussion track to Lua. When the Lua clock hits tick 1920 , spawn the fireball. It is deterministic and perfectly synced. midi2lua

for _, track in ipairs(midi_data.tracks) do for _, event in ipairs(track) do if event.tick <= current_tick and not event.triggered then if event.type == "note_on" then playSound(noteToFrequency(event.note)) end event.triggered = true end end end end Most midi2lua converters are command-line tools or simple Python/Lua scripts. I use midi2lua to control DMX lights

Bridging the Gap: An Introduction to midi2lua for Interactive Music A Simple Example (Love2D) Assume you have a file called song

-- main.lua local midi_data = require("song") -- A simple scheduler local current_tick = 0 local bpm = 120 local ticks_per_beat = midi_data.ticks_per_beat