Skip to content

WGSL: add octaveBrightness() to v0.46, v0.47, v0.48 for note-color parity #271

Description

@cursor

Context

Follow-up from shader playback audit (PR #268). WebGL overlay now applies octaveBrightness() so the same pitch class shares hue across octaves but gets brighter in higher octaves (0.65 at C-0 → 1.0 at B-9), matching patternv0.50.wgsl.

Older LED shaders still use pitch-class color only — C-3 and C-5 look identical.

Scope

Add octaveBrightness(note) and apply it wherever note color is computed in:

  • shaders/patternv0.46.wgsl
  • shaders/patternv0.47.wgsl
  • shaders/patternv0.48.wgsl

Reference implementation:

fn octaveBrightness(note: u32) -> f32 {
  if (note == 0u || note > NOTE_MAX) { return 1.0; }
  let oct = (note - 1u) / 12u; // 0..9
  return 0.65 + 0.35 * f32(oct) / 9.0;
}

Then run npm run sync:shaders to copy into public/shaders/.

Acceptance criteria

  • Same pitch class (e.g. all C notes) shares hue across octaves
  • Higher octaves are visibly brighter than lower octaves
  • Sustain tail rows inherit octave-scaled pitch color (dimmed, not re-hued)
  • No change to GPU packing or uniform layout

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions