"""The stability test's songs: a control that every engine loads, and one song per file bug that StepManiaY's page says it fixed in the song scan. Each is the smallest file that reaches the code in question; the case table in run.py says what the old engine does with it, with the line of ITGmania 1.3.0's source that does it. python3 make_songs.py writes /SMY Verification// for every case. Everything here is made from nothing: no audio, simfile or art from anyone else. """ from __future__ import annotations import math import struct import sys from pathlib import Path GROUP = "SMY Verification" RATE = 44100 BPM = 120.0 SECONDS = 8.0 def click_track() -> bytes: """16-bit stereo PCM: silence with a 5 ms, 1 kHz click on every beat.""" beat = 60.0 / BPM frames = int(SECONDS * RATE) out = bytearray() for i in range(frames): t = i / RATE phase = t % beat v = int(12000 * math.sin(2 * math.pi * 1000 * phase)) if phase < 0.005 else 0 out += struct.pack(" bytes: body = cid + struct.pack(" bytes: fmt = struct.pack(" str: return f"""#VERSION:0.83; #TITLE:{title}; #ARTIST:StepManiaY Verification; #MUSIC:music.wav; #OFFSET:0.000; #SAMPLESTART:0.000; #SAMPLELENGTH:4.000; #BPMS:0.000={BPM:.3f}; #STOPS:; #SPEEDS:{speeds}; #TIMESIGNATURES:{timesignatures}; #NOTEDATA:; #STEPSTYPE:dance-single; #DIFFICULTY:Beginner; #METER:1; #NOTES: 1000 0100 0010 0001 , 1000 0000 0001 0000 ; """ def dwi(title: str, mode: str) -> str: return f"""#TITLE:{title}; #ARTIST:StepManiaY Verification; #FILE:music.wav; #BPM:{BPM:.3f}; #GAP:0; #{mode}:BASIC:1:2486248624862486; """ # case folder -> (files to write) CASES = { "00-control": { "music.wav": wav(), "song.ssc": ssc("Control"), }, # A chunk whose size reads as -8 sends the reader back to the same chunk's header, forever. "01-wav-negative-chunk": { "music.wav": wav(chunk(b"LIST", b"", size=-8)), "song.ssc": ssc("WAV negative chunk size"), }, # "=" splits into no fields; the old parser reads the first of them. "02-ssc-empty-speeds": { "music.wav": wav(), "song.ssc": ssc("SSC empty SPEEDS entry", speeds="="), }, # 4 beats * 48 rows * 1 / 256 rounds to a measure of zero rows. "03-ssc-timesig-1-256": { "music.wav": wav(), "song.ssc": ssc("SSC time signature 1/256", timesignatures="0.000=1=256"), }, # DWI tags match in any case, but the old loader compared the mode in upper case only. "04-dwi-lowercase-mode": { "music.wav": wav(), "song.dwi": dwi("DWI lowercase mode", "single"), }, } def main() -> None: root = Path(sys.argv[1]) / GROUP for name, files in CASES.items(): folder = root / name folder.mkdir(parents=True, exist_ok=True) for filename, content in files.items(): path = folder / filename path.write_bytes(content if isinstance(content, bytes) else content.encode()) print(folder) if __name__ == "__main__": main()