Files
rosetta/tests/music/ptm.luau
T
4DBug 60544a3a77 ws-audio2: music/ptm (PolyTracker): it family, MOD letters with S3M fine slides, note slides, delta 8 / 16-bit samples; engine flags.panLaw = ft2 (square-root panning)
ops/MusicOps: accept modules of the other tracker formats by their engine family (Tracker.family), a one-line
backward-compatible change.
2026-10-31 14:29:01 -05:00

20 lines
906 B
Luau

-- music/ptm tests: generated PolyTracker modules (tools/fixtures/ptm.py) parsed, rendered through codecs/audio/Tracker
-- and compared with openmpt123's render (loudness envelope, band spectrum, stereo balance, song length), the contract,
-- and the fuzz no-throw pass.
local T = require("@tests/T")
local S = require("@tests/music/_similar")
local Ptm = require("@formats/music/ptm")
local Cases = require("@tests/gen/ptm_cases")
local t = T.suite("ptm")
t:eq(Ptm.name, "ptm", "name")
t:eq(Ptm.category, "music", "category")
t:check(Ptm.caps.decode and not Ptm.caps.encode, "caps")
local mods = S.against(t, Ptm, Cases, { gainDb = 0.5, envErr = 1.0, spectral = 0.95, balance = 0.04, duration = 0.01 }, "it")
t:check(mods[1] and mods[1].samples[3].bits == 16 and mods[1].samples[3].loopType == 2, "16-bit ping-pong loop")
t:fuzz("decode", S.fuzzer(Ptm), S.samples(Cases), { mutations = 30 })
t:done()