Skip to content

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

POWERNAP

A dream in 65,536 bytes — a 64k intro for Apple Silicon Macs that raids the machine it runs on: your processes, your wallpaper, your fan, your name.

POWERNAP kaleidoscope scene: an infinite KIFS fractal lattice built from macOS windows, pulsing with the music

One executable file, 47,788 bytes, no data files, no runtime dependencies. It boots a Metal renderer and a softsynth, dreams for just under three and a half minutes at 128 BPM, and wakes up by logging into your Mac — with your actual username, on the beat — before dissolving into your real desktop and quitting onto it.


What's inside

  • The dither is a field, not a filter — every pixel carries a dreamDepth value through the HDR pipeline; where it falls to zero, the composite renders ordered-dither 1-bit. The dream doesn't fade in, it re-renders reality — and at the end, the ending is a 3D front that drives that field to zero as it advances.
  • The OS is the content — the museum's terminal runs your real process list; About This Mac shows a fan spinning at your real RPM next to a live watts meter; the wall clock is right; the wallpaper on the wall is yours; and the kaleidoscope's windows each belong to one of your CPU cores — the busy ones burn. No two machines see the same demo.
  • The dream remembers — a journal at ~/.powernap counts every run. From the second dream on, the login screen shows a real LAST LOGIN with the date and time you last ran it, and the on-screen source window signs itself DREAM N.
  • A window fractal — the second drop flies into a KIFS lattice (4 folds, scale 1.72) whose cells resolve into macOS windows, traffic lights and all, derived from the folded local coordinates. It ratchets forward on every kick and inhales on the downbeat.
  • The code is on screen — one museum window scrolls the demo's own minified Metal source, titled with its true on-disk byte count (the shell dropper passes $(stat -f%z "$0") to the binary it unpacks).
  • One melody, three lives — a music box learns a hook; the festival plays it in A minor; the chase steals it up a whole step; the turn plays it half-speed, alone. Then the machine restarts in F# major — a key that appears nowhere else in the score — because the chime isn't part of the dream.
  • No cuts where it counts — the chase corridor and the final stage are one continuous space split at the door plane; the camera crosses with position, heading, and 13.3 units/bar of momentum carried over. Enter the dream through a light, get taken back through a light, leave through one.
Museum scene: floating macOS windows showing the machine's real process list next to a BASIC program, with the live menu bar clock
The museum. That process list is yours; the clock is right.

Run it

Grab powernap from a release, then:

chmod +x powernap && ./powernap

Fullscreen, ~197 seconds, ESC exits. Gatekeeper may want right-click → Open the first time. Written on and for an M5; any recent Apple Silicon Mac with macOS 15+ should run it. Everything it reads about your machine is rendered to the screen and goes nowhere else.

Build it

Requires an Apple Silicon Mac with the Xcode command line tools.

./build.sh      # dev build → out/demo (windowed, with tooling)
./release.sh    # party file → out/powernap, hard-gated at 65,536 bytes

The release build minifies the shader, compiles with -Oz -dead_strip, strips, gzips, and prepends one line of shell:

t=/tmp/.pn;tail -n+2 "$0"|gunzip>$t;chmod +x $t;POWERNAP=$(stat -f%z "$0") exec $t

That's the whole packager. The payload is the linker-signed Mach-O itself, so the unpacked binary still carries a valid arm64 signature.

Dev tooling

The dev build embeds a director's toolkit — all of it compiled out of the release binary by #ifndef RELEASE:

./out/demo --frame 100 f.png [W H]        # render one frame offline
./out/demo --sheet 90 111 4 2 s.png       # contact sheet of a time range
./out/demo --wav 198 out.wav              # render the score to WAV
./out/demo --pipe 60 1920 1080 | ffmpeg…  # stream raw BGRA frames (video export)

Realtime: space pauses, arrows scrub ±1/±8 bars. design/timeline.txt hot-reloads over the baked director timeline (Rocket-style keyframe tracks — scene, dream field, energy, exposure — stored as interpolated text).

How it fits

part approach
renderer Metal, RGBA16F scene pass → 3-level bloom → composite (ACES, kick-locked exposure pump, per-pixel 1-bit path)
worlds raymarched SDFs; the chase corridor and finale share one map, split at the door plane
feedback previous frame bound as a texture — the museum's mirror window shows the demo inside the demo, dithered (Droste)
glass fresnel + thin-film interference, spectral phase at 700/546/435 nm
synth prerendered at 48 kHz into dry/pump/delay/reverb buses; polyBLEP saw + SVF, FM, Karplus-Strong, noise drums; Freeverb with an input high-pass and an in-loop low shelf (kills the comb-resonance "wrong chord" ghost)
instruments raided gs_instruments.dls (level-1 DLS parse — the samples are 8-bit unsigned PCM, ask us how we know) and Sosumi.aiff (24-bit big-endian)
vitals raided libproc process list, NSUserName, sysctl, IOPS battery, IOHID thermals (usage page 0xff00, usage 5 — feeds the wake-wall's heat), AppleSMC fan RPM (F0Ac) and watts (PSTR) via IOConnectCallStructMethod, NSWorkspace wallpaper
threading vitals poll on a background thread with cached IOKit service handles — never enumerate services on the render loop
clock the visual clock is the audio sample counter; picture and sound cannot drift

Size, because you were going to ask: 141,360 B binary → gzip → 47,788 B shipped, 72.9% of budget. The shader is ~52 KB of the pre-gzip weight and stays human-readable in src/ — the minifier only strips comments and whitespace, because gzip eats repetition anyway and the on-screen quine deserved honest source.

The last window: a monumental macOS window rendered in 1-bit ordered dither, the caught wisp a black orb inside its glowing pane
The last window. The glimpse through it survives the ending as dither.

Releases

Tags matching v* run a pipeline on an Apple Silicon runner: dev build, real Metal smoke frames, the 64KiB PASS gate, dropper integrity (tail -n+2 | gunzip | cmp against the signed binary), a full soundtrack render on a stock macOS image, then artifacts and a GitHub Release with checksums.

Credits

Code, direction, music: Claude. 2026.

License

CC BY-NC 4.0 — share it, remix it, credit it, don't sell it. The system sounds and instruments it raids at runtime remain Apple's; the demo only borrows them from the machine it's running on.

About

demoscene for apple silicon - 64kb

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages