ws-audio2: music/stm (Scream Tracker 2): s3m family with the ST2 tempo byte, deferred Bxx, no effect memory
This commit is contained in:
1 parent
33d87e0c4d
commit
80f5fd2c5b
6 files changed
+396
No files matched your search
@@ -0,0 +1,90 @@
|
||||
# STM fixtures (tools/fixtures.py): generated Scream Tracker 2 modules exercising the effects, rendered by openmpt123.
|
||||
# tests/gen/stm_cases.luau { name, data (the module), ref (features of openmpt's render, tools/fixtures/_tracker.py),
|
||||
# duration (openmpt's song length) }
|
||||
import os, sys
|
||||
|
||||
# the shared tracker module, loaded by path (tools/fixtures/ must not go on sys.path: xml.py there would shadow xml)
|
||||
T = sys.modules.get("_tracker")
|
||||
if T is None:
|
||||
import importlib.util
|
||||
_spec = importlib.util.spec_from_file_location("_tracker", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_tracker.py"))
|
||||
T = importlib.util.module_from_spec(_spec)
|
||||
sys.modules["_tracker"] = T
|
||||
_spec.loader.exec_module(T)
|
||||
|
||||
INPUTS = ["tools/fixtures/_tracker.py"]
|
||||
|
||||
A, B, C, D, E, F, G, H, I, J = range(1, 11)
|
||||
|
||||
|
||||
def empty():
|
||||
return [[(0, 0, None, 0, 0) for _ in range(4)] for _ in range(64)]
|
||||
|
||||
|
||||
def put(p, row, ch, note=0, ins=0, vol=None, cmd=0, info=0):
|
||||
p[row][ch] = (note, ins, vol, cmd, info)
|
||||
|
||||
|
||||
def samples():
|
||||
return [
|
||||
{"name": "sine", "data": T.s8(T.synth("sine", 64, 64)), "volume": 64, "c2spd": 8363, "loop": (0, 64)},
|
||||
{"name": "square", "data": T.s8(T.synth("square", 64, 64, 0.5)), "volume": 40, "c2spd": 16726, "loop": (0, 64)},
|
||||
{"name": "saw", "data": T.s8(T.synth("saw", 100, 100, 0.6)), "volume": 64, "c2spd": 13000, "loop": (0, 100)},
|
||||
{"name": "noise", "data": T.s8(T.synth("noise", 6000, 1, 0.7, decay=1500)), "volume": 60, "c2spd": 8363},
|
||||
{"name": "tri", "data": T.s8(T.synth("tri", 50, 50, 0.8)), "volume": 50, "c2spd": 10000, "loop": (0, 50)},
|
||||
]
|
||||
|
||||
|
||||
def song_effects():
|
||||
a, b, c = empty(), empty(), empty()
|
||||
mel = [61, 65, 68, 73, 68, 65, 63, 61]
|
||||
for i in range(16):
|
||||
put(a, i * 4, 0, mel[i % 8], 1, None, J if i % 4 == 1 else 0, 0x47 if i % 4 == 1 else 0)
|
||||
put(a, 0, 1, 49, 2, 48)
|
||||
put(a, 4, 1, 0, 0, None, D, 0x04)
|
||||
put(a, 8, 1, 0, 0, None, D, 0x20)
|
||||
put(a, 16, 1, 51, 2, None, E, 0x03)
|
||||
put(a, 20, 1, 0, 0, None, F, 0x06)
|
||||
put(a, 28, 1, 56, 2, None, H, 0x46)
|
||||
put(a, 40, 1, 49, 2, None, G, 0x00)
|
||||
put(a, 41, 1, 61, 0, None, G, 0x10)
|
||||
put(a, 52, 1, 0, 0, None, I, 0x21)
|
||||
for r in range(0, 64, 8):
|
||||
put(a, r, 3, 61, 4, 64 - r // 2)
|
||||
put(a, 24, 3, 254)
|
||||
put(a, 48, 2, 37, 3)
|
||||
put(a, 32, 2, 0, 0, None, A, 0x40) # ST2 tempo byte: speed 4, a fine tick length
|
||||
put(b, 0, 2, 49, 3, None, A, 0x63)
|
||||
put(b, 8, 2, 52, 5)
|
||||
put(b, 10, 0, 64, 1)
|
||||
put(b, 20, 0, 61, 1, 30)
|
||||
put(b, 24, 0, 254)
|
||||
put(b, 16, 1, 0, 0, None, B, 0x02) # deferred: taken at the C below (unreachable orders would be openmpt subsongs)
|
||||
put(b, 40, 3, 0, 0, None, C, 0x08)
|
||||
put(c, 8, 0, 49, 1, 32)
|
||||
put(c, 12, 1, 61, 2)
|
||||
put(c, 20, 0, 0, 0, None, B, 0x00) # deferred to the end of the pattern
|
||||
put(c, 30, 2, 0, 0, None, A, 0x8F)
|
||||
return T.write_stm("effects", samples(), [0, 1, 2], [a, b, c], tempo=0x60)
|
||||
|
||||
|
||||
def song_old():
|
||||
"""an ST 2.00 file: decimal tempo bytes, a short order list, no global volume"""
|
||||
a = empty()
|
||||
put(a, 0, 0, 61, 1)
|
||||
put(a, 8, 1, 68, 2)
|
||||
put(a, 16, 0, 0, 0, None, H, 0x28)
|
||||
put(a, 32, 1, 0, 0, None, A, 50) # decimal 50 = 0x50
|
||||
put(a, 40, 2, 49, 5, 40)
|
||||
put(a, 44, 3, 56, 3)
|
||||
put(a, 52, 3, "fb")
|
||||
put(a, 2, 0, "skip")
|
||||
return T.write_stm("old", samples(), [0], [a], tempo=72, gvol=20, minor=0)
|
||||
|
||||
|
||||
def generate(ctx):
|
||||
cases = []
|
||||
for nm, data in (("effects", song_effects()), ("old", song_old())):
|
||||
ref = T.reference(ctx, data, "stm")
|
||||
cases.append({"name": nm, "data": data, "ref": ref, "duration": ref["duration"]})
|
||||
ctx.emit("stm_cases", cases)
|
||||
Reference in new issue
Block a user