-- Assume 'songTable' is generated by midi2lua local songTable = note = 60, delay = 0, -- Middle C note = 64, delay = 0.5, -- E note = 67, delay = 1.0, -- G local function playSong(songs) for _, event in ipairs(songs) do task.wait(event.delay) -- Wait for the note playSound(event.note) -- Your custom play function end end playSong(songTable) Use code with caution. Tips for Better Midi2Lua Conversion
import mido mid = mido.MidiFile('yoursong.mid') print("local musicTrack = ") for track in mid.tracks: current_time = 0 for msg in track: current_time += msg.time if msg.type == 'note_on' and msg.velocity > 0: # Output formatted as a Lua table row print(f" time = current_time, note = msg.note, velocity = msg.velocity,") print("\nreturn musicTrack") Use code with caution. Tips for Optimizing Your Midi2Lua Scripts midi2lua