Skip to content

Audio-Reactive Wallpaper

Let the music do the moving. This shape scales with the current audio level, holds a soft peak glow, and estimates the tempo once it has enough history. Host audio callbacks drive the whole thing—there is no animation timer to maintain.

Install the packages from the quick start, then copy these three files. Each tab contains one complete file.

vite.config.ts
import { defineConfig } from 'vite';
import { wallpaperEnginePlugin } from 'wallpaper-engine/plugin';
export default defineConfig({
plugins: [
wallpaperEnginePlugin({
title: 'Audio Glow',
supportsAudioProcessing: true,
}),
],
});

The explicit supportsAudioProcessing: true option writes audio support into project.json. The plugin can also detect direct audio-listener calls in the built bundle; the explicit option keeps the intent clear when registration moves behind an abstraction.

Register once at module scope and reuse the analyzer. Measured elapsed time keeps tempo tracking aligned when callbacks vary in cadence. Pausing clears the visual and analysis history, so resuming starts with a fresh timing baseline.

Run bun x vite, then open Audio in the devtools panel:

  1. Choose Track loop and leave Tempo at 120 BPM.
  2. Allow roughly five seconds of regular playback for the first tempo estimate.
  3. Adjust Output and individual instrument levels to see how the shape reacts.
  4. Choose Silence to watch the glow decay. Off stops callbacks and leaves the last rendered state in place.
  5. In Runtime, pause and resume the wallpaper. The shape resets while paused.

The simulator generates spectrum frames rather than audible sound. In Wallpaper Engine, the callback receives the host’s captured spectrum. Tempo and instrument values are estimates; they do not identify individual audio sources or expose Windows master volume. See the Audio guide for timing, warm-up, and detection limits.