tests/music: comments: specs only
This commit is contained in:
1 parent
fe7566cbba
commit
98b4ce533e
23 files changed
+49
-119
No files matched your search
@@ -1,6 +1,5 @@
|
||||
-- music/669 tests: generated Composer 669 / UNIS 669 modules (tools/fixtures/669.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.
|
||||
-- music/669 tests: generated Composer 669 / UNIS 669 modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/669.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Six69 = require("@rosetta/music/669")
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
-- tests/music/_hively: shared helper of the AHX / HVL tests (not a test itself): renders a fixture case through the
|
||||
-- format and compares it with hvl2wav's output exactly (16-bit samples: CRC-32 of the whole stream, the first
|
||||
-- differing frame located inside the raw head kept by tools/fixtures/ahx.py / hvl.py).
|
||||
-- tests/music/_hively: shared helper of the AHX / HVL tests: exact against hvl2wav (CRC-32 of the 16-bit stream).
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
local Crc32 = require("@rosetta/core/Crc32")
|
||||
|
||||
local H = {}
|
||||
|
||||
-- check(t, Format, c): decode + render + exact comparison; returns the song
|
||||
function H.check(t: any, Format: any, c: any): any
|
||||
local song, err = Format.decode(Bytes.reader(buffer.fromstring(c.data)))
|
||||
t:check(song, c.name .. ": " .. tostring(err))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
-- tests/music/_midivar: shared helper of the MUS / XMI / HMP tests (not a test itself): compares a decoded Midi's
|
||||
-- channel events (codecs/audio/MidiRender.timeline: play order, seconds) with wildmidi -x's conversion
|
||||
-- (tools/fixtures/_midivar.py): notes on / off, program changes, pitch bends (MSB) and controllers, matched per
|
||||
-- (kind, channel, data) in time order, times within 0.1 ms + 1e-5 relative.
|
||||
-- tests/music/_midivar: shared helper of the MUS / XMI / HMP tests: channel events against wildmidi -x's conversion
|
||||
-- (tools/fixtures/_midivar.py), matched per (kind, channel, data) in time order, within 0.1 ms + 1e-5 relative.
|
||||
local Render = require("@rosetta/codecs/audio/MidiRender")
|
||||
|
||||
local M = {}
|
||||
@@ -22,7 +20,6 @@ local function kindOf(status: number, d1: number, d2: number): string?
|
||||
return nil
|
||||
end
|
||||
|
||||
-- the comparable events of a list of { seconds, status, d1, d2 }: key -> { seconds }
|
||||
local function index(list: { { number } }, opts: any): ({ [string]: { number } }, { [string]: number })
|
||||
local by: { [string]: { number } }, counts: { [string]: number } = {}, {}
|
||||
for _, e in list do
|
||||
@@ -38,7 +35,6 @@ local function index(list: { { number } }, opts: any): ({ [string]: { number } }
|
||||
return by, counts
|
||||
end
|
||||
|
||||
-- compare(t, midi, ref, label, opts?) -> worst time difference (s). opts.skip = { cc = true, ... }
|
||||
function M.compare(t: any, midi: any, ref: any, label: string, opts: any?): number
|
||||
local o = opts or {}
|
||||
local tl = Render.timeline(midi)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- tests/music/_similar: shared helper of the tracker tests (not a test itself): renders a module through a Decoder and
|
||||
-- compares it with a reference render's features (tools/fixtures/_tracker.py: per 2048-frame block the RMS of left,
|
||||
-- right and mid, and 40 log-spaced band magnitudes of mid from a Hann-windowed FFT). Same definitions on both sides.
|
||||
-- tests/music/_similar: shared helper of the tracker tests: a render's features against a reference render's
|
||||
-- (tools/fixtures/_tracker.py: per 2048-frame block the RMS of L / R / mid, 40 log bands of mid). Same definitions.
|
||||
local S = {}
|
||||
|
||||
local SR, HOP, BANDS = 44100, 2048, 40
|
||||
@@ -53,7 +52,6 @@ local function fft(re: { number }, im: { number }, n: number)
|
||||
end
|
||||
end
|
||||
|
||||
-- features(samples (interleaved stereo f32 buffer), frames) -> { frames, rmsL, rmsR, rmsM, bands }
|
||||
function S.features(buf: buffer, frames: number): any
|
||||
local n = frames // HOP
|
||||
local out = { frames = n, rmsL = {}, rmsR = {}, rmsM = {}, bands = {} }
|
||||
@@ -88,7 +86,6 @@ function S.features(buf: buffer, frames: number): any
|
||||
return out
|
||||
end
|
||||
|
||||
-- renderAll(decoder, maxFrames) -> interleaved buffer, frames
|
||||
function S.renderAll(dec: any, maxFrames: number): (buffer, number)
|
||||
local total = math.min(dec.frames, maxFrames)
|
||||
local out = buffer.create(math.max(1, total) * 8)
|
||||
@@ -109,7 +106,7 @@ local function db(x: number): number
|
||||
return 20 * math.log10(x + 1e-6)
|
||||
end
|
||||
|
||||
-- compare(ours, ref) -> { gainDb, envCorr, spectral, balance } over the common frames:
|
||||
-- compare(ours, ref) over the common frames:
|
||||
-- gainDb total mid energy ratio in dB (ours / ref)
|
||||
-- envCorr Pearson correlation of the per-block mid loudness in dB (blocks above -60 dB in either)
|
||||
-- envErr mean absolute difference of the per-block mid loudness in dB, after removing gainDb (same blocks)
|
||||
@@ -181,7 +178,6 @@ function S.compare(a: any, b: any): any
|
||||
}
|
||||
end
|
||||
|
||||
-- worst(ours, ref, count) -> the blocks with the lowest spectral similarity (for debugging): { {block, sim} }
|
||||
function S.worst(a: any, b: any, count: number): { { number } }
|
||||
local list = {}
|
||||
for k = 1, math.min(a.frames, b.frames) do
|
||||
@@ -206,10 +202,7 @@ function S.worst(a: any, b: any, count: number): { { number } }
|
||||
return out
|
||||
end
|
||||
|
||||
-- against(t, Fmt, cases, thresh, family?): the shared body of the tracker loader tests (ws-audio2: mtm, 669, stm, ult,
|
||||
-- okt, med, ptm, far, umx): each case decodes, sniffs, plays as long as openmpt's render (thresh.duration s) and
|
||||
-- matches its loudness / envelope / spectrum / balance within thresh; then a seek. cases: { name, data, ref,
|
||||
-- duration }. Returns the decoded modules. The tests run their fuzz pass with S.fuzzer / S.samples.
|
||||
-- the shared body of the tracker loader tests: durations within thresh.duration s of openmpt's render
|
||||
function S.against(t: any, Fmt: any, cases: { any }, thresh: any, family: string?): { any }
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
local Tracker = require("@rosetta/codecs/audio/Tracker")
|
||||
@@ -256,7 +249,6 @@ function S.against(t: any, Fmt: any, cases: { any }, thresh: any, family: string
|
||||
return mods
|
||||
end
|
||||
|
||||
-- fuzzer(Fmt) -> the fuzz function of a tracker loader: decode, and a short render of whatever decodes
|
||||
function S.fuzzer(Fmt: any): (buffer) -> any
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
local Tracker = require("@rosetta/codecs/audio/Tracker")
|
||||
@@ -272,7 +264,6 @@ function S.fuzzer(Fmt: any): (buffer) -> any
|
||||
end
|
||||
end
|
||||
|
||||
-- samples(cases) -> the fuzz seeds (each case's data)
|
||||
function S.samples(cases: { any }): { string }
|
||||
local out = {}
|
||||
for _, c in cases do
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
-- music/ahx tests: AHX songs written by tools/fixtures/_hively.py (every waveform, filter and square sweeps, PList
|
||||
-- commands, effects, subsongs, AHX versions 0..2) and karma.ahx from the HivelyTracker source, rendered through
|
||||
-- codecs/audio/Hively and compared sample for sample with hvl2wav at several stereo separations and rates; the Module
|
||||
-- shape, bad input, and the fuzz no-throw pass. Fixtures: tools/fixtures/ahx.py.
|
||||
-- music/ahx tests: AHX songs (tools/fixtures/_hively.py, karma.ahx) rendered by codecs/audio/Hively vs hvl2wav.
|
||||
-- Fixtures: tools/fixtures/ahx.py.
|
||||
local T = require("@tests/T")
|
||||
local H = require("@tests/music/_hively")
|
||||
local Ahx = require("@rosetta/music/ahx")
|
||||
@@ -30,7 +28,6 @@ for _, c in Cases do
|
||||
t:eq(song.patterns[2].rows, 16, "track rows")
|
||||
t:eq(buffer.readu8(song.patterns[2].data, 0), 25, "track 1 row 0 note")
|
||||
t:eq(#song.subsongs, 1, "subsongs")
|
||||
-- seek back and read again: the same samples
|
||||
local dec = song:render()
|
||||
local a = dec:read(4410)
|
||||
dec:seek(0.5)
|
||||
@@ -43,7 +40,6 @@ for _, c in Cases do
|
||||
end
|
||||
end
|
||||
|
||||
-- bad input
|
||||
local function code(s: string): string?
|
||||
local _, e = Ahx.decode(Bytes.reader(buffer.fromstring(s)))
|
||||
return e and e.code
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/far tests: generated Farandole Composer modules (tools/fixtures/far.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.
|
||||
-- music/far tests: generated Farandole Composer modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/far.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Far = require("@rosetta/music/far")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/hmp tests: HMP (old and "013195" headers, several tick rates) and HMI files (tools/fixtures/hmp.py) decoded and
|
||||
-- compared with wildmidi -x's conversion (notes, HMI note durations, programs, bends, controllers), the FE / loop
|
||||
-- events skipped, a render, bad input, and the fuzz no-throw pass.
|
||||
-- music/hmp tests: HMP and HMI files against wildmidi -x's conversion.
|
||||
-- Fixtures: tools/fixtures/hmp.py.
|
||||
local T = require("@tests/T")
|
||||
local V = require("@tests/music/_midivar")
|
||||
local Hmp = require("@rosetta/music/hmp")
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
-- music/hvl tests: HVL songs written by tools/fixtures/_hively.py (4..8 channels, two effect columns, ring modulation,
|
||||
-- panning, mix gain / stereo from the file, subsongs) and songs from the HivelyTracker source, rendered through
|
||||
-- codecs/audio/Hively and compared sample for sample with hvl2wav (44.1 and 48 kHz); the Module shape, bad input, and
|
||||
-- the fuzz no-throw pass. Fixtures: tools/fixtures/hvl.py.
|
||||
-- music/hvl tests: HVL songs (tools/fixtures/_hively.py, HivelyTracker's) rendered by codecs/audio/Hively vs hvl2wav.
|
||||
-- Fixtures: tools/fixtures/hvl.py.
|
||||
local T = require("@tests/T")
|
||||
local H = require("@tests/music/_hively")
|
||||
local Hvl = require("@rosetta/music/hvl")
|
||||
@@ -32,7 +30,6 @@ for _, c in Cases do
|
||||
t:eq(song.patterns[2].rows, 16, "track rows")
|
||||
t:eq(buffer.readu8(song.patterns[2].data, 0), 25, "track 1 row 0 note")
|
||||
t:eq(#song.subsongs, 1, "subsongs")
|
||||
-- seek back and read again: the same samples
|
||||
local dec = song:render()
|
||||
local a = dec:read(4410)
|
||||
dec:seek(0.5)
|
||||
@@ -45,7 +42,6 @@ for _, c in Cases do
|
||||
end
|
||||
end
|
||||
|
||||
-- bad input
|
||||
local function code(s: string): string?
|
||||
local _, e = Hvl.decode(Bytes.reader(buffer.fromstring(s)))
|
||||
return e and e.code
|
||||
|
||||
+2
-5
@@ -1,6 +1,5 @@
|
||||
-- music/it tests: generated Impulse Tracker modules (tools/fixtures/it.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.
|
||||
-- music/it tests: generated Impulse Tracker modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/it.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local It = require("@rosetta/music/it")
|
||||
@@ -54,7 +53,6 @@ for _, c in Cases do
|
||||
end
|
||||
end
|
||||
|
||||
-- seek: the position after a seek and the output continuing
|
||||
do
|
||||
local m = load(Cases[1].data)
|
||||
local dec = m:render()
|
||||
@@ -65,7 +63,6 @@ do
|
||||
t:check(Tracker.duration(m) == dec.duration, "duration()")
|
||||
end
|
||||
|
||||
-- the fuzz pass: decode, and a short render of whatever decodes
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
table.insert(samples, c.data)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/med tests: generated MED / OctaMED modules (tools/fixtures/med.py: MMD0, MMD1 with hold / decay and finetune,
|
||||
-- MMD2 with a play sequence, an IFF 3-octave sample) 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.
|
||||
-- music/med tests: generated MED / OctaMED modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/med.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Med = require("@rosetta/music/med")
|
||||
|
||||
+3
-11
@@ -1,7 +1,5 @@
|
||||
-- music/midi tests: SMF formats 0 / 1 / 2 + SMPTE + RMID parsed exactly as python mido parses them, mido's own files
|
||||
-- re-encoded byte for byte, round trips without running status, the tempo map against mido's message times and
|
||||
-- lengths, meta summaries, crafted bad files, truncation (lenient / strict), the fallback-synth render (duration,
|
||||
-- level, seek), and the fuzz no-throw pass (decode, and decode + a short render). Fixtures: tools/fixtures/midi.py.
|
||||
-- music/midi tests: SMF files parsed exactly as python mido parses them; mido's own files re-encoded byte for byte.
|
||||
-- Fixtures: tools/fixtures/midi.py.
|
||||
local T = require("@tests/T")
|
||||
local Midi = require("@rosetta/music/midi")
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
@@ -18,7 +16,6 @@ local function decode(data: any, opts: any?): (any, any)
|
||||
return Midi.decode(Bytes.reader(b), opts)
|
||||
end
|
||||
|
||||
-- the contract
|
||||
t:eq(Midi.name, "midi", "name")
|
||||
t:eq(Midi.category, "music", "category")
|
||||
t:check(table.find(Midi.extensions, "mid") ~= nil, "extensions")
|
||||
@@ -108,7 +105,6 @@ for _, c in Cases do
|
||||
end
|
||||
t:note("%d files parse as mido parses them; mido's files re-encode byte for byte", #Cases)
|
||||
|
||||
-- meta summaries
|
||||
do
|
||||
local m = decode(byName.format0.data)
|
||||
t:eq(m.tracks[1].name, "format zero", "track name")
|
||||
@@ -186,7 +182,6 @@ do
|
||||
t:eq(#m.tracks[1].events, 2, "the caller's events are not changed")
|
||||
end
|
||||
|
||||
-- crafted bad files
|
||||
for _, c in Bad do
|
||||
local ok, m, err = pcall(decode, c.data)
|
||||
t:check(ok, c.name .. ": threw " .. tostring(m))
|
||||
@@ -210,7 +205,6 @@ do
|
||||
t:check(l == nil and lerr.code == Err.LIMIT, "maxEvents: LIMIT")
|
||||
end
|
||||
|
||||
-- render through the built-in waveform set
|
||||
do
|
||||
local song = decode(byName.song.data)
|
||||
local dec = song:render({ tail = 0.5 })
|
||||
@@ -253,9 +247,8 @@ do
|
||||
end
|
||||
end
|
||||
t:check(same, "seek renders the same samples as reading through")
|
||||
a:seek(0.25) -- backwards
|
||||
a:seek(0.25)
|
||||
t:check(math.abs(a:position() - 0.25) < 1e-4, "seek backwards")
|
||||
-- open = decode + render
|
||||
local o = Midi.open(Bytes.reader(buffer.fromstring(byName.song.data)), { sampleRate = 22050, tail = 0 })
|
||||
t:check(o and o.sampleRate == 22050, "open: a Decoder at the asked rate")
|
||||
local bad, berr = Midi.render(song, { sampleRate = 5 })
|
||||
@@ -264,7 +257,6 @@ do
|
||||
t:check(bs == nil and Err.is(bserr), "render: bad soundfont bytes")
|
||||
end
|
||||
|
||||
-- the fuzz no-throw pass
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
if #c.data < 20000 then
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/mod tests: generated ProTracker modules (tools/fixtures/mod.py) parsed, rendered through codecs/audio/Tracker and
|
||||
-- compared with openmpt123's render (loudness envelope, band spectrum, stereo balance, song length), the MOD writer's
|
||||
-- round trip, the contract, and the fuzz no-throw pass.
|
||||
-- music/mod tests: generated ProTracker modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/mod.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Mod = require("@rosetta/music/mod")
|
||||
@@ -47,8 +46,7 @@ for _, c in Cases do
|
||||
t:eq(buffer.tostring(out :: buffer), c.data, c.name .. ": round trip bytes")
|
||||
end
|
||||
|
||||
-- MOD -> XM: the converted module plays as long, and sounds alike (XM has no channel panning and uses FT2's NTSC
|
||||
-- Amiga clock, so only the duration and the band spectrum are compared)
|
||||
-- MOD -> XM: only duration and band spectrum compared (XM has no channel panning, uses the FT2 NTSC Amiga clock)
|
||||
local Xm = require("@rosetta/music/xm")
|
||||
for _, c in Cases do
|
||||
local m = load(c.data)
|
||||
@@ -63,7 +61,6 @@ for _, c in Cases do
|
||||
t:check(r.spectral > 0.9, string.format("%s: xm spectrum %.3f", c.name, r.spectral))
|
||||
end
|
||||
|
||||
-- through the API: load sniffs the MOD, open gives a Decoder, save converts to XM, load(as audio) renders
|
||||
do
|
||||
local F = require("@rosetta")
|
||||
local m, err = F.load(Cases[1].data)
|
||||
@@ -75,7 +72,6 @@ do
|
||||
t:eq(F.saveString(m, { format = "mod" }), Cases[1].data, "F.saveString keeps the MOD bytes")
|
||||
end
|
||||
|
||||
-- seek: the position after a seek and the output continuing
|
||||
do
|
||||
local m = load(Cases[1].data)
|
||||
local dec = m:render()
|
||||
@@ -108,7 +104,6 @@ do
|
||||
t:check(total == 240000 and math.abs(l.duration - dec.duration) < 0.01, "loop plays past the end")
|
||||
end
|
||||
|
||||
-- the fuzz pass: decode, and a short render of whatever decodes
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
table.insert(samples, c.data)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/mtm tests: generated MultiTracker modules (tools/fixtures/mtm.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.
|
||||
-- music/mtm tests: generated MultiTracker modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/mtm.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Mtm = require("@rosetta/music/mtm")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/mus tests: Doom MUS files (tools/fixtures/mus.py) decoded and compared with wildmidi -x's conversion (notes,
|
||||
-- programs, pitch bend MSB, controllers; times at wildmidi's tick rate), system events / measure ends, the tick rate
|
||||
-- option, a render, bad input, and the fuzz no-throw pass.
|
||||
-- music/mus tests: Doom MUS files against wildmidi -x's conversion (times at wildmidi's tick rate).
|
||||
-- Fixtures: tools/fixtures/mus.py.
|
||||
local T = require("@tests/T")
|
||||
local V = require("@tests/music/_midivar")
|
||||
local Mus = require("@rosetta/music/mus")
|
||||
@@ -57,7 +56,6 @@ do
|
||||
t:eq(q.meta.length, p.meta.length, "measures: same length")
|
||||
end
|
||||
|
||||
-- a render through the built-in waveforms
|
||||
do
|
||||
local m = assert(decode(Cases[1].data))
|
||||
local dec = m:render({ sampleRate = 22050, tail = 0.2 })
|
||||
@@ -70,7 +68,6 @@ do
|
||||
t:check(peak > 0.01, "render makes sound")
|
||||
end
|
||||
|
||||
-- bad input
|
||||
local _, e1 = decode("MUS\x1a\1\0")
|
||||
t:eq(e1 and e1.code, Err.TRUNCATED, "short header")
|
||||
local _, e2 = decode("MUS\x1a\2\0\200\0\1\0\0\0\0\0\0\0")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/okt tests: generated Oktalyzer modules (tools/fixtures/okt.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.
|
||||
-- music/okt tests: generated Oktalyzer modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/okt.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Okt = require("@rosetta/music/okt")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- 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.
|
||||
-- music/ptm tests: generated PolyTracker modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/ptm.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Ptm = require("@rosetta/music/ptm")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/s3m tests: generated Scream Tracker 3 modules (tools/fixtures/s3m.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.
|
||||
-- music/s3m tests: generated Scream Tracker 3 modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/s3m.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local S3m = require("@rosetta/music/s3m")
|
||||
@@ -41,7 +40,6 @@ for _, c in Cases do
|
||||
t:check(r.balance < THRESH.balance, c.name .. ": stereo balance")
|
||||
end
|
||||
|
||||
-- seek: the position after a seek and the output continuing
|
||||
do
|
||||
local m = load(Cases[1].data)
|
||||
local dec = m:render()
|
||||
@@ -52,7 +50,6 @@ do
|
||||
t:check(Tracker.duration(m) == dec.duration, "duration()")
|
||||
end
|
||||
|
||||
-- the fuzz pass: decode, and a short render of whatever decodes
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
table.insert(samples, c.data)
|
||||
|
||||
+2
-11
@@ -1,7 +1,5 @@
|
||||
-- music/sf2 + codecs/audio/SoundFont tests: a self-made SF2 parsed (INFO, presets, sample headers, instruments, generator
|
||||
-- merging with preset / instrument global zones, 16-bit and sm24 samples), a test song rendered through it compared
|
||||
-- with FluidSynth's render (loudness envelope and per-segment band spectra by correlation, pitch peaks), bad files,
|
||||
-- the built-in fallback waveform set, and the fuzz no-throw pass. Fixtures: tools/fixtures/sf2.py.
|
||||
-- music/sf2 + codecs/audio/SoundFont tests: a self-made SF2; a test song rendered through it vs FluidSynth.
|
||||
-- Fixtures: tools/fixtures/sf2.py.
|
||||
local T = require("@tests/T")
|
||||
local Sf2 = require("@rosetta/music/sf2")
|
||||
local Midi = require("@rosetta/music/midi")
|
||||
@@ -16,14 +14,12 @@ local function reader(s: string): Bytes.Reader
|
||||
return Bytes.reader(buffer.fromstring(s))
|
||||
end
|
||||
|
||||
-- the contract
|
||||
t:eq(Sf2.name, "sf2", "name")
|
||||
t:eq(Sf2.category, "music", "category")
|
||||
t:check(Sf2.caps.decode and not Sf2.caps.encode, "caps")
|
||||
t:eq(Sf2.sniff(reader(Fx.sf2)), 1, "sniff")
|
||||
t:eq(Sf2.sniff(reader("RIFF\0\0\0\0WAVE")), 0, "sniff WAVE")
|
||||
|
||||
-- parse
|
||||
local sf, err = Sf2.decode(reader(Fx.sf2))
|
||||
t:check(sf, "decode: " .. tostring(err))
|
||||
local E = Fx.expect
|
||||
@@ -93,7 +89,6 @@ do
|
||||
t:eq(buffer.len(sf.samples), (sf.sampleCount + 1) * 4, "samples: one pad sample")
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ vs FluidSynth
|
||||
local F = Fx.fluid
|
||||
local song = Midi.decode(reader(Fx.song))
|
||||
t:check(song, "song decodes")
|
||||
@@ -134,7 +129,6 @@ local function pearson(a: { number }, b: { number }): number
|
||||
return sab / math.sqrt(saa * sbb + 1e-30)
|
||||
end
|
||||
|
||||
-- in-place radix-2 FFT of re / im (1-based arrays of length n, a power of two)
|
||||
local function fft(re: { number }, im: { number }, n: number)
|
||||
local j = 0
|
||||
for i = 0, n - 2 do
|
||||
@@ -248,7 +242,6 @@ for wi, w in F.windows do
|
||||
t:note("window %g-%g s: peak %.1f Hz (FluidSynth %.1f Hz)", w[1], w[2], hz, F.peaks[wi])
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ bad files
|
||||
local function bad(data: string, code: string, label: string)
|
||||
local ok, v, e = pcall(Sf2.decode, reader(data))
|
||||
t:check(ok, label .. ": threw " .. tostring(v))
|
||||
@@ -265,7 +258,6 @@ t:check(lim2 == nil and lerr2.code == Err.LIMIT, "maxRegions: LIMIT")
|
||||
local p, perr = SoundFont.parse(42 :: any)
|
||||
t:check(p == nil and perr.code == Err.ARG, "parse: bad argument")
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ fallback
|
||||
do
|
||||
local fb = SoundFont.fallback()
|
||||
t:eq(#fb.presets, 129, "fallback: 128 programs + a drum kit")
|
||||
@@ -310,7 +302,6 @@ do
|
||||
t:check(true, "out-of-range render requests are clipped")
|
||||
end
|
||||
|
||||
-- the fuzz no-throw pass (parse, then a few notes through whatever parsed)
|
||||
t:fuzz("decode", function(b: buffer)
|
||||
local f = Sf2.decode(Bytes.reader(b))
|
||||
if f then
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/stm tests: generated Scream Tracker 2 modules (tools/fixtures/stm.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.
|
||||
-- music/stm tests: generated Scream Tracker 2 modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/stm.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Stm = require("@rosetta/music/stm")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/ult tests: generated UltraTracker modules (tools/fixtures/ult.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.
|
||||
-- music/ult tests: generated UltraTracker modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/ult.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Ult = require("@rosetta/music/ult")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/umx tests: Unreal packages wrapping generated S3M / IT modules (tools/fixtures/umx.py): the export found and
|
||||
-- unwrapped (bytes equal to the module put in), loaded through the api's decodeModule hook and rendered like
|
||||
-- openmpt123 renders the package, UNSUPPORTED without the hook, the contract, and the fuzz no-throw pass.
|
||||
-- music/umx tests: Unreal packages wrapping generated S3M / IT modules, rendered like openmpt123 renders the package.
|
||||
-- Fixtures: tools/fixtures/umx.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local F = require("@rosetta")
|
||||
|
||||
+2
-6
@@ -1,7 +1,5 @@
|
||||
-- music/xm tests: generated FastTracker 2 modules (tools/fixtures/xm.py) parsed, rendered through codecs/audio/Tracker and
|
||||
-- compared with openmpt123's render (loudness envelope, band spectrum, stereo balance, song length; a ModPlug ADPCM
|
||||
-- sample), the XM writer's
|
||||
-- round trip, the contract, and the fuzz no-throw pass.
|
||||
-- music/xm tests: generated FastTracker 2 modules vs openmpt123's render.
|
||||
-- Fixtures: tools/fixtures/xm.py.
|
||||
local T = require("@tests/T")
|
||||
local S = require("@tests/music/_similar")
|
||||
local Xm = require("@rosetta/music/xm")
|
||||
@@ -53,7 +51,6 @@ for _, c in Cases do
|
||||
end
|
||||
end
|
||||
|
||||
-- seek: the position after a seek and the output continuing
|
||||
do
|
||||
local m = load(Cases[1].data)
|
||||
local dec = m:render()
|
||||
@@ -64,7 +61,6 @@ do
|
||||
t:check(Tracker.duration(m) == dec.duration, "duration()")
|
||||
end
|
||||
|
||||
-- the fuzz pass: decode, and a short render of whatever decodes
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
table.insert(samples, c.data)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- music/xmi tests: XMIDI files (tools/fixtures/xmi.py: XDIR + CAT XMID with one or two songs, a bare FORM XMID, with
|
||||
-- and without TIMB) decoded and compared with wildmidi -x's conversion of song 1 (notes from durations, programs,
|
||||
-- bends, controllers; 120 Hz), song selection, export to SMF, a render, bad input, and the fuzz no-throw pass.
|
||||
-- music/xmi tests: XMIDI files against wildmidi -x's conversion of song 1 (120 Hz).
|
||||
-- Fixtures: tools/fixtures/xmi.py.
|
||||
local T = require("@tests/T")
|
||||
local V = require("@tests/music/_midivar")
|
||||
local Xmi = require("@rosetta/music/xmi")
|
||||
|
||||
Reference in new issue
Block a user