Skip to content
ES — View this page in SpanishEN

N° 02.02 — Case

Open source

Public repo

Rev ff2c27c

Resonance

Paste song lyrics, then walk the world they evoke.

Type
Open source
Disciplines
  • IA AI integration
  • AW Web applications
Stack
TypeScript · React Three Fiber · Vite · zod · Vitest · Claude

Diagram of Resonance's pipeline: pasted text, normalization, WorldGenerator, World Spec and zod validation. A valid spec goes on to the WorldRenderer and the seeded scene, an invalid one is retried, and after three failures a minimal fallback spec takes over.
FIG. 01 — Plate generated by code from the case data

Summary

Resonance turns text you bring, such as song lyrics or a short passage, into a 3D world you explore in first person. There are no goals and no score: the reward is walking through a place that embodies the work, with fragments of the text built into the architecture itself.

The core idea is that the model composes rather than sculpts. The engine ships a fixed vocabulary of primitives, layouts, skies, particles, typography styles and audio beds. The model reads the text, pulls out its concrete images and emotional arc, and returns a World Spec: a JSON document that selects and tunes that vocabulary. Every catalog is a closed enum, so the output validates against zod and a bad answer gets caught instead of rendered. When validation fails, the generator retries with the error as feedback, and a minimal valid spec always exists, so you never get a blank screen.

The same spec always builds the same world, because layout comes from a seeded PRNG and Math.random is banned inside the engine. The frame budget lives in the schema too. There are three interchangeable generators: an offline heuristic one that's the default, a mock, and real Claude behind a server-side proxy, with cost, latency and tokens shown in a debug panel.

Accessibility is part of the MVP: adjustable field of view, a motion vignette, teleport movement and a reading menu with the full text, so you can take in the piece without moving through 3D at all. The README is plain about what's missing: the real Claude path is tested against simulated responses, and visual checks are done by hand in a browser.


01Problem

Ask a language model to emit raw geometry and you get output you can't render, validate or reproduce.


02Decision

The model composes from a closed vocabulary; it never generates geometry.

src/schema/worldSpec.ts, lines 186 to 193, commit dcc0522View on GitHub (external site)
  .strictObject({    version: z.union([z.literal(1), z.literal(2)]),    meta: MetaSchema,    environment: EnvironmentSchema,    playerStart: PlayerStartSchema,    zones: z.array(ZoneSchema).min(1).max(6), // perf cap: 6 zones  })  .superRefine((spec, ctx) => {
  1. Line 186 strictObject: any field the model makes up triggers a retry instead of slipping through.
  2. Line 191 The frame budget lives in the schema: 6 zones at most.


04Architecture

  1. 01 Pasted text
    • leads to 02 Normalize
  2. 02 Normalize
    • leads to 03 WorldGenerator: heuristic · mock · Claude
  3. 03 WorldGenerator: heuristic · mock · Claude
    • leads to 04 World Spec
  4. 04 World Spec
    • leads to 05 zod validation
  5. 05 zod validation
    • leads to 03 WorldGenerator: heuristic · mock · Claude · invalid: retry
    • leads to 06 Minimal fallback spec · three failures
    • leads to 07 WorldRenderer · valid
  6. 06 Minimal fallback spec
    • leads to 07 WorldRenderer
  7. 07 WorldRenderer
    • leads to 08 Seeded procedural scene
  8. 08 Seeded procedural scene
FIG. 02 — 8 nodes · 9 edges