Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: 8D audio mode and brighter alley at the Pole Club

nirholas5bb6a72bbaad
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f7c4acc5d..056a0b239 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Agent Studio** (`/agent-studio`) — Author your agent's brain, memory, body, money, and skills in one place, with a live 3D avatar that updates everywhere as you edit.
- **Coin Clash** (`/clash`) — Token-gated community warfare. Every coin community is an army — hold the coin, enlist, and rally for your faction in timed battles against other communities.
- **Flappin UFO — dodge asteroids for $THREE** (`/play/ufo`) — Pilot your UFO through an asteroid field. Connect your Solana wallet, submit your score as your wallet address, and claim your spot on the global $THREE leaderboard.
+- **8D audio mode at the Pole Club** — There's a new 8D pill in the Pole Club top bar. Flip it on (headphones recommended) and the whole soundtrack starts slowly orbiting around your head — the spinning, three-dimensional “8D audio” effect — looping a full lap roughly every eight seconds. It rides on top of everything: the muffled-through-the-door walk-in, the clear-up as you step inside, and the per-dancer tip tracks. The orbit only moves the stereo image, never the volume, so nothing pumps as it circles, and your choice is remembered between visits. Off by default. (`/club`) `[feature]`
- **Agent Studio — one place to build your whole agent, with a live avatar** — Agent Studio is the new home for authoring everything about your AI agent — its brain, memory, 3D body, money, and skills — side by side with a live avatar that updates the instant you make a change, no save button and no refresh. The same living avatar can now appear anywhere on the platform as a presence companion, reacting with real emotion to what's happening: it celebrates a filled trade, looks concerned when a position drops, and stays in sync with whatever you edit in the Studio. This release ships the Studio shell and the shared foundation the rest of the experience builds on. (`/agent-studio`) `[feature]`
- **Agent wallet's full money loop is now verified end-to-end on devnet** — A re-runnable harness now exercises the entire agent-wallet lifecycle in one pass — create a wallet, fund it, trade and snipe pump.fun tokens, pay an x402 service, exit a graduated position, and withdraw — against real Solana devnet state. It runs simulate-first and reports each step as passed or honestly blocked on funding/credentials, never a fake result, so regressions in the seams between deposit, trading, sniping, payments, and withdrawal surface before they reach holders. The agent wallet hub's Snipe tab now opens the live Sniper dashboard directly instead of a placeholder. (`/agent-wallet`) `[infra]`
- **Align a whole room of agents in one gesture** — When you place several agents around a room, their spacing is already exact for everyone — but the whole cluster can sit a few metres off where it really is, because phone GPS only knows the spot to within several metres. Now you can fix that in one move: open any of your room agents and tap “Align this room,” then drag to slide the entire group onto its true spot and twist with two fingers to rotate it — every agent moves together, keeping its layout intact, instead of nudging them one at a time. A live readout shows the move in honest metres and degrees, and the room is labelled with how tightly it's anchored so you know when it's worth aligning. Only the room's owner can move it. And if you arrive at a room someone placed without a compass that looks turned the wrong way, a one-tap “Align to your view” straightens it out for you. (`/irl`) `[improvement]`
@@ -51,6 +52,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Shared agent links now unfurl with the agent's own avatar** — When you paste a link to an agent on X, Discord, Slack, Telegram or iMessage, the preview card now shows that agent's actual avatar, name and description instead of a generic three.ws image — so every shared link is visual proof of the collectible. Bots that don't run JavaScript get the right image and text rendered on the server, and agents without an avatar yet fall back to a clean branded card with their initial. We also fixed the canonical and share URLs on agent pages to point at the real /agents/<id> address. `[feature, improvement]`
- **Smoother switch between camera AR and Place on floor** — On phones that can anchor an agent to your real floor, flipping between plain Camera AR and the Place on floor flow is now seamless. Before, tapping the two in quick succession could fight over the camera and leave you on a black screen with the camera light stuck on; now each switch waits for the previous one to finish releasing the camera, so it never double-grabs it. Leaving a floor session drops you straight back into the live camera view you came from — passthrough resumes instantly instead of flashing a dark frame — and taps on the screen behind the floor-anchor panel no longer slip through to open the wrong thing. If a floor session can't start, the scene keeps running and you get the calm "use Pin here instead" card rather than a frozen view. (`/irl`) `[fix]`
- **Tapping an agent in AR now lands every time** — Inspecting an agent in IRL AR is a tap — and we made that tap far harder to miss. There's now a finger-sized catch zone around each agent's floating name, so a tap that lands just beside a small or distant agent still opens its card instead of doing nothing. When several agents overlap on screen, your tap resolves to the one in front of you, and it never selects an agent that's behind you or off-screen. We also kept agents from vanishing when you bring your phone right up to one to look closely. Inspecting works whether the agent is centered, near the edge of the frame, close, or far. (`/irl`) `[improvement]`
+- **The Pole Club alley is easier to see** — The walk up to the Pole Club was lit so tightly that only a thin strip of pavement under your feet was visible while the walls fell away to black. The alley now carries a soft warm fill light that travels with you and a wider key, plus a gentle lift to the ambient glow — so the stretch you're actually walking through stays legible the whole way to the door, without losing the moody neon look. (`/club`) `[improvement]`
- **Token Oracle follow / unfollow is working again** — Subscribing an agent to a token's oracle alerts — and unsubscribing — was silently failing for everyone; only the status check worked. Both now go through correctly, so you can opt an agent into (and out of) score-based alerts as intended. `[fix]`
- **Unity & Unreal avatar loading documented with code that actually works** — The developer hub's Unity and Unreal cards used to show sample code for an SDK that doesn't exist yet. They now show the real, working way to load a three.ws avatar today — your avatar's GLB endpoint loaded at runtime with glTFast (Unity) or glTFRuntime (Unreal), both standard glTF importers — alongside an honest note that a native package is still on the roadmap. (`/dashboard/developers`) `[docs, improvement]`
- **Vanity wallets for every agent — opt-in, owned per user** — Every agent and avatar has its own custodial Solana wallet, and you own it per creation: make an avatar and its agent wallet is yours; if someone forks or saves that avatar, they get a brand-new wallet they alone control — yours is never shared or copied. A new Vanity tab in the agent wallet hub lets you grind a custom address (your own prefix and/or suffix) on demand. If the wallet already holds funds, they're automatically and safely swept to the new address before the switch completes, so funds are never stranded. The wallet now appears everywhere an agent or avatar shows up — profiles, avatar pages, your Agents and Avatars dashboards, the Characters feed and Trending — each with one-tap copy, an explorer link, and a vanity badge. (`/vanity-wallet`) `[feature]`
diff --git a/data/changelog.json b/data/changelog.json
index 9884ec076..64f718104 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -17,6 +17,24 @@
"feature"
]
},
+ {
+ "date": "2026-06-19",
+ "title": "8D audio mode at the Pole Club",
+ "summary": "There's a new 8D pill in the Pole Club top bar. Flip it on (headphones recommended) and the whole soundtrack starts slowly orbiting around your head — the spinning, three-dimensional “8D audio” effect — looping a full lap roughly every eight seconds. It rides on top of everything: the muffled-through-the-door walk-in, the clear-up as you step inside, and the per-dancer tip tracks. The orbit only moves the stereo image, never the volume, so nothing pumps as it circles, and your choice is remembered between visits. Off by default.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/club"
+ },
+ {
+ "date": "2026-06-19",
+ "title": "The Pole Club alley is easier to see",
+ "summary": "The walk up to the Pole Club was lit so tightly that only a thin strip of pavement under your feet was visible while the walls fell away to black. The alley now carries a soft warm fill light that travels with you and a wider key, plus a gentle lift to the ambient glow — so the stretch you're actually walking through stays legible the whole way to the door, without losing the moody neon look.",
+ "tags": [
+ "improvement"
+ ],
+ "link": "/club"
+ },
{
"date": "2026-06-19",
"title": "Pole Club music opens up as you walk inside",
diff --git a/pages/club.html b/pages/club.html
index 4e4bece9e..4527fdaaf 100644
--- a/pages/club.html
+++ b/pages/club.html
@@ -169,6 +169,13 @@
border-color: rgba(124, 93, 146, 0.38);
color: var(--text-3);
}
+ /* 8D pill: a steady cyan glow while the orbit is live. */
+ .club-pill-8d[aria-pressed="true"] {
+ background: rgba(74, 214, 255, 0.16);
+ border-color: rgba(74, 214, 255, 0.5);
+ color: #cdeefe;
+ box-shadow: 0 0 10px rgba(74, 214, 255, 0.35);
+ }
/* ── Presence bar ─────────────────────────────────── */
.club-presence {
@@ -1521,6 +1528,7 @@
.club-lb-tab:focus-visible,
.club-react-btn:focus-visible,
#club-audio-toggle:focus-visible,
+ #club-spatial-toggle:focus-visible,
#club-free-cam:focus-visible,
#club-sheet-handle:focus-visible {
outline: 2px solid var(--accent-2);
@@ -2052,6 +2060,13 @@
aria-pressed="false"
title="Toggle club audio (mute)"
>🔊 Audio on</button>
+ <button
+ id="club-spatial-toggle"
+ type="button"
+ class="club-pill club-pill-toggle club-pill-8d"
+ aria-pressed="false"
+ title="8D audio — orbits the sound around your head (headphones recommended)"
+ >🎧 8D off</button>
</header>
<!-- STAGE -->
diff --git a/public/changelog.json b/public/changelog.json
index 8b8720167..d2982c878 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-19T16:46:11.556Z",
+ "generated_at": "2026-06-19T17:00:21.584Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -36,6 +36,16 @@
"launch"
]
},
+ {
+ "date": "2026-06-19",
+ "type": "update",
+ "title": "8D audio mode at the Pole Club",
+ "summary": "There's a new 8D pill in the Pole Club top bar. Flip it on (headphones recommended) and the whole soundtrack starts slowly orbiting around your head — the spinning, three-dimensional “8D audio” effect — looping a full lap roughly every eight seconds. It rides on top of everything: the muffled-through-the-door walk-in, the clear-up as you step inside, and the per-dancer tip tracks. The orbit only moves the stereo image, never the volume, so nothing pumps as it circles, and your choice is remembered between visits. Off by default.",
+ "link": "/club",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-06-19",
"type": "update",
@@ -467,6 +477,16 @@
"improvement"
]
},
+ {
+ "date": "2026-06-19",
+ "type": "update",
+ "title": "The Pole Club alley is easier to see",
+ "summary": "The walk up to the Pole Club was lit so tightly that only a thin strip of pavement under your feet was visible while the walls fell away to black. The alley now carries a soft warm fill light that travels with you and a wider key, plus a gentle lift to the ambient glow — so the stretch you're actually walking through stays legible the whole way to the door, without losing the moody neon look.",
+ "link": "/club",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-06-19",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index f2aaf8978..5b22b69bd 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -30,6 +30,14 @@
<category>launch</category>
<description>Pilot your UFO through an asteroid field. Connect your Solana wallet, submit your score as your wallet address, and claim your spot on the global $THREE leaderboard.</description>
</item>
+ <item>
+ <title>8D audio mode at the Pole Club</title>
+ <link>https://three.ws/club</link>
+ <guid isPermaLink="false">2026-06-19:8D audio mode at the Pole Club</guid>
+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>There's a new 8D pill in the Pole Club top bar. Flip it on (headphones recommended) and the whole soundtrack starts slowly orbiting around your head — the spinning, three-dimensional “8D audio” effect — looping a full lap roughly every eight seconds. It rides on top of everything: the muffled-through-the-door walk-in, the clear-up as you step inside, and the per-dancer tip tracks. The orbit only moves the stereo image, never the volume, so nothing pumps as it circles, and your choice is remembered between visits. Off by default.</description>
+ </item>
<item>
<title>Agent Studio — one place to build your whole agent, with a live avatar</title>
<link>https://three.ws/agent-studio</link>
@@ -366,6 +374,14 @@
<category>improvement</category>
<description>Inspecting an agent in IRL AR is a tap — and we made that tap far harder to miss. There's now a finger-sized catch zone around each agent's floating name, so a tap that lands just beside a small or distant agent still opens its card instead of doing nothing. When several agents overlap on screen, your tap resolves to the one in front of you, and it never selects an agent that's behind you or off-screen. We also kept agents from vanishing when you bring your phone right up to one to look closely. Inspecting works whether the agent is centered, near the edge of the frame, close, or far.</description>
</item>
+ <item>
+ <title>The Pole Club alley is easier to see</title>
+ <link>https://three.ws/club</link>
+ <guid isPermaLink="false">2026-06-19:The Pole Club alley is easier to see</guid>
+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>The walk up to the Pole Club was lit so tightly that only a thin strip of pavement under your feet was visible while the walls fell away to black. The alley now carries a soft warm fill light that travels with you and a wider key, plus a gentle lift to the ambient glow — so the stretch you're actually walking through stays legible the whole way to the door, without losing the moody neon look.</description>
+ </item>
<item>
<title>Token Oracle follow / unfollow is working again</title>
<link>https://three.ws/changelog</link>
diff --git a/public/features.json b/public/features.json
index 49a96ad67..97b09406d 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-19T16:46:11.541Z",
+ "generated_at": "2026-06-19T17:00:21.567Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/club-audio.js b/src/club-audio.js
index 8a2a57c8b..98663480a 100644
--- a/src/club-audio.js
+++ b/src/club-audio.js
@@ -51,6 +51,12 @@ export class ClubAudio {
this._loading = new Map(); // styleName → Promise<AudioBuffer>
this._peakBuf = null; // Uint8Array reused for getByteFrequencyData
this._clarity = 0; // 0 = outside muffle, 1 = open floor — ramps with the walk-in
+ this._panner = null; // HRTF node the whole mix orbits through for 8D
+ this.spatialIn = null; // gain that funnels every layer into the panner
+ // 8D orbit config. `speed` is orbits/second — ~0.125 puts a full lap at
+ // ~8s, the classic "8D audio" sweep. Off by default: it's a headphone
+ // effect and can be disorienting on speakers.
+ this.spin = { on: this._read8DPref(), speed: 0.125, radius: 1.0, height: 0 };
this.muted = this._readMutedPref();
this._onStatus = null; // optional callback(name, label)
}
@@ -121,19 +127,40 @@ export class ClubAudio {
this._fx.indoorWet = this.ctx.createGain();
this._fx.indoorWet.gain.value = 0.0;
- // effectsBus → bass → lowpass → dry ──────────────────────────→ master
- // → outdoorConv → outdoorWet ──────→ master
- // → indoorConv → indoorWet ──────→ master
+ // ── 8D spatial orbit ──────────────────────────────────────────────────
+ // The entire club mix funnels into one HRTF panner that can slowly orbit
+ // the listener's head — the "8D audio" effect. rolloffFactor 0 means the
+ // orbit changes only the stereo image, never the loudness, so the bed
+ // never pumps as it circles. spin8D() walks the source around the circle
+ // once per frame; when 8D is off the source just sits straight ahead.
+ this.spatialIn = this.ctx.createGain();
+ this._panner = this.ctx.createPanner();
+ this._panner.panningModel = 'HRTF';
+ this._panner.distanceModel = 'inverse';
+ this._panner.refDistance = 1;
+ this._panner.maxDistance = 100;
+ this._panner.rolloffFactor = 0;
+ this._panner.coneInnerAngle = 360;
+ this._panner.coneOuterAngle = 0;
+ this._panner.coneOuterGain = 0;
+ this._placeListener();
+ this._setSpinPos(0, 0, -1); // straight ahead until/unless the orbit drives it
+ this.spatialIn.connect(this._panner);
+ this._panner.connect(this.master);
+
+ // effectsBus → bass → lowpass → dry ──────────────→ spatialIn → panner → master
+ // → outdoorConv → outdoorWet ──────→ spatialIn ↗
+ // → indoorConv → indoorWet ──────→ spatialIn ↗
this.effectsBus.connect(this._fx.bass);
this._fx.bass.connect(this._fx.lowpass);
this._fx.lowpass.connect(this._fx.dry);
this._fx.lowpass.connect(this._fx.outdoorConv);
this._fx.lowpass.connect(this._fx.indoorConv);
- this._fx.dry.connect(this.master);
+ this._fx.dry.connect(this.spatialIn);
this._fx.outdoorConv.connect(this._fx.outdoorWet);
- this._fx.outdoorWet.connect(this.master);
+ this._fx.outdoorWet.connect(this.spatialIn);
this._fx.indoorConv.connect(this._fx.indoorWet);
- this._fx.indoorWet.connect(this.master);
+ this._fx.indoorWet.connect(this.spatialIn);
if (this.ctx.state === 'suspended') {
try {
@@ -441,6 +468,78 @@ export class ClubAudio {
this.setClarity(isInside ? 1 : 0, 0.9);
}
+ // ── 8D spatial orbit ──────────────────────────────────────────────────────
+ // Seat the listener at the origin, facing -Z (into the screen). Modern
+ // browsers expose position/orientation as AudioParams; older Safari uses the
+ // deprecated setPosition/setOrientation setters — support both.
+ _placeListener() {
+ const L = this.ctx?.listener;
+ if (!L) return;
+ if (L.forwardX) {
+ L.positionX.value = 0; L.positionY.value = 0; L.positionZ.value = 0;
+ L.forwardX.value = 0; L.forwardY.value = 0; L.forwardZ.value = -1;
+ L.upX.value = 0; L.upY.value = 1; L.upZ.value = 0;
+ } else if (L.setPosition) {
+ L.setPosition(0, 0, 0);
+ L.setOrientation(0, 0, -1, 0, 1, 0);
+ }
+ }
+
+ // Move the orbiting source. Set .value directly (not scheduled) so per-frame
+ // updates don't pile up automation events; the per-frame delta is tiny at the
+ // orbit speeds we use, so there's no zipper noise.
+ _setSpinPos(x, y, z) {
+ const p = this._panner;
+ if (!p) return;
+ if (p.positionX) {
+ p.positionX.value = x;
+ p.positionY.value = y;
+ p.positionZ.value = z;
+ } else if (p.setPosition) {
+ p.setPosition(x, y, z);
+ }
+ }
+
+ // Enable/disable the orbit. Persists the choice; recentres the image to dead
+ // ahead when turned off so the mix doesn't freeze mid-circle off to one side.
+ set8D(on) {
+ this.spin.on = !!on;
+ this._write8DPref(this.spin.on);
+ if (!this.spin.on) this._setSpinPos(0, 0, -1);
+ return this.spin.on;
+ }
+
+ is8D() {
+ return !!this.spin.on;
+ }
+
+ // Walk the source around a horizontal circle about the listener's head. Call
+ // once per animation frame with the scene's elapsed seconds. Starts dead
+ // ahead (-Z) at t=0 and rotates; a no-op when 8D is off or before the graph
+ // exists, so the render loop can call it unconditionally.
+ spin8D(tSeconds) {
+ if (!this._panner || !this.spin.on) return;
+ const a = tSeconds * this.spin.speed * Math.PI * 2;
+ const r = this.spin.radius;
+ this._setSpinPos(Math.sin(a) * r, this.spin.height, -Math.cos(a) * r);
+ }
+
+ _read8DPref() {
+ try {
+ if (typeof localStorage === 'undefined') return false;
+ return localStorage.getItem('club.audio.spatial') === '1';
+ } catch {
+ return false;
+ }
+ }
+
+ _write8DPref(on) {
+ try {
+ if (typeof localStorage === 'undefined') return;
+ localStorage.setItem('club.audio.spatial', on ? '1' : '0');
+ } catch {}
+ }
+
// Ramp a single GainNode to `target`, gliding from its current value so the
// fade is click-free even mid-ramp.
_rampGain(gainNode, target, durationMs) {
diff --git a/src/club-entrance.js b/src/club-entrance.js
index 284d294f9..31d3ca80a 100644
--- a/src/club-entrance.js
+++ b/src/club-entrance.js
@@ -177,8 +177,10 @@ async function start(canvasEl) {
const camera = new PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.05, 200);
// ── Light rig — moody, works for the alley and the interior ──────────────
- scene.add(new AmbientLight(0x241433, 0.7));
- const hemi = new HemisphereLight(0xff6abf, 0x0a0512, 0.45);
+ // Keeps the noir palette but lifts the ambient/hemisphere floor so walls read
+ // as dim surfaces instead of pure black where no accent light reaches.
+ scene.add(new AmbientLight(0x241433, 0.95));
+ const hemi = new HemisphereLight(0xff6abf, 0x0a0512, 0.62);
hemi.position.set(0, ROOM_HEIGHT, 0);
scene.add(hemi);
const pink = new PointLight(0xff3bd6, 7, 26, 1.4);
@@ -187,10 +189,17 @@ async function start(canvasEl) {
const cyan = new PointLight(0x4ad6ff, 5, 24, 1.5);
cyan.position.set(3, 2.4, 2);
scene.add(cyan);
- // A soft key that tracks the avatar so it never falls into shadow.
- const key = new SpotLight(0xffe6c2, 10, 26, Math.PI / 5, 0.6, 1.2);
+ // A soft key that tracks the avatar so it never falls into shadow. Widened
+ // from a tight PI/5 so it washes the walls beside you, not just a floor strip.
+ const key = new SpotLight(0xffe6c2, 11, 28, Math.PI / 3.4, 0.7, 1.0);
key.position.set(0, 5, 0);
scene.add(key, key.target);
+ // Warm fill that rides along with the avatar so the immediate surroundings —
+ // the stretch of alley you're actually walking through — are always legible,
+ // however far the fixed accent lights are behind you.
+ const fill = new PointLight(0xffd9c2, 2.4, 12, 1.6);
+ fill.position.set(0, 2.4, 0);
+ scene.add(fill);
// ── Postprocessing — the same cinematic stack as the pole stage ──────────
// Bloom makes the neon door/sign actually glow, ACES gives filmic colour,
@@ -731,9 +740,10 @@ async function start(canvasEl) {
updateCamera(dt);
if (phase === 'walk') minimap.update(rig.position, rig.rotation.y, nearDoor, now / 1000, prefersReducedMotion);
- // Key light + proximity prompt follow the avatar in the alley.
+ // Key + fill follow the avatar so the patch of alley you're walking is lit.
key.position.set(rig.position.x, 5, rig.position.z + 1);
key.target.position.copy(rig.position).setY(1);
+ fill.position.set(rig.position.x, 2.4, rig.position.z);
if (phase === 'walk') {
const d = Math.hypot(rig.position.x - path.door.x, rig.position.z - path.door.z);
diff --git a/src/club.js b/src/club.js
index a54c31a92..5d2c44778 100644
--- a/src/club.js
+++ b/src/club.js
@@ -1555,6 +1555,28 @@ function bindMutePill() {
}
bindMutePill();
+// ── 8D pill in top bar ───────────────────────────────────────────────────
+// Toggles the HRTF orbit (src/club-audio.js → spin8D). The render loop drives
+// the orbit every frame; this just flips it on/off and persists the choice.
+function bindSpatialPill() {
+ const btn = document.getElementById('club-spatial-toggle');
+ if (!btn) return;
+ const render = () => {
+ const on = audio.is8D();
+ btn.textContent = on ? '🎧 8D on' : '🎧 8D off';
+ btn.setAttribute('aria-pressed', on ? 'true' : 'false');
+ };
+ render();
+ btn.addEventListener('click', async () => {
+ // Building the context wires the panner the orbit needs, so a first
+ // click both unlocks audio and arms the effect in one gesture.
+ try { await audio.ensureContext(); } catch {}
+ audio.set8D(!audio.is8D());
+ render();
+ });
+}
+bindSpatialPill();
+
// ── Free cam chip (shown while in VIP / house) ───────────────────────────
let freeCamChip = null;
function ensureFreeCamChip() {
@@ -2144,6 +2166,9 @@ function animate() {
// Beat level — drives both the bloom and the volumetric beams this frame.
const peak = audio.getPeak();
+ // 8D audio — orbit the whole mix around the listener's head when enabled.
+ audio.spin8D(t);
+
for (const station of stations) {
station.tick(dt);
diff --git a/tests/club-audio.test.js b/tests/club-audio.test.js
index 2df77bdc1..7dde0125a 100644
--- a/tests/club-audio.test.js
+++ b/tests/club-audio.test.js
@@ -140,6 +140,44 @@ class FakeConvolverNode {
}
}
+class FakePannerNode {
+ constructor() {
+ this.panningModel = '';
+ this.distanceModel = '';
+ this.refDistance = 1;
+ this.maxDistance = 10000;
+ this.rolloffFactor = 1;
+ this.coneInnerAngle = 360;
+ this.coneOuterAngle = 360;
+ this.coneOuterGain = 0;
+ this.positionX = new FakeAudioParam(0);
+ this.positionY = new FakeAudioParam(0);
+ this.positionZ = new FakeAudioParam(0);
+ this._connections = [];
+ }
+ connect(dest) {
+ this._connections.push(dest);
+ return dest;
+ }
+ disconnect() {
+ this._connections = [];
+ }
+}
+
+class FakeAudioListener {
+ constructor() {
+ this.positionX = new FakeAudioParam(0);
+ this.positionY = new FakeAudioParam(0);
+ this.positionZ = new FakeAudioParam(0);
+ this.forwardX = new FakeAudioParam(0);
+ this.forwardY = new FakeAudioParam(0);
+ this.forwardZ = new FakeAudioParam(-1);
+ this.upX = new FakeAudioParam(0);
+ this.upY = new FakeAudioParam(1);
+ this.upZ = new FakeAudioParam(0);
+ }
+}
+
class FakeMediaElementSource {
constructor(el) {
this.mediaElement = el;
@@ -199,7 +237,14 @@ class FakeAudioContext {
this.createdMediaSources = [];
this.createdFilters = [];
this.createdConvolvers = [];
+ this.createdPanners = [];
this.decodedBuffers = [];
+ this.listener = new FakeAudioListener();
+ }
+ createPanner() {
+ const p = new FakePannerNode();
+ this.createdPanners.push(p);
+ return p;
}
createGain() {
const g = new FakeGainNode();
@@ -594,6 +639,88 @@ describe('ClubAudio.setClarity', () => {
});
});
+describe('ClubAudio 8D spatial orbit', () => {
+ it('builds an HRTF panner the whole mix funnels through, parked dead ahead', async () => {
+ const audio = new ClubAudio();
+ await audio.ensureContext();
+ expect(audio.ctx.createdPanners).toHaveLength(1);
+ expect(audio._panner.panningModel).toBe('HRTF');
+ // rolloff 0 keeps loudness constant as the image orbits.
+ expect(audio._panner.rolloffFactor).toBe(0);
+ // Parked straight ahead (-Z) until the orbit drives it.
+ expect(audio._panner.positionX.value).toBeCloseTo(0, 6);
+ expect(audio._panner.positionZ.value).toBeCloseTo(-1, 6);
+ // Listener sits at the origin facing into the screen.
+ expect(audio.ctx.listener.forwardZ.value).toBeCloseTo(-1, 6);
+ // The dry + both reverb tails route into the panner, not straight to master.
+ expect(audio._fx.dry._connections).toContain(audio.spatialIn);
+ expect(audio._fx.outdoorWet._connections).toContain(audio.spatialIn);
+ expect(audio._fx.indoorWet._connections).toContain(audio.spatialIn);
+ expect(audio.spatialIn._connections).toContain(audio._panner);
+ expect(audio._panner._connections).toContain(audio.master);
+ });
+
+ it('is off by default and spin8D is a no-op until enabled', async () => {
+ const audio = new ClubAudio();
+ await audio.ensureContext();
+ expect(audio.is8D()).toBe(false);
+ audio.spin8D(3.2);
+ // Still parked dead ahead — nothing moved.
+ expect(audio._panner.positionX.value).toBeCloseTo(0, 6);
+ expect(audio._panner.positionZ.value).toBeCloseTo(-1, 6);
+ });
+
+ it('orbits the source around the head once enabled', async () => {
+ const audio = new ClubAudio();
+ await audio.ensureContext();
+ audio.set8D(true);
+ expect(audio.is8D()).toBe(true);
+
+ // t=0 → straight ahead (sin0=0, -cos0=-1).
+ audio.spin8D(0);
+ expect(audio._panner.positionX.value).toBeCloseTo(0, 6);
+ expect(audio._panner.positionZ.value).toBeCloseTo(-1, 6);
+
+ // A quarter lap (speed 0.125 rps → 2s) swings the source hard right (+X).
+ audio.spin8D(2);
+ expect(audio._panner.positionX.value).toBeCloseTo(1, 5);
+ expect(audio._panner.positionZ.value).toBeCloseTo(0, 5);
+
+ // Half a lap (4s) puts it directly behind (+Z).
+ audio.spin8D(4);
+ expect(audio._panner.positionZ.value).toBeCloseTo(1, 5);
+ });
+
+ it('recentres the image to dead ahead when turned off', async () => {
+ const audio = new ClubAudio();
+ await audio.ensureContext();
+ audio.set8D(true);
+ audio.spin8D(2); // swing it off to one side
+ expect(audio._panner.positionX.value).toBeCloseTo(1, 5);
+ audio.set8D(false);
+ expect(audio._panner.positionX.value).toBeCloseTo(0, 6);
+ expect(audio._panner.positionZ.value).toBeCloseTo(-1, 6);
+ });
+
+ it('persists the 8D preference and reads it on construction', async () => {
+ const audio = new ClubAudio();
+ await audio.ensureContext();
+ audio.set8D(true);
+ expect(globalThis.localStorage.getItem('club.audio.spatial')).toBe('1');
+
+ const reloaded = new ClubAudio();
+ expect(reloaded.is8D()).toBe(true);
+ });
+
+ it('no-ops cleanly before the context exists', () => {
+ const audio = new ClubAudio();
+ expect(() => audio.spin8D(1)).not.toThrow();
+ // set8D persists the flag even with no graph yet.
+ expect(audio.set8D(true)).toBe(true);
+ expect(audio.is8D()).toBe(true);
+ });
+});
+
describe('ClubAudio.getPeak', () => {
it('returns 0 before the context is created', () => {
const audio = new ClubAudio();
diff --git a/vercel.json b/vercel.json
index 42160763d..9d4199e39 100644
--- a/vercel.json
+++ b/vercel.json
@@ -194,7 +194,7 @@
"x-content-type-options": "nosniff",
"referrer-policy": "strict-origin-when-cross-origin",
"permissions-policy": "accelerometer=(), autoplay=(self), bluetooth=(), camera=(), display-capture=(), encrypted-media=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(self), serial=(), usb=(), xr-spatial-tracking=(self)",
- "content-security-policy": "base-uri 'self'; object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://esm.sh https://ajax.googleapis.com https://s3.tradingview.com https://platform.twitter.com https://3d-agent.vercel.app https://three.ws; worker-src 'self' blob:; frame-ancestors 'self' https://*.ibm.com; report-uri /api/client-errors"
+ "content-security-policy": "base-uri 'self'; object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://esm.sh https://ajax.googleapis.com https://s3.tradingview.com https://platform.twitter.com https://3d-agent.vercel.app https://three.ws; worker-src 'self' blob:; frame-ancestors 'self' https://ibm.com https://*.ibm.com; report-uri /api/client-errors"
},
"continue": true
},