ws-music: untrack debug probes

This commit is contained in:
4DBug committed 2026-10-31 09:00:08 -05:00
1 parent 4484b72e72
commit 95034f0d4f
3 files changed
-113

No files matched your search

-27
View File
@@ -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
-24
View File
@@ -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