# MUS fixtures (tools/fixtures.py): Doom MUS files written by tools/fixtures/_midivar.py (notes with and without volume, # releases, pitch wheel, controllers, program changes; system events and measure ends only in mus_measures, as wildmidi # misreads the first and refuses the second) and wildmidi -x's conversion of each as the reference event stream. # tests/gen/mus_cases.luau { { name, data, rate (wildmidi's effective tick rate), ref = { division, tempo, # events = { {seconds, status, d1, d2} } } } } import importlib.util, os INPUTS = ["tools/fixtures/_midivar.py"] _spec = importlib.util.spec_from_file_location("_midivar", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_midivar.py")) M = importlib.util.module_from_spec(_spec) _spec.loader.exec_module(M) def generate(ctx): rng = ctx.rng(0x4D55) cases = [] for i in range(4): data = M.random_mus(rng, n=60 + 60 * i) ref = M.wildmidi(ctx, data, "mus") # wildmidi writes its tempo bytes in the wrong order (0x1B8A06 for 0x068A1B) at division 257: its MUS tick # rate is 257 / 1.804806 s, not Doom's 140 Hz rate = ref["division"] * 1e6 / ref["tempo"] cases.append({"name": "random %d" % i, "data": data, "rate": rate, "ref": ref}) # system events and measure ends inserted with no delay: the same notes at the same times, more controllers plain = M.random_mus(ctx.rng(7), n=80) marked = M.random_mus(ctx.rng(7), n=80, extras=12) ctx.emit("mus_cases", cases) ctx.emit("mus_measures", {"plain": plain, "marked": marked})