spectrograph
spectrograph · hybrid · schema v1SPECTROGRAPH — a real-time scrolling sonogram VIDEO generator. Takes ONE mono audio input and renders a log-binned spectrograph: FREQUENCY on the vertical axis (log scale, 20 Hz at the BOTTOM up to 20 kHz / Nyquist at the top), TIME scrolling horizontally with the NEWEST column at the RIGHT (older content slides off the left). Model: an AnalyserNode tap (1024-pt FFT, getFloatFrequencyData dBFS) on the input is log-binned into 128 perceptual rows per column spanning [20 Hz .. 20 kHz] (each row picks the nearest FFT bin to its target Hz, DC skipped); magnitudes are normalized over a -90 dBFS (quiet) .. -10 dBFS (loud) display window and written into a 256-wide circular column buffer that advances at most once per ~16 ms frame (steady scroll independent of how many outputs are patched). The binning + colormap math is the same algorithm WAVESCULPT uses for its spectrograph view (video_mode 2), lifted into a pure GPU-free core. TWO video outputs render the SAME binned dB plane through two different colormaps — both always live regardless of which the on-card preview shows. IO — IN (audio): the mono signal to analyse. COLOR OUT (mono-video): the blue→cyan→yellow→red HEAT colormap (loud = hot/red, quiet = dark blue/black) — the classic colored spectrogram. B/W OUT (mono-video): INVERTED grayscale — quiet = light/WHITE, loud = dark/BLACK — i.e. the classic PRINTED-SONOGRAM look (light page, dark traces). Controls — GAIN: a pre-analysis input trim (×0.25 .. ×4, LOG taper, unity at center) applied by a GainNode BEFORE the analyser, so you can boost a quiet source up into the -90..-10 dB display window (or tame a hot one) without changing the displayed dynamic range. GAIN is MIDI / control-surface assignable (right-click → MIDI Learn) like every other knob. A card VIEW toggle (COLOR / B/W) just switches which output the on-card preview shows — it does not change either output. All patching is via the card's yellow drill-down PATCH PANEL (top-left / top-right affordances → INPUT / OUTPUT) — no side jacks. It is a `domain: audio` module that exposes VIDEO outputs through the audio→video texture bridge (the SYNESTHESIA / WAVESCULPT cross-domain pattern), so you patch COLOR / B/W OUT straight into any video module or the video OUTPUT. Usage: drop it on any audio bus to SEE the spectral content of a synth / drum / mix in real time — patch COLOR into the video OUTPUT for the colored sonogram, or B/W for the printed-paper look; feed it from a SCALER / mixer to pick which signal you scope.
the faceplate
inputs
| id | cable | what it does |
|---|---|---|
in | audio | The mono audio signal to analyse — its frequency content is FFT-analysed and drawn as the scrolling spectrograph. Patch any audio source here (a synth voice, a mix, a drum bus). audio signal |
outputs
| id | cable | what it does |
|---|---|---|
color | mono-video | The spectrograph rendered with the COLOR heat ramp — quiet = dark blue, getting louder through cyan → yellow → red. A mono-video output; patch it into VIDEO OUT or any video module for a vivid, colorful sonogram. mono video stream |
bw | mono-video | The SAME spectrograph rendered as INVERTED grayscale — quiet = white, loud = black — the classic printed-sonogram look (light page, dark traces). A mono-video output, drawn from the same FFT plane as COLOR, so the two are time-aligned. mono video stream |
params
| id | label | range | default | curve |
|---|---|---|---|---|
gain | Gain | 0.25..4 | 1 | log |
controls
| control | what it does |
|---|---|
| Gain | Pre-analysis input trim (0.25..4, log, default 1) — boosts a quiet source up into the −90..−10 dB display window so its traces are visible (or tames a hot one). Applied before the FFT tap; it shapes the IMAGE contrast, not the audio (there's no audio output). |
source
spectrograph.ts on GitHub.