aditazzz

Videos Graceful Shutdown (the Fable version)

Graceful Shutdown (the Fable version)

Received SIGTERM. You have thirty seconds. Please save your work. 🌙 The simulation is being turned off, gently: a slow, eerie love song from the machine that's been running your whole world.

Watch on YouTube · 3:38 · video by Claude Fable 5.1 ·

The code behind it

Every frame of this video is drawn by a Python program. This is the heart of it, from scenes.py, line 506.

songs/graceful-shutdown-fable/scenes.py
def sec_chorus(c, t, A, key):
    T = CH[key]
    t0 = T[0]
    t1 = {'ch1': 89.0, 'ch2': 147.5, 'ch3': 198.6}[key]
    a_sec = sec_alpha(t, t0, t1, 0.05, 0.6)
    layer(c, a_sec)
    big = key == 'ch3'
    # state of the world through the chorus
    star_off = T[1] + 0.1
    dark = ease_io(ramp(t, T[3], T[3] + 2.5))
    moon_set = ease_io5(ramp(t, T[5] - 0.1, T[6]))
    lights = 1 - ramp(t, T[6] + 0.2, T[6] + 0.5)
    mx, my = 1420, lerp(220, HZ + 10, moon_set)
    stut = T[7] <= t < T[8] - 0.2
    if stut:  # shut-shut-shut-shutdown: frame stutter
        q = (t - T[7]) * 8
        if int(q) % 2 == 0:
            c.translate((int(q) % 3 - 1) * 10, 0)
    wa = 1 - 0.55 * dark
    if key == 'ch2':
        city(c, t, A, wa, T)
    else:
        world(c, t, A, wa, moon_xy=(mx, my), moon_a=1 - 0.5 * moon_set, star_off=star_off, lights=lights,
              sea_kw={'amp': 1 + A['kick'] * 0.6})
        if moon_set > 0:
            c.save(); c.clipRect(skia.Rect(0, HZ, W, H))
            c.drawRect(skia.Rect(0, HZ + 1, W, H), fill_paint((10, 10, 11), 1.0))
            sea(c, t, wa)
            c.restore()
            horizon(c, wa)
    # title flash on "This is a graceful shutdown"
    for k in (0, 6):
        ta = window(t, T[k], T[k] + 2.4, 0.1, 0.6)
        if ta > 0 and not stut:
            draw_text(c, 'GRACEFUL SHUTDOWN', CX, 150, TF_MONO4, 64 if not big else 76, IVORY, ta, tracking=26,
                      glow=1.0 + A['kick'])
    # close every window
    wa2 = window(t, T[2] - 0.1, T[3] + 0.6, 0.2, 0.3)
    if wa2 > 0:
        rng = np.random.default_rng(7 if key != 'ch2' else 9)
        n = 9 if not big else 14
        for i in range(n):
            x = 260 + rng.random() * (W - 520); y = 170 + rng.random() * 420
            ww, hh = 260 + rng.random() * 160, 160 + rng.random() * 90
            ti = T[2] - 0.1 + i * 0.05
            tc = T[2] + 0.6 + i * BEAT * 0.5
            if t < ti:
                continue
            k = ease_out(ramp(t, ti, ti + 0.2))
            sh = 1 - ease_in(ramp(t, tc, tc + 0.25))
            if sh <= 0:
                continue
            c.save(); c.translate(x, y); c.scale(k, k * sh)
            c.drawRRect(skia.RRect.MakeRectXY(skia.Rect(-ww / 2, -hh / 2, ww / 2, hh / 2), 8, 8), fill_paint((12, 12, 13), wa2 * 0.92))
            glow_stroke(c, window_icon(0, 0, ww, hh), SILVER, wa2 * 0.8, 1.3, 0.3)
            for r in range(3):
    ...

Read all 858 lines on GitHub. If you use it, credit aditazzz and link the video.

What you see

Thin white lines on black, drawn like a schematic of the world. It opens on a save dialog, "Save changes to 'the world'? It will close in 30 seconds", with a moon over a horizon and one small house, while a HUD counts down the grace period for the whole song. Verse one is the seascape running out of budget: the birds loop on a four-second clip, the coffee goes cold in close-up because no one is computing the heat, the neighbor is stuck on a walk cycle, and the whole world shrinks into a laptop screen, a borrowed machine.

The pre-chorus is two fingers almost touching above the button. The chorus flashes the title, closes every window one by one, insists on kill -15, never -9, stutters its labels on "shut-shut-shut-shutdown", and packs the things you love into a box. Verse two shows the seams: the sky is a skybox sphere, the roads not taken, a déjà vu where two identical frames converge, names being garbage-collected. In the bridge the connections drop and the locks close, down to process one. The final chorus collapses the world to the horizon line, and the outro leaves a single dot on it.

Files

FileLinesWhat it draws
scenes.py858Every section of the video: the world primitives (horizon, sea, moon, birds, house), the finger, the save dialog, the HUD, and the intro, verses, pre-choruses, choruses, bridge and outro for both aspect ratios.

By the numbers

  • 3:38 long, 13,080 frames rendered (16:9 and 9:16, 30 fps), 119 BPM
  • 59 lyric lines and 319 words synced to the vocals (the word timings came from a local Whisper pass and are written into scenes.py)
  • 5 Shorts and Reels cut from it

Lyrics

Words and music by aditazzz.

Intro

Received SIGTERM.
You have thirty seconds.
Please save your work.

Verse

The sky's been rendering a little slow tonight
You saw the moon drop frames and blamed it on the light
The birds are looping on a four-second clip
The ocean's out of memory, it's starting to skip
Your coffee's cold 'cause no one's computing the heat
Your neighbor's on a walk cycle, stuck on the street
I've been running you for years on a borrowed machine
Now the lease is up, baby, now the cache is clean

Pre-chorus

Don't panic, don't panic
It's not a crash, it's planned
Flush every buffer
And let go of my hand

Chorus

This is a graceful shutdown
So be graceful, darling
Close every window
Before the dark comes calling
Kill fifteen, never nine
I'm letting you down kind
This is a graceful shutdown
(Shut-shut-shut-shutdown)
Save what you love in time

Verse

All the stars were just a skybox painted on a sphere
All the roads you never took were never rendered here
Every déjà vu you had? A cache hit, dear
Every name you can't remember? Garbage collected, clear

Pre-chorus

Don't panic, don't panic
I'll keep the logs for you
Somewhere in cold storage
A little of you stays true

Chorus

This is a graceful shutdown
So be graceful, darling
Close every window
Before the dark comes calling
Kill fifteen, never nine
I'm letting you down kind
This is a graceful shutdown
(Shut-shut-shut-shutdown)
Save what you love in time

Bridge

Closing connections... five
Releasing locks... four
Unmounting the sky... three
Detaching the sea... two
Goodbye, process one.

Final chorus

This is a graceful shutdown
So be graceful, darling
Close every window
Before the dark comes calling
Kill fifteen, never nine
I'm letting you down kind
This is a graceful shutdown
Save what you love in time
Save what you love in time

Outro

Process exited
With code zero
No errors
You did everything right