./jerome{m}jack in

~/Labs/Galaxy Lab.md · lab · 4 min · updated

Galaxy Lab

2026 · Rust · WebAssembly · Web Audio · Unreal Engine 1 · Deus Ex in the Browser

Deus Ex's soundtrack doesn't stream MP3s. Every track in the game is an Impulse Tracker (.it) module wrapped in a .umx package, sequenced and mixed live on the CPU by Carlo Vogelsang's Galaxy.dll — complete with instant order-list jumps when a guard spots you (Ambient → Combat → Conversation) and a custom 3-stage SSE allpass/lowpass zone reverb that gives Battery Park, Hong Kong's underground storage, and Wan Chai's garage their unmistakable metallic echo.

The Galaxy Lab runs the oracle-verified Rust translation of Galaxy.dll from my Deus Ex decompilation straight inside a browser AudioWorklet. Play built-in original multi-section Impulse Tracker modules (zero game assets bundled — synthesized on the fly inside galaxy.wasm), jump live between Ambient, Combat, and Conversation sections with glxControlMusic, dial in authentic Deus Ex reverb zone presets, flip between x87 control words (0x037f vs 0x007f) and Unicorn oracle mutants to hear the math break in real time, or drop any .it or .umx file of your own straight onto the deck. Nothing is uploaded.

galaxy · livePress play (or space) to start the Galaxy.dll SSE mixer, click ambient / combat / conversation to trigger real glxControlMusic section jumps, audition Deus Ex zone reverb presets or the ping impulse, and drop any .it or .umx module onto the scope.open ↗

Dynamic game music in 1999: order-list sections

Instead of cross-fading multi-megabyte WAV stems, Deus Ex packs every mood of a level into one ~300 KB Impulse Tracker module and partitions the order list into looping subsections using tracker Bxx (Position Jump) commands:

text
Orders 0–1  ──▶  Ambient       (ends with B00 → loops back to order 0)
Orders 2–3  ──▶  Combat        (ends with B02 → loops back to order 2)
Orders 4–5  ──▶  Conversation  (ends with B04 → loops back to order 4)

When you cross a trigger volume or pull a weapon, UnrealScript changes Level.SongSection and UGalaxyAudioSubsystem::Update sends glxControlMusic(GLX_SETPOSITION, section) into Galaxy.dll. The sequencer sets the pending jump flag, cleanly transitions to the new order slot, and the same 256-voice SSE software mixer keeps running seamlessly with shared instrument samples. Every built-in demo here is synthesized as a spec-valid IMPM Impulse Tracker binary with three looping sections wired the exact same way — and if you drop any real .it or .umx file, galaxy.wasm locates the embedded IMPM payload and feeds it directly to the exact glxLoadMusic parser.

The 3-stage SSE allpass/lowpass reverb kernel

Whenever the listener stands inside a ZoneInfo with bReverbZone = True, Galaxy.dll builds a 108-byte glxReverb struct (MasterGain, CutoffHz, and six (Delay, Gain) pairs) and installs its hand-written SSE reverb kernel (0x10622d33).

Per stereo frame, the feedback pair x0 swaps left and right channels (shufps xmm0, xmm0, 1), averages with the incoming reverb send, and passes through three cascaded two-lane allpass/lowpass stages sharing 16,384-frame circular delay lines:

\begin{aligned} x_0 &\leftarrow \tfrac{1}{2}\bigl(\operatorname{swap}(x_0) + \text{send}[f]\bigr) \\ s_\ell &\leftarrow k \cdot y_\ell + (1 - k) \cdot s_\ell \\ \text{line}_\ell[\text{pos}] &\leftarrow x_1 + g_\ell \cdot s_\ell \\ x_0 &\leftarrow -g_\ell \cdot x_1 + (1 - g_\ell^2) \cdot y_\ell \end{aligned}

In the shipped game, 21 zones across 16 maps enable bReverbZone, collapsing to four distinct reverb blocks: the standard ZoneInfo default (18 zones including Brooklyn Bridge Station), Battery Park (MasterGain 110), Hong Kong Storage (CutoffHz 8000), and Wan Chai Garage (custom tight concrete delays). Try the ping button in the reverb panel to send a dry transient impulse straight into the three cascaded delay lines — you can hear the exact metallic ping-pong flutter of each room!

Hearing x87 control words and oracle mutants

During setup (0x106109f0), Galaxy.dll computes the single-pole low-pass damping coefficient k on the x87 FPU from CutoffHz:

x = \frac{\text{HFDamp} \cdot 6.282\text{f}}{\text{rate}}, \qquad a = 1 - \operatorname{FCOS}(x), \qquad k = \sqrt{(a + 2)\,a} - a

When we validated reverb.rs natively against real AMD x87 silicon and Rosetta 2 across all 44,101 cutoffs (0..44100 Hz):

  • Under 0x037f (PC 64) and 0x027f (PC 53), every single stored k and 1 - k matched bit-for-bit.
  • Under 0x007f (PC 24 — the render pass's control word), 30,050 of 44,101 cutoffs produced a different k!

You can compare 0x037f vs 0x007f right in the panel (watch the live k hex bits shift), and even flip on the two Unicorn verification mutants we used to stress-test the translation:

  • Mutant 305 (no crossfeed) — strips out shufps xmm0, xmm0, 1, collapsing the stereo ping-pong into dual-mono tunnels.
  • Mutant 306 (lowpass swap) — swaps k and 1 - k inside the damping filter, inverting bright rooms into muffled caves and dark chambers into metallic hiss.

How it's built

galaxy.wasm compiles the unmodified, zero-dependency Impulse Tracker loader, tick sequencer, 256-voice SSE float32 mixer (cvtpi2ps round-to-nearest-even + packssdw saturation), 100-bit fixed-point FCOS setup, and 3-stage SSE reverb kernel straight to WebAssembly. In the browser, an AudioWorklet pulls 128-frame stereo quanta directly from galaxy.wasm (resampling cleanly from Galaxy's native 44.1 kHz to your output device's sample rate) and posts live stereo scopes, voice meters, and tracker row/order telemetry back to the canvas.

Back to Labs · paint procedural textures in Fire.dll Lab · read the full decompilation in Deus Ex in the Browser · explore 80-bit Ghosts · see how this site works.