#!/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 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"