- MidiFile.set_loop(): one call writes LOOP_START/END, RPR LOOP START/END (Reaper) and LoopBegin/End markers - every engine finds its dialect; reader now parses markers and the smoke test asserts the round-trip - tools/make_tune.py: declarative JSON spec -> fully arranged MIDI with style presets (dos_adventure, n64_ambient, chiptune_racing); the agent-friendly front door, no Python required - tunes/specs/: demo tune 04 'Tea Break at the Terminal' (Am/112, loop bars 4-20) generated entirely from JSON - AGENTS.md: spec schema, score grammar, verification loop, looping conventions for game BGM - MIT LICENSE; history audited clean of credentials
42 lines
1.0 KiB
Bash
Executable File
42 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# build_all.sh — regenerate every tune, verify the MIDI, render WAVs,
|
|
# and run audio sanity checks. One command, from repo root:
|
|
#
|
|
# ./tools/build_all.sh
|
|
#
|
|
# Requires: timidity (with a GM soundfont, e.g. FluidR3_GM.sf2).
|
|
# WAVs land in build/ (gitignored); MIDI files land in midi/.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
mkdir -p midi build
|
|
|
|
for t in tunes/*.py; do
|
|
echo "== $t"
|
|
python3 "$t"
|
|
done
|
|
|
|
for s in tunes/specs/*.json; do
|
|
echo "== $s"
|
|
python3 tools/make_tune.py "$s"
|
|
done
|
|
|
|
echo "== verifying MIDI"
|
|
python3 - <<'EOF'
|
|
import sys, glob
|
|
sys.path.insert(0, "lib")
|
|
from midikit import verify
|
|
for f in sorted(glob.glob("midi/*.mid")):
|
|
d = verify(f)
|
|
print(" %-40s %6.1fs %4d notes %d tracks" %
|
|
(f, d["duration_sec"], sum(len(t["notes"]) for t in d["tracks"]),
|
|
len(d["tracks"])))
|
|
EOF
|
|
|
|
echo "== rendering WAV (timidity)"
|
|
for f in midi/*.mid; do
|
|
out="build/$(basename "${f%.mid}").wav"
|
|
timidity -Ow -s 44 "$f" -o "$out" 2>/dev/null
|
|
python3 tools/check_wav.py "$out"
|
|
done
|
|
echo "ALL OK"
|