Midi2lua Page
The converter translates time deltas (tick-based) into seconds and organizes the notes into a Lua table structure, often looking like this:
tick = 480, -- Assuming 480 PPQN type = "note_off", note = 60, velocity = 64
[ .mid File ] ──> [ Parse Tracks & Ticks ] ──> [ Calculate Rest Intervals ] ──> [ Output .lua Keystrokes ] 1. File Parsing and Tick Extraction midi2lua
It transforms your DAW (Digital Audio Workstation) into a level editor for sound. While it requires understanding time management in Lua (love.update, heartbeat, or RenderStepped), the payoff is a perfectly synchronized audio-visual experience.
Parsing MIDI — methodical steps
files do not contain actual audio recordings. Instead, they hold instructional data: which notes are pressed, when they are pressed, how hard they are hit (velocity), and how long they are held.
The most common application. The MIDI file determines when a player must press a key, and the Lua script interprets this data to spawn falling notes. Parsing MIDI — methodical steps files do not
One of the most creative midi2lua applications comes from the Minecraft modding community. MIDIToComputerCraft converts arbitrary MIDI files into executable Lua code for ComputerCraft, a mod that adds programmable computers to the game.
: Some versions include "human-like" features, such as randomized note lengths or error margins, to make the automation look less like a bot to other players . The MIDI file determines when a player must