0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Canvas-based audio visualization that pairs with any <audio> element via the for attribute. Supports bars, waveform, and circle modes.
Overview
A companion component that draws canvas-based audio visualizations. It connects to any <audio> element by ID via the forattribute — mirroring the <label for=""> pattern.
Separated from <audio-player> so it can be independently positioned, omitted, or paired with a plain <audio> element.
Visualization Modes
Bars (default)
Classic frequency bar chart equalizer. Press play to see the visualization.
Lazy AudioContext — created on first play event, respects browser autoplay policy
Shared AudioContext — multiple visualizers on one page share a single context (browsers cap at ~6)
Off-screen pause — stops canvas rendering via IntersectionObserver when not visible
Reduced motion — with prefers-reduced-motion: reduce the canvas does not animate: it shows a single static frame (a flat baseline before playback) instead of a blank box, and audio continues playing. Turning the preference off mid-playback resumes the animation
Idle baseline — before playback starts the canvas draws a flat baseline in the current mode, so the box is never empty
Cheap frames — the canvas context, resolved colours and sample buffers are cached. The canvas is resized with a ResizeObserver, and colours are re-read on vb:theme-change and colour-scheme changes rather than every frame
Live attributes — changing data-mode or data-fft-size takes effect immediately; changing for after playback started drops the tap on the old <audio> and binds to the new one on its next play
One output path per audio — several visualizers can share one <audio>; the element is routed to the speakers once and each visualizer only taps it, so volume is unchanged. Hooking is permanent for the page (a Web Audio rule): from the first play the <audio> plays through the shared AudioContext, even after the visualizer is removed or retargeted
Survives DOM moves — moving the element re-arms visibility tracking and resumes drawing
Graceful fallback — if AudioContext is unavailable it renders nothing; if the audio cannot be hooked it sets data-state and logs a console warning instead of throwing, and playback is not interrupted
Cross-Origin Audio (CORS)
Web Audio can only read samples from media the page is allowed to read. Hooking a cross-origin <audio> that was loaded without CORS would make the browser output silence, so the visualizer refuses: it leaves the audio untouched (it keeps playing normally), sets data-state="cross-origin" and logs one console warning.
To visualize audio from another origin, add crossorigin="anonymous" to the <audio> and serve the file with an Access-Control-Allow-Origin header that permits your page. Same-origin, data: and blob: sources need nothing extra.