Skip to content

Commit bedcfef

Browse files
Install soundfont for FluidSynth MIDI audio synthesis
Add fluid-soundfont-gm and timidity packages to setup.sh so Doom's MIDI music can be synthesized in headless containers. Set SDL_SOUNDFONTS env var to point to the installed .sf2 file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 25a58f0 commit bedcfef

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

setup.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DIR="learn_doom-simulation"
77
# Install system dependencies for ViZDoom audio (OpenAL + FluidSynth)
88
if command -v apt-get &>/dev/null; then
99
echo "==> Installing system audio libraries..."
10-
apt-get update -qq && apt-get install -y -qq libopenal1 libfluidsynth2 2>/dev/null || true
10+
apt-get update -qq && apt-get install -y -qq libopenal1 libfluidsynth2 fluid-soundfont-gm timidity 2>/dev/null || true
1111
fi
1212

1313
echo "==> Cloning $DIR"
@@ -34,6 +34,21 @@ npm install --silent 2>/dev/null
3434
echo "==> Building client..."
3535
npx vite build --outDir ../dist 2>/dev/null
3636

37+
# Locate the General MIDI soundfont for FluidSynth MIDI synthesis
38+
SOUNDFONT=""
39+
for sf in /usr/share/sounds/sf2/FluidR3_GM.sf2 \
40+
/usr/share/soundfonts/FluidR3_GM.sf2 \
41+
/usr/share/sounds/sf2/default-GM.sf2; do
42+
if [ -f "$sf" ]; then
43+
SOUNDFONT="$sf"
44+
break
45+
fi
46+
done
47+
if [ -n "$SOUNDFONT" ]; then
48+
echo "==> Using soundfont: $SOUNDFONT"
49+
export SDL_SOUNDFONTS="$SOUNDFONT"
50+
fi
51+
3752
# Start production server (single process, no proxy overhead)
3853
# ALSOFT_DRIVERS=null lets OpenAL render audio in headless containers without real audio hardware
3954
echo "==> Starting server on port 3000..."

0 commit comments

Comments
 (0)