# Visualizer neiroX 0.4 adds an optional visualizer to the built-in UI. It stays off unless you enable it. ## Start with the default line ```ts const player = createPlayer({ playlist, target: '#player', ui: { mode: 'card', visualizer: true } }); ``` `true` enables the default `line` visualizer. ## Styles There are four deliberately small visual styles: ```text line thin waveform spectrum centered rounded capsule field levels upward frequency bars from a bottom baseline pulse low-frequency breathing shape ``` `spectrum` is intentionally art-directed rather than a raw equalizer. It keeps a centered field of rounded capsules, groups nearby frequency bins, and smooths attack/release so the motion stays musical without becoming noisy. `levels` is the non-mirrored alternative: slim bars rise upward from a quiet bottom baseline. It uses grouped logarithmic frequency ranges and a separate response curve so it reads clearly without turning into a dense DJ-style analyzer. Choose one directly: ```ts ui: { visualizer: 'pulse' } ``` Or configure it: ```ts ui: { visualizer: { enabled: true, type: 'line', intensity: 0.68, smoothing: 0.72, youtubeFallback: 'ambient' } } ``` `intensity` and `smoothing` use values from `0` to `1`. ## Runtime controls ```ts player.ui?.setVisualizer('line'); player.ui?.setVisualizer('spectrum'); player.ui?.setVisualizer('levels'); player.ui?.setVisualizer('pulse'); player.ui?.setVisualizer(false); player.ui?.isVisualizerEnabled(); player.ui?.getVisualizerType(); ``` Changing the visualizer does not recreate the player or restart playback. ## Direct audio and RSS For normal audio tracks, neiroX reads real-time samples from the playing media when the browser exposes `HTMLMediaElement.captureStream()`. RSS episodes use the same direct-audio path after their enclosures are normalized into tracks. If the browser cannot expose the media stream, playback continues normally and the visualizer falls back to its quiet resting state. neiroX does not reroute the media element through Web Audio just to force visualization. ## YouTube The official YouTube iframe does not expose decoded audio samples to neiroX. The visualizer therefore never pretends to show YouTube frequency data. By default, a playing YouTube track uses a slow `ambient` motion that reflects playback state only: ```ts ui: { visualizer: { enabled: true, type: 'line', youtubeFallback: 'ambient' } } ``` Disable the fallback if you prefer: ```ts ui: { visualizer: { enabled: true, youtubeFallback: 'none' } } ``` ## Web Component ```html ``` Use `line`, `spectrum`, `levels`, `pulse`, or `off`. For advanced options, use JSON configuration instead of attributes. ## Theme variables The visualizer inherits the active player accent by default. ```css .nx-player { --player-visualizer-color: var(--player-accent); --player-visualizer-opacity: 0.62; --player-visualizer-line-width: 1.25px; --player-visualizer-height: 28px; } ``` The canvas is HiDPI-aware, pauses its animation loop when it is not needed, and respects `prefers-reduced-motion`.