- tools/opl/render_opl.cpp: libADLMIDI harness - renders MIDI through OPL3 emulation with game-driver volume models (DMX/Doom, Apogee/Duke, AIL, HMI), normalised output, WAV header patched to actual length - tools/opl/build.sh: one-shot fetch+build of libADLMIDI - tools/render_opl.sh: batch render + check_wav for all tunes - README: OPL3 section
28 lines
950 B
Bash
Executable File
28 lines
950 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# render_opl.sh — render tunes through OPL3 FM (authentic Sound Blaster
|
|
# flavour, no soundfont). Usage:
|
|
# ./tools/render_opl.sh [tune.mid ...] (default: all midi/*.mid)
|
|
# OPL_MODEL=4 ./tools/render_opl.sh ... (4 = Apogee/Duke Nukem volumes)
|
|
#
|
|
# Volume models: 2 NativeOPL3 (id-style) 3 DMX (Doom, default)
|
|
# 4 APOGEE (Duke Nukem 3D) 8 AIL 10 HMI
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
[ -x tools/opl/render_opl ] || ./tools/opl/build.sh
|
|
mkdir -p build/opl
|
|
MODEL="${OPL_MODEL:-3}"
|
|
|
|
files=("$@")
|
|
if [ ${#files[@]} -eq 0 ]; then files=(midi/*.mid); fi
|
|
|
|
for f in "${files[@]}"; do
|
|
dur=$(python3 -c "
|
|
import sys; sys.path.insert(0,'lib')
|
|
from midikit import read
|
|
print(read('$f')['duration_sec'] + 3)")
|
|
out="build/opl/$(basename "${f%.mid}").wav"
|
|
echo "== $f -> $out (model $MODEL)"
|
|
./tools/opl/render_opl "$f" "$out" "$dur" "$MODEL"
|
|
python3 tools/check_wav.py "$out" "$dur"
|
|
done
|