By Gergely Orosz, the author of The Pragmatic Engineer Newsletter and Building Mobile Apps at Scale
Navigating senior, tech lead, staff and principal positions at tech companies and startups. An Amazon #1 Best Seller. New: the hardcover is out! As is the audibook. Now available in 6 languages.
# Convert your MIDI file midi2lua my_song.mid --output my_song.lua If you are working in a restricted environment (like a Roblox plugin), you can use a pure Lua MIDI parser. Simply load the binary MIDI file as a string and decode the variable-length values.
Enter —a lightweight utility that acts as a translator between the universal language of MIDI and the elegant simplicity of Lua tables. What is midi2lua ? At its core, midi2lua is a parser/converter. It takes a standard .mid file (or raw MIDI bytes) and converts the event stream into a native Lua data structure.
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 .
If you are tired of guessing note timings or hardcoding arrays of integers, give it a try. Compose in the piano roll. Code in Lua. Let midi2lua handle the handshake. Have you used MIDI with Lua before? Are you building a rhythm game or a synth tool? Let me know in the comments below.
function love.update(dt) -- Convert real time to ticks (simplified) current_tick = current_tick + (dt * (bpm / 60) * ticks_per_beat)
-- Output from midi2lua { ticks_per_beat = 480, tracks = { { -- Track 1: Piano { tick = 0, type = "note_on", note = 60, velocity = 100 }, { tick = 120, type = "note_off", note = 60, velocity = 64 }, { tick = 240, type = "note_on", note = 64, velocity = 95 } } } } 1. Rhythm Games (Roblox / Love2D) If you are building a Dance Dance Revolution or Guitar Hero clone in Roblox (Luau) or Love2D, timing is everything. midi2lua allows your level designers to compose in FL Studio or Ableton, then drop the exported file into your game’s asset pipeline.
Instead of hardcoding noteOn(60, 100) a thousand times, you feed your MIDI file into midi2lua , and it outputs a table like this:
If you’ve ever built a rhythm game, programmed a generative visualizer, or tried to sync a light show to a backing track, you know the pain of manually transcribing note data. You have a beautiful melody in your DAW (Digital Audio Workstation), but your Lua script just sees a list of numbers.
The book is separated into six standalone parts, each part covering several chapters:
Parts 1 and 6 apply to all engineering levels: from entry-level software developers to principal or above engineers. Parts 2, 3, 4 and 5 cover increasingly senior engineering levels. These four parts group topics in chapters – such as ones on software engineering, collaboration, getting things done, and so on.
This book is more of a reference book that you can refer back to, as you grow in your career. I suggest skimming over the career levels and chapters that you are familiar with, and focus reading on topics you struggle with, or career levels where you are aiming to get to. Keep in mind that expectations can vary greatly between companies.
In this book, I’ve aimed to align the topics and leveling definitions closer to what is typical at Big Tech and scaleups: but you might find some of the topics relevant for lower career levels in later chapters. For example, we cover logging, montiroing and oncall in Part 5: “Reliable software systems” in-depth: but it’s useful – and oftentimes necessary! – to know about these practices below the staff engineer levels.
The Software Engineer's Guidebook is available in multiple languages:
You should now be able to ask your local book shops to order the book for you via Ingram Spark Print-on-demand - using the ISBN code 9789083381824. I'm also working on making the paperback more accessible in additional regions, including translated versions. Please share details here if you're unable to get the book in your country and I'll aim to remedy the situation.
I'd like to think so! The book can help you get ideas on how to help software engineers on your team grow. And if you are a hands-on engineering manager (which I hope you might be!) then you can apply the topics yourself! I wrote more about staying hands-on as an engineering manager or lead in The Pragmatic Engineer Newsletter.
I've gotten this variation of a question from Data Engineers, ML Engineers, designers and SREs. See the more detailed table of contents and the "Look inside" sample to get a better idea of the contents of the book. I have written this book with software engineers as the target group, and the bulk of the book applies for them. Part 1 is more generally applicable career advice: but that's still smaller subset of the book.