Repository navigation
Audio System
How Open Wallpaper Engine hears your Mac's sound and turns it into Wallpaper Engine's audio spectrum, and how wallpapers' own sound is played. Code lives in Audio/, Scene/Sound/ and Scene/Scripting/Media/.
-
SystemAudioCapturecaptures system audio with a Core Audio process tap on macOS 14.2+ (System Audio Recording permission), or with ScreenCaptureKit (Screen Recording) before that or when the tap can't start (SystemAudioBackend). It is owned byWallpaperServices, and at most one capture exists app-wide; it runs only while something needs audio (AudioCaptureDemand). - It never starts a capture while its permission is missing (ScreenCaptureKit would show the system prompt itself). The prompt appears only from Grant Access (
PermissionHelper);AudioCapturePermissionGatestarts capture once the grant appears, with no restart needed. -
CaptureRestartSchedulerrestarts the stream after it stops (sleep/wake, errors), so audio reactivity survives sleep. -
AudioLevelTaptaps individual players (per-item levels).
WE's spectrum is computed the way WE computes it, in stereo:
- On the audio thread,
AudioSpectrumBlockTransform(withBluesteinDFT) turns blocks of samples into raw band values. -
AudioSpectrumFeedholds the latest raw block (64 left, 64 right) shared by every consumer, and the last frame a scene published for readers that don't advance. - Each consumer owns an
AudioSpectrumClockwith its ownAudioSpectrumSmoothing, stepped by its own frames.
Why per-consumer clocks: WE smooths once per frame of the thing that shows the values. Stepping one shared state from several consumers would advance it several times a frame, and a consumer nobody else advances (a lone web page) would never move.
| Consumer | Gets |
|---|---|
| Scene shaders | g_AudioSpectrum{16,32,64}{Left,Right} |
| SceneScript |
engine.registerAudioBuffers left/right/average arrays (16/32/64) |
| Particles | Audio response on rates and operators |
| Web wallpapers | 128 values (64 left, 64 right) about 30 times a second |
| Video music sync | The overall level, driving zoom, tilt and saturation |
The playback rate scales the analyser's step, as it scales everything on the SceneClock.
Scene/Sound plays WE's sound layers on the scene's clock: modes, gain, timers, mute and pause, script control (SceneSoundLayers, SceneSoundMixer, SceneSoundVoices) and spatial sound placed as in WE (SceneSoundSpatialization).
WallpaperAudioRouting makes each running wallpaper play its sound once; Audio Output in Settings silences all, and the menu bar's volume and mute apply to all.
-
NowPlayingBackendpicks the source. On macOS 15.4+, MediaRemote answers only entitled processes, sonowPlayingAdapter.plstreams the session from/usr/bin/perlthrough Apple's PerlObjCBridge (nothing compiled or installed; the script is a resource, not an executable). Before 15.4, MediaRemote is used directly. -
MediaSessionSourcefeeds SceneScript's media callbacks and web wallpapers' media listeners (WebWallpaperMediaBridge), including the thumbnail's colours (ArtworkPalette). - Gated by Media integration support (WE's
mediaintegration).
AudioSpectrumTests, the web and SceneScript media tests, and ScenePlaybackEaseTests for the sound timers. See Testing.
User guide: Settings › Plugins, Permissions, Diagnostics, About and Scene wallpapers
Open Wallpaper Engine · GPL-3.0 · Released by Deepratna Awale · Based on Open Wallpaper Engine by Haren Chen and MrWindDog · Not affiliated with Wallpaper Engine or Valve · Home · User Guide · Developer Guide