Skip to main content

Module spectrum

Module spectrum 

Source
Expand description

Spectrum scene (Plan 0034 / ADR-0036): the analysis frame’s log-spaced band array, drawn as N elements.

This is a fourth consumer of the existing line idiom, not a fifth render idiom: N bars, an N-point polyline and a radial ring of N spokes are all segment lists, and they go out through the same shared LineRenderer the three other line scenes draw through (ADR-0007). Nothing new is uploaded, no new pipeline is built, and the Scene trait is untouched — update already receives the whole AnalysisFrame, bands included.

The per-frame work is a chain of small pure steps — downsample, the per-element ease, then one of the three SpectrumLayout builders — all free functions over preallocated buffers. They are separate from the scene so the claims that matter (low elements track low frequencies; the 64 → N reduction loses nothing) are testable without a GPU.

The composite vocabulary this scene honors, since a silent no-op is the failure mode the shared-surface work exists to avoid:

  • zoom / pan_x / pan_y — the shared view transform (ADR-0018), applied by the renderer exactly as for every other line scene.
  • mirror_order / mirror_reflect — the geometry mirror (Plan 0018 Phase 4). It replicates real geometry before rasterization and costs this scene nothing, so refusing it would be a no-op the author could not see. On the radial ring it is nearly the identity (the ring is already rotationally symmetric, the same near-no-op the Hankin star has); on bars and polyline it is genuinely transformative, because those figures are not centred.
  • [palette] / [palette_b] / palette_mix / hue / hue_spread / saturation — the colour surface (ADR-0021), sampled on the CPU. Each line scene walks hue_spread along the axis its own generator makes meaningful (ADR-0059) — path position on parametric, generation depth on lsystem, radius on star — and this scene’s is band index. The default spectrum palette is the engine cosine, so an author who sets no [palette] sees the usual colour language.
  • thickness / brightness / scale / base — ordinary stroke styling.
  • curve — the level-shaping exponent (ADR-0040, Plan 0038 Phase 3), applied to the downsampled level before the per-element smoother so the easing operates in the displayed domain. 1.0 is exactly linear. It is the third per-element lever on an element’s length, beside base and scale.
  • glow — the line renderer’s per-segment falloff multiplier (Plan 0038), whole-figure like on the other three line scenes. Not a post bloom.
  • softness — the across-the-stroke profile (ADR-0124), whole-figure and shared with the other three line scenes. Default 0.25: a solid bar with a short shoulder. 1.0 is the pure quadratic falloff; 0 is solid with a one-pixel edge. A different quantity from glow, which scales the light and never the coverage.

Three parameters are layout-specific, and each is a no-op on the layouts it does not describe — stated in presets/README.md and docs/presets.md rather than left for an author to discover:

  • radius is the ring’s inner radius; no meaning for bars or the polyline.
  • span and baseline place the bars/polyline figure in world space; no meaning for the ring, which radius sizes instead (Plan 0038 Phase 2).

Structs§

SpectrumScene
The spectrum readout: N elements driven by the analysis frame’s band array, drawn through the shared line renderer.

Enums§

SpectrumLayout
Which figure the elements form. Selected once at preset load through the [spectrum] table; an unknown name is a surfaced load error (ADR-0007).

Constants§

MAX_ELEMENTS
Largest element count a [spectrum] table may ask for — the band count itself, because above it the 64 → N reduction stops being a partition of the array. The loader validates against this, and the render layer sizes its per-element scratch to it (Plan 0034 Phase 4), so the two cannot disagree.
PARAMS
Parameter vocabulary — see fragment_field::PARAMS. Keep in sync with set_param below.