ws-audio2: docs/guide/music.md: the other tracker formats (table rows, Module.engine, More tracker formats with tested snippets; docs_av inputs mtm / med / umx); bench: render 669 / med
This commit is contained in:
1 parent
26fa887370
commit
0a7b74ec49
3 files changed
+87
-5
No files matched your search
@@ -1078,3 +1078,29 @@ do
|
||||
jitTune(false)
|
||||
end
|
||||
end
|
||||
-- ws-audio2: trackers
|
||||
do
|
||||
-- the other tracker loaders on the shared engine: a 669 (Hz periods, auto slides) and an MMD1 (hold / decay
|
||||
-- envelopes, instruments) from tools/fixtures/{669,med}.py, decoded and rendered at 44.1 kHz
|
||||
local Six69 = require("@formats/music/669")
|
||||
local Med = require("@formats/music/med")
|
||||
local songs = { { Six69, require("@tests/gen/669_cases")[1].data }, { Med, require("@tests/gen/med_cases")[2].data } }
|
||||
local best, frames = math.huge, 0
|
||||
local out = buffer.create(4096 * 8)
|
||||
for _ = 1, 3 do
|
||||
frames = 0
|
||||
local t0 = os.clock()
|
||||
for _, s in songs do
|
||||
local dec = (s[1].decode(Bytes.reader(buffer.fromstring(s[2]))) :: any):render()
|
||||
while true do
|
||||
local _, n = dec:read(4096, out)
|
||||
if n == 0 then
|
||||
break
|
||||
end
|
||||
frames += n
|
||||
end
|
||||
end
|
||||
best = math.min(best, os.clock() - t0)
|
||||
end
|
||||
print(string.format("%-8s %-30s %8.2f ms %7.1f x realtime", runtime, "render 669 / med", best * 1000, frames / 44100 / best))
|
||||
end
|
||||
@@ -1,12 +1,13 @@
|
||||
# Docs inputs for the audio / music / video / subtitle guide pages (tools/fixtures.py; tools/docs_check.py reads them):
|
||||
# tiny ffmpeg test clips (testsrc 64x48, 10 frames at 10 fps, with a sine track): MP4 (H.264 + AAC), AVI (MJPEG +
|
||||
# PCM), WebM (VP8 + Vorbis); a MIDI file written here (SMF 1: a tempo track and a melody), the SoundFont of
|
||||
# tools/fixtures/sf2.py (build_sf2), a ProTracker module from tools/fixtures/mod.py (song_basic), and SRT / WebVTT /
|
||||
# ASS subtitles.
|
||||
# tools/fixtures/sf2.py (build_sf2), a ProTracker module from tools/fixtures/mod.py (song_basic), MultiTracker / MED
|
||||
# modules and an Unreal package (tools/fixtures/mtm.py, med.py, s3m.py), and SRT / WebVTT / ASS subtitles.
|
||||
# tests/gen/docs_av.luau { files = { [name] = bytes }, vars = { mp4Bytes = "clip.mp4", ... } }
|
||||
import importlib.util, os, struct, tempfile
|
||||
|
||||
INPUTS = ["tools/docs_check.py", "tools/fixtures/sf2.py", "tools/fixtures/mod.py"]
|
||||
INPUTS = ["tools/docs_check.py", "tools/fixtures/sf2.py", "tools/fixtures/mod.py", "tools/fixtures/mtm.py",
|
||||
"tools/fixtures/med.py", "tools/fixtures/s3m.py", "tools/fixtures/_tracker.py"]
|
||||
|
||||
|
||||
def load(ctx, name):
|
||||
@@ -100,6 +101,11 @@ def generate(ctx):
|
||||
files["bank.sf2"] = sf2.build_sf2(False)[0]
|
||||
mod = load(ctx, "fixtures/mod")
|
||||
files["song.mod"] = mod.song_basic()
|
||||
# ws-audio2: more tracker formats (tools/fixtures/mtm.py, med.py; an Unreal package around an S3M)
|
||||
files["song.mtm"] = load(ctx, "fixtures/mtm").song_effects()
|
||||
files["song.med"] = load(ctx, "fixtures/med").song_basic(version=1)
|
||||
tracker = load(ctx, "fixtures/_tracker")
|
||||
files["music.umx"] = tracker.write_umx([("Theme", load(ctx, "fixtures/s3m").song_mono())])
|
||||
files["subs.srt"] = SRT
|
||||
files["subs.vtt"] = VTT
|
||||
files["subs.ass"] = ASS
|
||||
@@ -110,6 +116,9 @@ def generate(ctx):
|
||||
"midiBytes": "tune.mid",
|
||||
"sf2Bytes": "bank.sf2",
|
||||
"modBytes": "song.mod",
|
||||
"mtmBytes": "song.mtm",
|
||||
"medBytes": "song.med",
|
||||
"umxBytes": "music.umx",
|
||||
"srtText": "subs.srt",
|
||||
"vttText": "subs.vtt",
|
||||
"assText": "subs.ass",
|
||||
|
||||
Reference in new issue
Block a user