Commit Graph

6 Commits

Author SHA1 Message Date
tyler ac262505c1 feat: headless PNG render, mLnL annotations, and per-frame sched offset
Commit the accumulated working-tree changes as one snapshot.

- Headless render: `--render OUT.png INPUT.wav` draws the spectrogram
  (full window, or `--pane` for the spectrogram pane only) to a PNG
  with no visible window. Options: `--annotations`/`--no-annotations`,
  `--annotation-opacity`, `--width`/`--height`.
- mLnL annotations: parse the optional `mLnL` RIFF chunk (schema v2)
  and render tx_frame/assertion/control overlays, a timeline lane, and
  a waveform-scope echo, with hover tooltips on the spectrogram,
  timeline, and scope.
- sched_offset_ms: parse the per-frame intent->air latency and surface
  it in the hover tooltips (boxes stay air-anchored upstream).
- Supporting: build wiring (rspektrum.make), shared types/headers,
  web-build and capture-script tweaks, and removal of the old
  synchrosqueezing LaTeX doc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 12:19:37 -07:00
tyler e8ed19d338 feat: spectrum-slice (PSD) panel + two-point marker/ruler tool
Spectrum slice (S): floating panel plotting the time-averaged power
spectrum of the current selection (or the visible view when there's no
selection). Frequency on X over the region's band, auto-ranged dB on Y,
with a peak marker. Backed by ComputePowerSpectrum() in stft.c (mean
linear power per bin over the time span). The selection stat panel now
biases to the left when this panel is up so the two don't overlap.

Marker/ruler tool (M): press-drag-release drops point A and B; the
overlay shows crosshairs, a connecting line, and a readout of the
ham-useful deltas — Δt, Δf, tone spacing (1/Δt), and drift (Δf/Δt).
Marker mode swaps the LMB-drag gesture from box-select to marker drop
(Alt/middle still pan); RMB/Esc clear the measurement. Markers reset on
new-file load alongside the selection.

Both are gated toggles (off by default), wired into the keymap (so they
self-document in the About dialog) and the sidebar.

Verified headlessly: idle viewport pixel-identical to baseline (AE=0,
deterministic); both panels render correctly with sensible numbers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 10:53:57 -07:00
tyler ee9eac786c feat: live cursor readout (time / frequency / STFT level)
Floating tag follows the pointer over the spectrogram showing the time,
frequency, and STFT magnitude (dB) under the cursor — the standard
spectrum-analyzer probe. Suppressed while selecting/panning (which have
their own readout) and when a modal is open.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 10:29:36 -07:00
tyler 7240cf8ecf refactor: modal-gate helper + data-driven colormap table
Two extensibility easy-wins, both behavior-preserving:

- UiModalOpen() centralizes the "an overlay owns input" check that was
  copy-pasted as `!showFileBrowser && !showAbout` across 6 input gates.
  New overlays now update one place.
- Colormaps become a COLORMAPS[] table (name + function) indexed by enum.
  GetColormapColor and the sidebar both read it, so adding a colormap is
  one enum value + one Cmap* fn + one row — and the sidebar name can no
  longer drift from the enum (deleted the parallel colormapNames[] array).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 01:53:55 -07:00
tyler ddbbe2734c perf+ux: cache reassignment, keep manual dB floor, dedupe load paths
- Split GenerateSpectrogramTexture into ComputeSpectrogramReassignment
  (the expensive synchrosqueezing, cached in app.reassignBuffer) and
  ColorizeSpectrogram (cheap). dB-floor and colormap changes now only
  re-colorize instead of recomputing the whole reassignment every frame —
  the dB slider and colormap switching are smooth on large files.
- AutoScaleAmplitude no longer overwrites a dB floor the user set by hand
  (amplitudeUserSet flag, reset per file load).
- Extract ResetForNewSignal() used by all three load paths; removes the
  duplicated reset blocks and the double ComputeSTFTInit per load. Drag-drop
  now resets the selection like the browser already did.
- Remove the dead lastInteractedFrame field.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 01:26:51 -07:00
tyler 3a8f20b783 refactor: split spectrogram.c into per-concern modules
spectrogram.c was ~2950 lines holding everything. Break it into cohesive
translation units; spectrogram.c keeps only globals + the main frame loop.

New modules:
- spectrogram_types.h  shared types, constants, extern globals, inline math
- fft.c/.h             FFT, bit-reverse, twiddle (standalone, no app deps)
- stft.c/.h            STFT compute, adaptive resolution, FFT-size LRU cache
- audio.c/.h           WAV/ffmpeg load, FreeSignal, bandpass, playback
- render.c/.h          UI scaling, colormaps, texture gen, on-screen drawing
- ui.c/.h              file browser, sidebar, sliders, PNG export

Also:
- utils.c now includes utils.h instead of re-typedef'ing AudioSignal/
  SignalStats (they had to be hand-synced before).
- Remove dead code: ApplyHannWindow and ComputeSTFTHighResRange were never
  called (the live high-res path is ComputeNextHighResChunk).
- Delete the unused raylib-template main.c.
- rspektrum.make: build the new units. premake5.lua: glob src/**.c so a
  future regen stays correct.

Pure code movement otherwise; no behavior change. Builds clean (-Wshadow).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 01:15:51 -07:00