# ⚡ AI WARP ENGINE — 6.4.38.21 ULTIMATE

> **Public-domain visual synthesizer, audio-reactive media playground, and live Canvas glitch suite.**  
> Created through collaborative work between [imortalimp.nl](https://imortalimp.nl) (River Lyle Reuveni), [Arena.ai](https://arena.ai), and artificial intelligence.

---

## Release highlights

1. **34 independently controllable glitch voices** — the original 17 voices remain intact, with 17 separate Glitch Revision 3 voices identified by the exact `GC#(3)` suffix.
2. **29 AI Warp modes** — liquid, prism, breathe, fold, aurora, vortex, cybergrid, hyperdrive, kaleidoscope, quantum, ripple, analog CRT, plus the 17 NewBlue-inspired modes.
2a. **🖥 Browser Display Capture (v6.4)** — `getDisplayMedia` lets you share a browser tab, application window, or full screen; shared frames feed `#localVideo` and the full Canvas pipeline. Optional shared audio and the independently enabled microphone both feed `masterAnalyser` for analysis only (no duplicated playback). YouTube's existing iframe/Canvas Warp Bus and synthetic audio-reactive modes remain available; screen sharing temporarily takes visual focus and restores the YouTube Canvas feed when stopped. Use `N` to toggle display capture, `M` to toggle the microphone, `Y` to load the featured YouTube playlist into the engine, and `E` to cycle the Audio Reactive Ear (`AUTO` / `AUDIO` / `CANVAS`).
2b. **YouTube Warp Bus** — the live YouTube feed (cross-origin iframe, unreadable by Canvas) is drawn directly onto the effects pipeline: every warp mode drives 3D transforms, clip-path tears and seamless spins on `#ytWarpShell`, and all 34 voices (core + `GC#(3)`) contribute to a cumulative CSS filter chain (hue cycles, invert, strobe, flash, neon chroma-split echoes, VHS jitter, data-band tears) on the real video picture, while self-drawing voices keep overlaying the stacked glitch canvas. Playback body classes (`playback-on`, `local-video`, `youtube-feed`) are now actually toggled, activating the R3 factories' live-feed branches. **v6.3.1 adds the SVG Warp Lens**: the shell is additionally rasterized through an inline `feTurbulence → feDisplacementMap` graph (`#ytSvgWarp`) for true per-pixel melting/tearing/liquefaction of the live video — compositor-level and display-only (pixels are never read back into JS), per-mode noise character, voice-boosted amplitude, toggled with `aiWarp.setSvgWarpActive()`.
3. **Ghost Protocol R3/v11** — DIA, SPECTRUM, CRT, PLASMA, and LED modes with channel splits, Old-Soul echo, scan/warp behavior, CRT/LED texture, and color/DIA confluence.
4. **V-Sync R3/v11** — Scanphasing, Color Harmony, and Sharp modes with scan bands, tracking tears, roll, phosphor texture, per-mode levels, V-Sync locking, and retained OFF rails.
5. **R3 automation confluence** — Auto Glitch, Continual Randomization, Timed Automation, Automated Masters, Soft-Eye/Crescendo, and visual/audio-ear signals can drive Ghost/V-Sync targets and synchronized light bursts.
5a. **Mode-aware FX blending** — each AI Warp mode deterministically tunes Ghost/V-Sync color, split, scan, warp, and automation pacing; the original master levels and protected voice intent remain respected.
5b. **DROP THE MILK? subtle blends (v6.4.19)** — softer Milkdrop feedback, waves and blooms, with lower preset opacity while retaining analyser reactivity, all 80 shuffled presets, AI Warp/voice blending and the persistent opacity lock.
5c. **YT LENS playlist playback (v6.4.19)** — playlist-only suggestions route through the standalone lens and its audio-aware capture; starting another source closes the lens and stops playback.
6. **Canvas/WebGL effects core** — all voice rendering stays on Canvas/WebGL. The single sanctioned SVG usage (v6.3.1) is the compositor-level Warp Lens (`feTurbulence → feDisplacementMap`) on the YouTube shell only — still no JS pixel readback, no SVG DOM mutation beyond the two animated displacement attributes, and no SVG filters in the canvas pipeline.
7. **Media studio** — local image/video/audio support, YouTube controls and knowledgebase, microphone monitoring, and procedural synthetic audio.
8. **Performance controls** — held Ghost/V-Sync rails, direct null controls, locks, 80 randomized machine presets, user presets, live mixer levels, and keyboard shortcuts.
9. **Protected voice intent** — user-disabled or locked voices are respected by background automation.
10. **B&W/Hue confluence tuning** — bottom-dock sliders fine-tune inversion strength and hue offset, each with a persistent lock and randomized roll; core/GC#(3) voices remain distinct and are selected as complementary pairs.
11. **Public domain release** — distributed under CC0 1.0 / The Unlicense.

In v6.4.22, board randomization and each preset auto-cycle reroll unlocked B&W/Hue settings and independently roll Auto Glitch ON/OFF at 50/50 odds. The **ROLL FX** button rerolls only the two FX settings.

In v6.4.23, the featured YouTube playlist is pinned in the knowledgebase as a protected built-in entry. Saved playlists display as playable cards even if feed extraction fails; extraction parses Atom/XML by namespace and coalesces duplicate requests. Public feed access may expose only a recent subset, so **PLAY** opens the playlist directly for full browsing.

In v6.4.24, the bottom-dock B&W and Hue controls activate their paired core and GC#(3) voices so tuning changes are visible on the Canvas, with live monochrome/spectrum previews. Playing a saved playlist or importing playlist records starts background feed extraction automatically.

Release 6.4.27 makes locks hard and the screenshot true: voice locks and new Speed, Opacity, Ghost and V-Sync locks in the bottom controls are enforced every frame against Automated Masters, Continual Randomization, Timed Auto and presets; Freeze Frame (S) saves the full LENS canvas as an opaque PNG without the HUD or app frame, and the canvas no longer shrinks when zooming out (YouTube iframe pixels cannot be read by browsers - use local media, YT LENS or tab capture); Neon Gradient (core and GC#(3)) is a much stronger rotating ribbon with bloom and wash; GC#(3) ASCII streams a continual luminance-mapped character sheet; Twirl is slower and smoother. In v6.4.26, the adjustable B&W inversion and Hue/Color Cycle run as the final page-level compositor, covering the whole browser/app viewport: the rendered canvas, captured LENS frames, initialization artwork, Raum X-R showcase, easter eggs, HUD, controls, dialogs and overlays. Hard Light remains scoped to the effects canvas, and freeze-frame screenshots preserve the full-page filter. The Windows WebView2 host shares these app files; native window chrome remains outside the web viewport. The browser YouTube Warp Bus retains its full monochrome inversion. The `ai_warp_engine/` folder is the browser edition and shares its HTML, JavaScript, CSS, JSON and audio assets with the standalone app; the desktop-only YT LENS window requires the Windows app.

---

## Launch

Open any of these identical application aliases in a modern browser:

- `index.html`
- `ai_warp_engine.html`
- `media_page.html`

The application loads local scripts in this dependency order:

1. `three.min.js` (bundled Three.js; keep `THREE-LICENSE.txt`)
2. `glitch_engine.js`
3. `r3_gc3_factories.js`
4. `r3_ghost_vsync.js`
5. `ai_warp_engine.js`
6. `local_media.js`
7. `freeze_frame.js`
8. `media_page.js`

Version 6.4.38.21 loads `freeze_frame.js` immediately before
`media_page.js`. Freeze Frame includes the engine canvas, fullscreen CRT/vignette
and page FX, and never the HUD: Windows captures the HUD-free compositor output
(the HUD is masked, including descendants and in-flight transitions); browser
YouTube needs screen/tab capture. See [browser details](DESCRIPTION.md).

### Upload to imortalimp.nl

Upload the complete `ai_warp_engine` folder beside the website's updated
`home.html` and `index.html`; keep all ten files under `audio`. Open
`https://imortalimp.nl/ai_warp_engine/index.html` over HTTPS. The folder contains
all runtime scripts, configuration, CSS, bundled media, and the Three.js license.
No Node.js or Windows executable is needed on the web server.

The current release asset `AI-WARP-ENGINE-6.4.38.21-browser.zip` contains only
`ai_warp_engine/`, including its app `index.html`. It excludes the website-root
`home.html` and `index.html`, the old ZIP, legacy `web` bundle and native shell.
Extract it into the website root alongside your existing website pages.

The current `AI-WARP-ENGINE-6.4.38.21-web-upload.zip` contains the updated root
`home.html` and `index.html` plus the complete `ai_warp_engine/` browser folder,
including the crisp gold favicon. Extract it into the
imortalimp.nl document root, keeping the folder layout. Back up existing root
pages first; this is an update bundle, not a full-site backup. It contains no
Windows executables. Windows-only conversion still requires the native
app; browser playback uses browser-supported codecs. No server deployment is
performed automatically.

The earlier local `AI-WARP-ENGINE-6.4.37.1-web-upload.zip` is a website **update** bundle:
its top level contains `home.html`, `index.html` and `ai_warp_engine/`.
Extract these into the existing website root, replacing matching files and
preserving the site's other assets. It excludes the obsolete 6.4 ZIP, the legacy
`web` bundle and native shell files. It is not a backup of the entire website.

The three app aliases show `6.4.38.21 ULTIMATE`.
Local video and audio use the same continuous FX path as captured frames.
Browser codec limitations still apply: unsupported AVI must be converted locally
to H.264/AAC MP4 (or AAC M4A for audio); automatic Windows conversion uses only
installed OS codecs. Not every AVI codec is supported, and missing codecs produce
explicit errors. WebView2 and Windows media components are required on Windows;
no codec pack is bundled.
Browser YouTube is an isolated iframe; use tab/screen capture for readable pixels.
HTTPS and browser permission approval are required for capture/microphone.

Main-app scripts load only from this folder, with a local-only script CSP.
External-browser and new-window links are disabled inside the app; website
launch links stay in the current tab. Keep any hosting CSP compatible with
same-origin scripts, media/blob URLs, data images used for screenshot-layer
rasterization and the YouTube embed. Native Windows
navigation/debugging protections do not apply to a normal browser.

Upload runtime assets before the three entry HTML files so their cache-revision
URLs never point to missing scripts. The old `ai_warp_engine_r3_canvas_v6.4.zip`
is a historical archive, not the current upload bundle. Version 6.4.38.21 is the
current edition; older website pages/downloads may still
identify the prior release. Use the version-specific release assets.

A local HTTP server is recommended instead of `file://` when using YouTube, media loading, or browser APIs. For example:

```bash
python3 -m http.server 8000
```

Then open `http://localhost:8000/media_page.html`.

### Startup/playback regression fix (6.4.36)

The three app aliases must each contain exactly one app document and one ordered
engine stack. A 6.4.35 packaging regression concatenated the app, showcase and
LENS documents, creating duplicate controls and competing render loops that hid
the initialization grid/rings and prevented effects from responding normally.
The showcase is again an independent fragment, and `yt_lens.html` is again only
the validated YouTube player.

Startup is single-instance, configuration loading has a five-second timeout with
an explicit fallback warning, and missing dependencies or duplicated media mounts
produce a visible startup error. Optional remote scripts no longer block engine
startup. Render errors are visible, voice passes restore their canvas state, and
transient failures cannot stop the animation loop. The Windows system-cursor and
theme/pointer download guards remain enabled for both views.
The title-adjacent HUD change notice and installer/app version now agree on
`6.4.38.21 ULTIMATE`.

Run the dependency-free regression checks from the repository root:

```powershell
node --test tests\regressions.test.cjs
node --test tests\effects-6436.test.cjs tests\freeze-frame.test.cjs
```

`effects-6436.test.cjs` proves the 6.4.36 effect registry and bank hashes, the
Tech Artist/canvas alignment and the WebGL back-off; `freeze-frame.test.cjs`
proves the HUD mask logic.

---

## Core controls

### Glitch voice mixer

The mixer contains **34 reachable rails**:

- **17 Core voices:** Neon Grad, Scanlines, Data Bands, Flash, HSL Rainbow, ASCII, Font Burn, Strobe, Gemini Bomb, Tech Artist, VHS Glitch, Data Bomb, Ink Glyphs, Matrix ASCII, Matrix Chord, B&W Invert, and Hue/Color Cycle.
- **17 R3 voices:** the same names with the exact suffix ` GC#(3)`.

The GC#(3) factory block is isolated from the original voice bank so it cannot overwrite the existing 17 rails. Dynamic presets deliberately cover every R3 factory, while legacy 17-voice presets gain restrained R3 companion levels at apply time unless an explicit `GC#(3)` value is already saved. The mixer viewport measures its surrounding rails so its final entries remain reachable above the automation dock.

### Ghost Protocol R3/v11

Use the **GHOST** button to cycle:

`OFF → DIA → SPECTRUM → CRT → PLASMA → LED → OFF`

- The Ghost level slider is a manual rail and temporarily protects the selected level from automation.
- Cycling to OFF bypasses the effect while retaining its level for fast re-entry.
- The dedicated Ghost Null control clears the level and mode completely.

### V-Sync R3/v11

Use the **V-SYNC** button to cycle:

`OFF → SCANPHASING → COLOR HARMONY → SHARP → OFF`

Internally these correspond to `ON`, `GHOST_OFF`, and `FULL` R3 methods.

- Each active V-Sync method retains its own level/target script.
- OFF is a bypass and preserves the most recent live V-Sync rail.
- The lock prevents automated or manual mode changes until unlocked.
- The dedicated V-Sync Null control clears the retained rail.

### Automation and R3 confluence

| Control | R3 system behavior |
|---|---|
| **Auto Glitch** | Schedules paired core + `GC#(3)` voice sparks and synchronized Ghost/V-Sync light bursts. |
| **Continual Rand** | Rotates a tracked core + `GC#(3)` factory pair, gently modulates unlocked active rails, and drifts active Ghost targets without retiring manual selections. |
| **Timed Auto** | Selects cadence-synchronized core/R3 factory pairs and adds color/DIA burst events. |
| **Auto Masters** | Retargets unlocked Ghost/V-Sync rails and a complementary core/R3 accent pair with the master board. |
| **Soft-Eye** | Drives the R3 crescendo state machine, visual/audio ear, and burst gate. |
| **Crescendo** | Triggers a high-impact Ghost/V-Sync burst plus temporary Flash/Strobe flares in both voice banks. |
| **DROP THE MILK?** | Layers audio-reactive Canvas feedback and polar waveforms; cycles 80 shuffled presets whose opacity can be automated or locked by the user. |
| **Presets** | Store and restore Ghost mode/level and V-Sync mode-specific rail levels. |

---

## Keyboard shortcuts

| Shortcut | Action |
|---|---|
| `Space` | Play/pause the active media source or synthetic audio |
| `W` | Cycle AI Warp mode |
| `G` | Cycle Ghost Protocol mode |
| `V` | Cycle V-Sync method |
| `A` | Toggle Auto Glitch |
| `R` | Randomize the effects board |
| `T` | Cycle Timed Automation cadence |
| `C` | Trigger Crescendo |
| `D` | Toggle DROP THE MILK? feedback FX |
| `Z` | EMP Purge / zero all voices and R3 rails |
| `M` | Toggle microphone monitor |
| `H` | Toggle fullscreen HUD state |
| `S` | Export a frozen PNG frame |
| `1`–`9` | Toggle the corresponding first nine mixer rails |
| `?` | Open/close the shortcuts dialog |

---

## Files

| File | Purpose |
|---|---|
| `index.html` | Primary application alias |
| `ai_warp_engine.html` | Application alias |
| `media_page.html` | Application alias |
| `ai_warp_engine.js` | Main Canvas/WebGL visual engine, 34-voice mixer, warp modes, and automation bridge |
| `r3_gc3_factories.js` | Isolated Glitch Revision 3 factory bank for the 17 `GC#(3)` voices |
| `r3_ghost_vsync.js` | Canvas-only Ghost Protocol R3/v11 and V-Sync R3/v11 adapter |
| `glitch_engine.js` | Shared profiles, preset helpers, Soft-Eye/Crescendo, burst gate, and ear utilities |
| `media_page.js` | UI, media, audio, mixer, controls, presets, and hotkeys |
| `media_page.css` | Responsive cyberpunk HUD styling |
| `media_page.json` | Track, profile, and machine-preset data |
| `REVISION_NOTES.md` | Concise revision and verification notes |

---

## Implementation note: Canvas-only R3 system

The GC#(3) voice factories retain their copied Revision 3 factory block. Ghost Protocol and V-Sync were integrated as a Canvas-only R3 adapter because the source page’s former SVG-filter path is intentionally excluded from this release. The adapter uses ordinary Canvas compositing, Canvas 2D filter primitives, snapshots, gradients, scan slices, and offscreen canvases — never an SVG filter URL or SVG filter element.

---

## License and attribution

This software is dedicated to the **Public Domain** under the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/) and [The Unlicense](https://unlicense.org/).

You may copy, modify, publish, use, compile, sell, or distribute it for any purpose, with or without attribution.

- **Project genesis & architecture:** River Lyle Reuveni / [imortalimp.nl](https://imortalimp.nl)
- **Agent engineering & synthesis:** [Arena.ai](https://arena.ai) Agent Mode
- **Collaborative foundation:** Generative AI and the open-source community
