ws-music: untrack debug probes
This commit is contained in:
1 parent
cf7c1b8ad2
commit
6c49ab38dd
3 files changed
-113
No files matched your search
@@ -1,27 +0,0 @@
|
||||
-- debug probes
|
||||
local S = require("@tests/music/_similar")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Cases = require("@tests/gen/probe_cases")
|
||||
local verbose = ...
|
||||
local F = { s3m = require("@formats/music/s3m"), mod = require("@formats/music/mod") }
|
||||
for _, c in Cases do
|
||||
local m, err = F[c.fmt].decode(Bytes.reader(buffer.fromstring(c.data)))
|
||||
if not m then print(c.name, err) continue end
|
||||
local dec = m:render()
|
||||
local buf, frames = S.renderAll(dec, math.floor(c.duration * S.SR))
|
||||
local a = S.features(buf, frames)
|
||||
local r = S.compare(a, c.ref)
|
||||
print(string.format("%-8s gain %+.2f err %.2f env %.3f spec %.3f bal %.3f dur %.3f/%.3f", c.name, r.gainDb, r.envErr, r.envCorr, r.spectral, r.balance, dec.duration, c.duration))
|
||||
if verbose == c.name then
|
||||
for k = 1, math.min(a.frames, c.ref.frames) do
|
||||
local x, y = 20 * math.log10(a.rmsM[k] + 1e-6), 20 * math.log10(c.ref.rmsM[k] + 1e-6)
|
||||
local sim = 0
|
||||
local dot, na, nb = 0, 0, 0
|
||||
for j = 1, 40 do
|
||||
local p, q = a.bands[(k - 1) * 40 + j], c.ref.bands[(k - 1) * 40 + j]
|
||||
dot += p * q; na += p * p; nb += q * q
|
||||
end
|
||||
print(string.format(" block %3d %5.2fs M %6.1f %6.1f spec %.3f", k, (k - 1) * 2048 / 44100, x, y, dot / math.sqrt(na * nb + 1e-20)))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
-- debug: voice states at a time
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Cases = require("@tests/gen/probe_cases")
|
||||
local name, at = ...
|
||||
local F = { s3m = require("@formats/music/s3m"), mod = require("@formats/music/mod") }
|
||||
for _, c in Cases do
|
||||
if c.name == name then
|
||||
local m = F[c.fmt].decode(Bytes.reader(buffer.fromstring(c.data)))
|
||||
local dec = m:render()
|
||||
local n = math.floor(tonumber(at) * 44100)
|
||||
while n > 0 do
|
||||
local _, got = dec:read(math.min(n, 4096))
|
||||
n -= got
|
||||
if got == 0 then break end
|
||||
end
|
||||
local st = dec.st
|
||||
print("ord", st.ord, "row", st.row, "tick", st.tick, "speed", st.speed, "tempo", st.tempo, "gvol", st.gvol)
|
||||
for i, v in st.voices do
|
||||
if v.chan > 0 then print("voice", v.active, i, "chan", v.chan, "smp", v.smpIdx, "p", v.p, "inc", v.inc, "vol", v.vol, "g", v.gl, v.gr, "t", v.tl, v.tr, "len", v.len, v.loopS, v.loopE, v.loopT) end
|
||||
end
|
||||
local out = dec:read(8)
|
||||
print(buffer.readf32(out, 0), buffer.readf32(out, 4), buffer.readf32(out, 8))
|
||||
end
|
||||
end
|
||||
@@ -1,62 +0,0 @@
|
||||
# debug only (not committed): one small module per effect, for locating engine differences against openmpt
|
||||
import os, sys
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import _tracker as T # noqa
|
||||
import s3m as S # noqa
|
||||
|
||||
def probes_s3m():
|
||||
out = []
|
||||
smp = S.samples()
|
||||
def one(nm, events, ch=1, **kw):
|
||||
p = S.empty(ch, 64)
|
||||
for e in events:
|
||||
S.put(p, *e)
|
||||
out.append((nm, T.write_s3m(nm, smp, [0], [p], ch, **kw), "s3m"))
|
||||
one("Q83", [(0, 0, 61, 4, None, S.Q, 0x83), (1, 0, 0, 0, None, S.Q, 0x83), (2, 0, 61, 4, None, S.Q, 0x83)])
|
||||
one("Q32", [(0, 0, 61, 4, None, S.Q, 0x32), (1, 0, 0, 0, None, S.Q, 0x00)])
|
||||
one("EF4", [(0, 0, 61, 2), (2, 0, 0, 0, None, S.E, 0xF4), (3, 0, 0, 0, None, S.F, 0xE8)])
|
||||
one("E03", [(0, 0, 61, 2), (2, 0, 0, 0, None, S.E, 0x03), (4, 0, 0, 0, None, S.F, 0x06)])
|
||||
one("D", [(0, 0, 61, 2, 48), (1, 0, 0, 0, None, S.D, 0x04), (3, 0, 0, 0, None, S.D, 0x20), (5, 0, 0, 0, None, S.D, 0xF2), (6, 0, 0, 0, None, S.D, 0x3F), (7, 0, 0, 0, None, S.D, 0x00)])
|
||||
one("H46", [(0, 0, 61, 1, None, S.H, 0x46), (1, 0, 0, 0, None, S.H, 0x00)])
|
||||
one("U48", [(0, 0, 61, 1, None, S.U, 0x48), (1, 0, 0, 0, None, S.U, 0x00)])
|
||||
one("K02", [(0, 0, 61, 1, None, S.H, 0x46), (1, 0, 0, 0, None, S.K, 0x02)])
|
||||
one("G", [(0, 0, 49, 1), (1, 0, 61, 0, None, S.G, 0x10), (3, 0, 49, 0, None, S.G, 0x00)])
|
||||
one("L01", [(0, 0, 49, 1), (1, 0, 61, 0, None, S.G, 0x08), (3, 0, 0, 0, None, S.L, 0x01)])
|
||||
one("R58", [(0, 0, 54, 1, None, S.R, 0x58), (1, 0, 0, 0, None, S.R, 0x00)])
|
||||
one("I21", [(0, 0, 54, 1, None, S.I, 0x21), (1, 0, 0, 0, None, S.I, 0x00)])
|
||||
one("J47", [(0, 0, 54, 1, None, S.J, 0x47), (1, 0, 0, 0, None, S.J, 0x00)])
|
||||
one("X", [(0, 0, 54, 1, None, S.X, 0x20), (4, 0, 0, 0, None, S.S, 0x8C), (8, 0, 0, 0, None, S.X, 0x80)])
|
||||
one("O", [(0, 0, 61, 4, None, S.O, 0x08), (4, 0, 61, 4, None, S.O, 0x00), (8, 0, 61, 4, None, S.O, 0x10)])
|
||||
one("SC", [(0, 0, 61, 4, None, S.S, 0xC3), (4, 0, 61, 1, None, S.S, 0xD2), (8, 0, 254)])
|
||||
one("V", [(0, 0, 61, 1, None, S.V, 0x30), (4, 0, 0, 0, None, S.V, 0x10)])
|
||||
one("T", [(0, 0, 61, 1, None, S.Tt, 0x90), (4, 0, 0, 0, None, S.A, 0x03)])
|
||||
one("SD2", [(0, 0, 61, 4), (8, 0, 61, 4, None, S.S, 0xD2), (16, 0, 61, 4, None, S.S, 0xD7)])
|
||||
one("G00mem", [(0, 0, 56, 2, None, S.H, 0x46), (4, 0, 0, 0, None, S.K, 0x02), (8, 0, 49, 2, None, S.G, 0x00), (9, 0, 61, 0, None, S.G, 0x10)])
|
||||
one("Qnote", [(0, 0, 61, 4), (4, 0, 61, 4, None, S.Q, 0x83), (5, 0, 0, 0, None, S.Q, 0x00), (8, 0, 61, 4, 64)])
|
||||
one("Gnew", [(0, 0, 49, 2, None, S.G, 0x04), (4, 0, 61, 0, None, S.G, 0x00)])
|
||||
one("seqA", [(24, 0, 61, 4, None, S.Q, 0x83), (32, 0, 61, 4, None, S.S, 0xC3), (48, 0, 61, 4, 40)])
|
||||
one("seqB", [(32, 0, 61, 4, None, S.S, 0xC3), (48, 0, 61, 4, 40)])
|
||||
one("seqC", [(24, 0, 61, 4, None, S.Q, 0x83), (48, 0, 61, 4, 40)])
|
||||
one("seqD", [(40, 0, 61, 4, None, S.S, 0xD2), (48, 0, 61, 4, 40)])
|
||||
base = [(r, 0, 61, 4, 64 - r // 2) for r in range(0, 64, 8)]
|
||||
one("b1", base)
|
||||
one("b2", base + [(20, 0, 0, 0, None, S.O, 0x08)])
|
||||
ev = base + [(20, 0, 0, 0, None, S.O, 0x08), (24, 0, 61, 4, None, S.Q, 0x83), (32, 0, 61, 4, None, S.S, 0xC3), (40, 0, 61, 4, None, S.S, 0xD2)]
|
||||
one("b3", ev)
|
||||
one("b4", base + [(24, 0, 61, 4, None, S.Q, 0x83), (32, 0, 61, 4, None, S.S, 0xC3), (40, 0, 61, 4, None, S.S, 0xD2)])
|
||||
one("v1", base + [(48, 1, 0, 0, None, S.V, 0x30), (56, 1, 0, 0, None, S.V, 0x40)], ch=2)
|
||||
one("v2", [(e[0], 1) + e[2:] for e in base] + [(48, 0, 0, 0, None, S.V, 0x30), (56, 0, 0, 0, None, S.V, 0x40)], ch=2)
|
||||
ev4 = [(e[0], 3) + e[2:] for e in base + [(24, 0, 61, 4, None, S.Q, 0x83), (32, 0, 61, 4, None, S.S, 0xC3), (40, 0, 61, 4, None, S.S, 0xD2)]]
|
||||
one("c1", ev4, ch=4)
|
||||
one("c2", ev4 + [(48, 2, 0, 0, None, S.V, 0x30)], ch=4)
|
||||
for keep in ((3,),):
|
||||
out.append(("eff" + "".join(map(str, keep)), S.song_effects(set(keep)), "s3m"))
|
||||
return out
|
||||
|
||||
def generate(ctx):
|
||||
which = os.environ.get("PROBE", "s3m")
|
||||
cases = []
|
||||
for nm, data, ext in {"s3m": probes_s3m}[which]():
|
||||
ref = T.reference(ctx, data, ext)
|
||||
cases.append({"name": nm, "data": data, "ref": ref, "duration": ref["duration"], "fmt": ext})
|
||||
ctx.emit("probe_cases", cases)
|
||||
Reference in new issue
Block a user