From a723f465e26834118cabca362dcbce8d5e577643 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 10 Sep 2026 10:52:36 -0700 Subject: [PATCH] Checkpoint ambient display, generative experience, and MIDI work --- README.md | 56 +- agents.md | 84 +- audio_gaps.md | 182 - core_animation_improvement.md | 41 - css/style.css | 4805 ++-- dist/SciFiAmbientDisplay_V977d348.html | 21695 ++++++++++++++++ dist/index.html | 18483 +++++++++++++ ...BT_SingleHTML_Generative_MIDI_TV_v3.7.html | 19921 ++++++++++++++ index.html | 105 +- js/app.js | 271 +- js/audio.js | 615 +- js/config.js | 2341 +- js/generative-experience.js | 1371 + js/midi.js | 170 + js/observation-bezels.js | 540 +- js/observation-engine.js | 6372 +++-- tools/package.ps1 | 188 +- 17 files changed, 70223 insertions(+), 7017 deletions(-) delete mode 100644 audio_gaps.md delete mode 100644 core_animation_improvement.md create mode 100644 dist/SciFiAmbientDisplay_V977d348.html create mode 100644 dist/index.html create mode 100644 improvements/XZBT_SingleHTML_Generative_MIDI_TV_v3.7.html create mode 100644 js/generative-experience.js create mode 100644 js/midi.js diff --git a/README.md b/README.md index d1754ba..0dd4c5e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # SciFi Ambient Display -A browser-based sci-fi ambience generator. It layers procedurally synthesized starship drones, warp/worp core pulses, life-support hiss, and background telemetry chirps into a continuous soundscape, paired with a matching on-screen console and an optional full-screen "observation deck" visualizer. Good for background noise while working, relaxing, or falling asleep. +A browser-based sci-fi ambience generator. It layers procedurally synthesized starship drones, warp/worp core pulses, life-support hiss, and background telemetry chirps into a continuous soundscape, paired with a matching on-screen console and an optional full-screen "observation deck" visualizer, with optional local AI announcements and MIDI control. Good for background noise while working, relaxing, or falling asleep. ## Getting Started -The simplest way to use it: open `dist/SciFiAmbientDisplay_v4.html` in any modern browser (double-click it — no install, no server, no internet connection required). It's a single self-contained file with everything bundled in. +The simplest way to use it: open the newest `dist/SciFiAmbientDisplay_V*.html` in any modern browser (double-click it — no install, no server, no internet connection required). It's a single self-contained file with everything bundled in. If you'd rather run it from the source files instead, open `index.html` the same way, or serve the folder with any static file server. @@ -38,13 +38,41 @@ The mixer has four independent channels, each with its own volume: Mute everything instantly with the header mute button, or use the master volume control. The soundboard (bottom right) adds one-off sound effects specific to the current universe — chimes, alerts, door sounds, and the like — layered on top of the ambient mix. +## Futuristic Noice Cancellation + +FNC is a comfort filter for the three continuous beds. It's on by default, and the FNC LEVEL slider decides how hard it pulls them down: + +| Channel | Reduction across the slider's range | +| --- | --- | +| Life Support | 50% → 100% | +| Hull Drone | 10% → 70% | +| Worp Core | 5% → 50% | + +The point is to keep the room tone present without letting it sit on top of whatever else you're listening to. FNC steps aside on its own during alerts, universe events, and soundboard hits, then eases back in — the readout tells you which state it's in. Turn it off entirely with the FNC ENABLED button and the channels play at their raw mixer levels. + +## Generative Experience (optional) + +The GENERATIVE EXPERIENCE panel adds spoken ship's-computer announcements written in the voice of the current universe — clinical and precise on a Starflight bridge, eccentric and put-upon on a Whataverse console. Press PREPARE AI to download the local language model and neural voice; both then run entirely in your browser, and the browser caches them for later sessions. + +This is the one part of the app that needs the internet, and only on that first preparation. It also needs a WebGPU-capable browser (current Chrome or Edge). Without either, the panel reports it and everything else works exactly as before. + +Turn AUTO UPDATES off if you'd rather trigger announcements yourself, SPEAK off for text without voice, and use VOICE AUTOMATION to dial in how synthetic the voice sounds — each universe has its own default. + +## MIDI Control + +If you have a MIDI controller, press ENABLE MIDI and the browser will ask for access. Pick a target from the dropdown, press MIDI LEARN, then move the knob, fader or pad you want bound to it. Volume, every channel parameter, FNC level, activity, and the transport and alert buttons are all mappable. Bindings are saved in the browser and survive a reload; CLEAR MAP wipes them. + +## TV Presentation + +The TV PRESENTATION panel locks the Watch Experience to a 16:9 frame with black bars, so the scene looks the same whether it's on a phone, a monitor, or a cast display — useful when sending it to a TV via Chrome. RENDER DENSITY trades detail against performance from 720p up to 2160p; drop it if the animation stutters on a weaker machine. + ## Sleep Timer Set the ambience to automatically fade out and stop after 15, 30, or 60 minutes — handy for falling asleep to. Choose "OFF" to run continuously. -## Observation Mode +## Watch Experience -Click the observation button to switch to a full-screen, passive display: a slow-moving starfield/warp view framed by the current ship's viewport, with an activity slider to control how much visual motion happens. It's designed to be left running on a second monitor or TV as ambient scenery, or projected in a room. Click the background (or press Escape) to return to the controls. +Click WATCH EXPERIENCE to switch to a full-screen, passive display: a slow-moving starfield/warp view framed by the current ship's viewport, with an activity slider to control how much visual motion happens. Each universe draws its own waveform readout down there too — subspace harmonics on a Starflight bridge, a drive vibration scope on an industrial tug, tactical carrier blocks on a military deck. It's designed to be left running on a second monitor or TV as ambient scenery, or projected in a room. Click the background (or press Escape) to return to the controls. ## Keyboard Shortcuts @@ -58,9 +86,9 @@ Click the observation button to switch to a full-screen, passive display: a slow | 0 | Set volume to 100% | | W | Trigger the universe's primary event (e.g. warp jump) | | R | Trigger an alert | -| F | Toggle the observation viewport frame (in Observation Mode) | -| P | Toggle support pillars (in Observation Mode) | -| Esc | Exit Observation Mode / stop active alerts | +| F | Toggle the viewport frame (in the Watch Experience) | +| P | Toggle support pillars (in the Watch Experience) | +| Esc | Exit the Watch Experience / stop active alerts | --- @@ -77,12 +105,15 @@ SciFi-XZBT/ ├── js/ │ ├── audio.js # Web Audio synthesis, oscillators, sound engines │ ├── config.js # Vessel presets, universe registry & palettes +│ ├── core-animations.js # Settings-panel core animations │ ├── visualizer.js # Audio spectrum & Worp Core canvas rendering │ ├── observation-bezels.js # Procedural SVG viewport bezels -│ ├── observation-engine.js # Observation mode canvas and simulation engine +│ ├── observation-engine.js # Watch Experience canvas and simulation engine +│ ├── midi.js # Control bus & Web MIDI / MIDI-learn controller +│ ├── generative-experience.js # Optional local LLM narration & neural speech │ └── app.js # DOM bindings, hotkeys, UI controllers & main loop ├── dist/ -│ └── SciFiAmbientDisplay_v4.html # Standalone, single-file offline build +│ └── SciFiAmbientDisplay_V.html # Standalone, single-file offline build └── tools/ ├── package.ps1 # 1-click script to build the standalone single-file HTML └── extract.ps1 # Original extraction script for reference @@ -93,8 +124,11 @@ SciFi-XZBT/ - Edit the specific CSS or JS files directly. - Audio/synthesizer logic lives in `js/audio.js`. - Viewscreen bezels and framing are in `js/observation-bezels.js`. -- Observation-mode canvases and simulation are in `js/observation-engine.js`. +- Watch Experience canvases and simulation are in `js/observation-engine.js`. - Presets and the sound matrix live in `js/config.js`. +- FNC lives in `js/audio.js`; MIDI and the control bus in `js/midi.js`. +- `js/generative-experience.js` is the only file that touches the network, and only + when the operator prepares it. See `agents.md` for the bounds on that exception. ### Repackaging to a single file @@ -102,6 +136,6 @@ SciFi-XZBT/ powershell -ExecutionPolicy Bypass -File .\tools\package.ps1 ``` -This produces `dist\SciFiAmbientDisplay_v4.html`, combining all CSS and JS back into a self-contained, double-clickable offline file. +This produces `dist\SciFiAmbientDisplay_V.html`, combining all CSS and JS back into a self-contained, double-clickable offline file. It requires git, since the commit hash is what labels the build. diff --git a/agents.md b/agents.md index 2447859..2716e2f 100644 --- a/agents.md +++ b/agents.md @@ -14,12 +14,13 @@ package manager, no server, and no test suite.** ## Architecture -`index.html` loads one stylesheet and six scripts **in a fixed order**: +`index.html` loads one stylesheet and eight scripts **in a fixed order**: ``` css/style.css -js/audio.js -> js/config.js -> js/visualizer.js -js/observation-bezels.js -> js/observation-engine.js -> js/app.js +js/audio.js -> js/config.js -> js/core-animations.js -> js/visualizer.js +js/observation-bezels.js -> js/observation-engine.js +js/midi.js -> js/generative-experience.js -> js/app.js ``` Order matters: every file defines plain classes/objects and publishes them on @@ -28,16 +29,19 @@ tags without checking the dependencies. | File | Owns | ~Lines | | --- | --- | --- | -| `index.html` | DOM skeleton, script/link tags | 370 | -| `css/style.css` | LCARD themes, CRT effects, palettes | 2,300 | -| `js/audio.js` | `AudioManager` + all synth classes (hull, warp, life support, telemetry, alert, Whataverse, expanded sci-fi) | 2,250 | -| `js/config.js` | `StarshipPresets`, `UniverseRegistry` — data only, no behavior | 1,040 | -| `js/visualizer.js` | `StarshipVisualizer` — spectrum + worp core canvas | 640 | +| `index.html` | DOM skeleton, script/link tags | 460 | +| `css/style.css` | LCARD themes, CRT effects, palettes | 2,430 | +| `js/audio.js` | `AudioManager`, `FuturisticNoiceCancellation` + all synth classes (hull, warp, life support, telemetry, alert, Whataverse, expanded sci-fi) | 6,890 | +| `js/config.js` | `StarshipPresets`, `UniverseRegistry` — data only, no behavior | 1,170 | +| `js/core-animations.js` | `CoreAnimations` — settings-panel core animations | 220 | +| `js/visualizer.js` | `StarshipVisualizer` — spectrum + worp core canvas | 670 | | `js/observation-bezels.js` | `ObservationBezels` — procedural SVG viewport frames per era | 270 | -| `js/observation-engine.js` | `ObservationEngine` — celestial simulation and canvas rendering | 2,780 | -| `js/app.js` | DOM bindings, hotkeys, UI controllers, main loop | 3,960 | +| `js/observation-engine.js` | `ObservationEngine` — celestial simulation, canvas rendering, per-universe waveform | 3,590 | +| `js/midi.js` | `XZBTControlBus` (semantic control registry) + `XZBTMidiController` (Web MIDI / MIDI learn) | 170 | +| `js/generative-experience.js` | `XZBTGenerativeExperience` — optional local LLM narration and neural speech | 1,370 | +| `js/app.js` | DOM bindings, hotkeys, UI controllers, main loop | 4,440 | | `tools/package.ps1` | Builds the standalone single-file HTML | — | -| `dist/SciFiAmbientDisplay_v4.html` | **Generated output — never edit by hand** | — | +| `dist/SciFiAmbientDisplay_V.html` | **Generated output — never edit by hand** | — | ## Hard constraints @@ -45,6 +49,32 @@ tags without checking the dependencies. audio files. The packaged build must work when double-clicked while offline. - **No ES modules.** No `import` / `export`, no `type="module"`. Scripts are classic globals. + +### The one documented exception + +`js/generative-experience.js` is the **only** file permitted to reach the +network, and it is the only file permitted to use `import`. It lazily pulls +WebLLM and Kokoro via dynamic `import()` from CDN: + +```js +this.webllm = this.webllm || await import('https://esm.run/@mlc-ai/web-llm'); +this.kokoroModule = this.kokoroModule || await import('https://esm.sh/kokoro-js@1.2.1?bundle'); +``` + +The exception is bounded, and every bound is load-bearing: + +- The imports live **inside** `prepareExperience()` / `prepareTTS()`. Nothing is + fetched at parse time, so the packaged single-file build still opens and runs + fully offline — the Generative Experience panel simply stays on STANDBY. +- Both are guarded: `navigator.gpu` is checked before the WebLLM import, and a + failed Kokoro load falls back rather than throwing. +- No other subsystem may depend on this one. The deterministic engine stays + authoritative; the LLM only verbalizes world state that audio.js and app.js + already decided. + +Do not widen this exception. New network use anywhere else, a static +` + + + + + + + + + + diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..da7bf6c --- /dev/null +++ b/dist/index.html @@ -0,0 +1,18483 @@ + + + + + + + Sci-Fi Ambience Generator - Publish Build v13co + + + + + +
+
+
+ STARFLIGHT +
+
+ +
+
+ +
+ USS INTERPRISE-G // MAIN BRIDGE +
+ + 75% +
+ STARFLIGHT SOUND MATRIX v2.5 +
+
+
+ + +
+ + + + + +
+ + +
+
+
+
INTERPRISE-G: MAIN BRIDGE
+
Warm, low-frequency 50Hz hull tone with gentle ventilation and soft LCARD computer chirps.
+
+
+
+ AUDIO ENGINE + STANDBY +
+
+ CORE FREQ + 58.0 Hz +
+
+
+ + +
+ + +
+ +
+ + + +
+ ACTIVITY + + 60% +
+ +
+ + +
+
+
+ MAIN MASTER VOLUME + 75% + -2.5 dB +
+
+ +
+ + + + +
+
+
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ + +
+
+ ACOUSTIC FREQUENCY SPECTRUM + PROCEDURAL HARMONIC ANALYSIS +
+
+
SPECTRUM BIN: 32 CH // REAL-TIME FFT
+ +
+
+ + +
+
+ PROCEDURAL SOUND ENGINE MIXER + LIVE PARAMETER MODULATION +
+ +
+ +
+
+ 1. HULL DRONE + 65% +
+
+
LEVEL
+ +
+
+
BASE TONE50 Hz
+ +
+
+
DAMPING CUTOFF105 Hz
+ +
+
+ + +
+
+ 2. WORP CORE + 35% +
+
+
LEVEL
+ +
+
+
PULSE RATE (BPM)48 BPM
+ +
+
+
REACTOR PITCH58 Hz
+ +
+
+ + +
+
+ 3. LIFE SUPPORT + 55% +
+
+
LEVEL
+ +
+
+
AIRFLOW AIR FILTER1600 Hz
+ +
+
+ + +
+
+ 4. TELEMETRY + 45% +
+
+
LEVEL
+ +
+
+
BACKGROUND CHIRP DENSITY65%
+ +
+
+
+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + diff --git a/improvements/XZBT_SingleHTML_Generative_MIDI_TV_v3.7.html b/improvements/XZBT_SingleHTML_Generative_MIDI_TV_v3.7.html new file mode 100644 index 0000000..a8ef415 --- /dev/null +++ b/improvements/XZBT_SingleHTML_Generative_MIDI_TV_v3.7.html @@ -0,0 +1,19921 @@ + + + + + + + XZBT Generative Experience v3.7 - Deterministic FNC Comfort Filter, Local AI, Kokoro, MIDI, TV Mode + + + + + + +
+
+
+ STARFLIGHT +
+
+ +
+
+ +
+ USS INTERPRISE-G // MAIN BRIDGE +
+ + 75% +
+ STARFLIGHT SOUND MATRIX v2.9 +
+
+
+ + +
+ + + + + +
+ + +
+
+
+
INTERPRISE-G: MAIN BRIDGE
+
Warm, low-frequency 50Hz hull tone with gentle ventilation and soft LCARD computer chirps.
+
+
+
+ AUDIO ENGINE + STANDBY +
+
+ CORE FREQ + 58.0 Hz +
+
+
+ + +
+ + +
+ +
+
+ +
Full-screen procedural visuals, soundscape, telemetry, events, and optional local AI announcements.
+
+ + +
+ ACTIVITY + + 60% +
+ +
+ + +
+
+
+ MAIN MASTER VOLUME + 75% + -2.5 dB +
+
+ +
+ + + + +
+
+
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+ FNC // FUTURISTIC NOICE CANCELLATION + MONITORING +
+ +
+
+ FNC LEVEL + + 65% +
+
Comfort suppression active — Life Support, Hull Drone, and Worp Core are reduced according to FNC level.
+
+
+
+ + +
+
+ ACOUSTIC FREQUENCY SPECTRUM + PROCEDURAL HARMONIC ANALYSIS +
+
+
SPECTRUM BIN: 32 CH // REAL-TIME FFT
+ +
+
+ + +
+
+ PROCEDURAL SOUND ENGINE MIXER + LIVE PARAMETER MODULATION +
+ +
+ +
+
+ 1. HULL DRONE + 65% +
+
+
LEVEL
+ +
+
+
BASE TONE50 Hz
+ +
+
+
DAMPING CUTOFF105 Hz
+ +
+
+ + +
+
+ 2. WORP CORE + 35% +
+
+
LEVEL
+ +
+
+
PULSE RATE (BPM)48 BPM
+ +
+
+
REACTOR PITCH58 Hz
+ +
+
+ + +
+
+ 3. LIFE SUPPORT + 55% +
+
+
LEVEL
+ +
+
+
AIRFLOW AIR FILTER1600 Hz
+ +
+
+ + +
+
+ 4. TELEMETRY + 45% +
+
+
LEVEL
+ +
+
+
BACKGROUND CHIRP DENSITY65%
+ +
+
+
+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + diff --git a/index.html b/index.html index 94b7f21..20a29e1 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,7 @@ - Sci-Fi Ambience Generator - Publish Build v13co + Sci-Fi Ambience Generator - Publish Build v14co @@ -37,7 +37,7 @@ 75% - STARFLIGHT SOUND MATRIX v2.5 + STARFLIGHT SOUND MATRIX v2.9
@@ -84,9 +84,10 @@
- +
+ +
Full-screen procedural visuals, soundscape, telemetry, events, and optional local AI announcements.
+