Audio Reactive Reference
Exact modulator measures, ranges, defaults, GLSL names for Spectrum and History, data signal rules, timing model, frozen audio, companion files, limits and refusals.
Last updated: 2026-11-24
ALPHA: Shader Workshop is experimental. Audio Reactive can change.
This is the precise specification. The workflow is on Audio Reactive Shaders. How a modulator drives a parameter is on Shader Controls. Rendering is on Shader Output.
Summary
| Topic | Fact |
|---|---|
| Measures | Amplitude (RMS), Frequency band (FFT), Spectrum |
| Data sources | MIDI, Curve, Labels |
| Output | Every signal is 0 to 1 before gain and output range |
| Analysis | 48 kHz, Hann window of 2048 samples, hop 512 (93.75 rows per second) |
| Preview and export | Identical. Accepted renders use a frozen copy |
| Audio tracks | Up to 4 per Shader. Data tracks do not count |
| Modulators | 16 per Shader |
| Not included | Beat detection, live input, video with sound, mixer, N-band on Fractal |
Analysis
Analysis runs once per audio file and is shared by every modulator on it. Imported audio is decoded to 48 kHz PCM first. Each row is one 2048-sample Hann window. Rows are 512 samples apart. A row is centered at (2·i·512 − 1) / 96000 seconds. FFT bins sit every 48000 / 2048 = 23.4375 Hz.
Channels are averaged by power. A band includes the bins whose center lies in the half-open range from Low (Hz) up to but not including High (Hz). Hann leakage blurs the edges, so neighboring bands are not perfectly isolated.
Measures
Amplitude (RMS)
The root mean square of each analysis row, then the shaping below. This follows signal energy. It is not a loudness measure.
Frequency band (FFT)
The square root of the band's mean-square energy.
| Field | Range | Default |
|---|---|---|
| Low (Hz) | 0 up to below High | 20 |
| High (Hz) | up to 24000 | 250 |
Presets: Bass 20–250, Mids 250–2000, Highs 2000–16000. A band that contains no bin center is refused: "No FFT bin center falls in this band." Widen it.
Spectrum
N log-spaced bands between Low (Hz) and High (Hz). Band b covers [low·(high/low)^(b/N), low·(high/low)^((b+1)/N)). A band narrower than one bin uses one interpolated virtual bin, so no band is ever empty. Band energy is converted to decibels and normalized to 0 to 1 between Floor (dB) and Ceiling (dB). Smoothing runs per band.
| Field | Range | Default |
|---|---|---|
| Bands | 8, 16, 31, 32, 64 | 16 |
| ISO 1/3-octave | 31 bands from 17.7828 to 22387.2 Hz. Locks Low (Hz) and High (Hz) | off |
| Low (Hz) | at least 10 | 20 |
| High (Hz) | at most 24000, and at least 2 × Low | 16000 |
| Floor (dB) | −120 or higher | −60 |
| Ceiling (dB) | 12 or lower, and at least 6 dB above Floor | 0 |
| Peak hold | on or off | off |
| Hold (ms) | 0 to 5000, whole | 500 |
| Fall (dB/s) | 1 to 200 | 24 |
| History length | 1, 2, 4 or 8 s | 2 s |
A new Spectrum starts with Attack (ms) 10 and Release (ms) 180 (Punchy). Gain, Attack (ms), Release (ms) and Signal offset (ms) apply as for the other measures. Normalize does not apply to a Spectrum. The accessors stay 0 to 1, and Code min and Code max are hidden for it.
Peak hold is deterministic. A band that reaches or passes its peak resets the peak and the hold timer. Once the hold expires, the peak falls by Fall (dB/s) and never drops below the level.
A saved Spectrum cannot change to a single value, and a single value cannot become a Spectrum. Create a new modulator. A Spectrum also has a scalar summary: the loudest band. A mapping or Expression that reads the code name of a Spectrum reads that summary. The arrays are for GLSL.
A very long track with many bands can exceed the stored-value budget (2^25 values: rows × bands, doubled with peak hold). The refusal is "This track is too long for that many bands. Use fewer bands or turn off peak hold."
Shaping every signal
| Control | Range | Default |
|---|---|---|
| Gain | 0 to 100 | 1 |
| Attack (ms) | 0 to 60000 | 0 (Spectrum 10) |
| Release (ms) | 0 to 60000 | 0 (Spectrum 180) |
| Signal offset (ms) | −1000 to +1000, whole | 0 |
| Normalize | Off, Track, Rolling | Track |
| Window (s) | 0.5 to 30, Rolling only | 4 |
| Code min, Code max | −1000000 to 1000000, max above min | 0, 1 |
Presets: Raw 0 / 0, Punchy 10 / 180, Smooth 80 / 350. Other pairs show Custom.
Smoothing is a one-pole filter over the analysis rows: y = a·y_prev + (1 − a)·x with a = exp(−dt / tau), using the attack time when the input rises and the release time otherwise. tau 0 follows at once.
Normalize applies to Amplitude (RMS) and Frequency band (FFT). Track maps the 5th percentile of the whole file to 0 and the 99th to 1. Rolling does the same over a centered Window (s). A file whose range is nearly flat reads 0. Off keeps the raw scale.
After reading, the value is multiplied by Gain and clamped to 0 to 1. Then Code min and Code max give the code value: code = min + u · (max − min).
Signal offset (ms) shifts when the signal is read. −20 means the visuals hit 20 ms before the sound. It changes the read only, so it never forces a new analysis. Monitor latency is a listening setting on this computer. It never changes a render or the signal.
Spectrum in GLSL
For a Spectrum modulator with code name S, these names exist in your shader. Replace S with the real code name. Declare none of them.
| Name | Type | Meaning |
|---|---|---|
SCount |
int |
Current band count |
S(int band) |
float |
Level 0..1. Returns 0 outside 0..SCount-1 |
S(float x) |
float |
Smooth level at x in 0..1 across the bands |
SPeak(int band), SPeak(float x) |
float |
Peak-hold level. Equals S while Peak hold is off |
SHistory(int band, int row) |
float |
Level row steps ago. 0 is now, 127 is the oldest |
SHistory(float x, float age) |
float |
The same, with age from 0 (now) to 1 (oldest), interpolated |
SHistoryPeak(...) |
float |
History of the peak levels. Equals SHistory while Peak hold is off |
SHistorySeconds |
float |
History length in seconds |
SHistoryRows |
int |
128 |
S, SPeak, SHistory and SHistoryPeak are functions. Call them. The code name also reserves SCount, SHistorySeconds and SHistoryRows. A shader that declares any of these names fails to compile.
The bands are already log-spaced, so x is a log-frequency axis. Do not apply another log. Never hardcode the band count. Use SCount.
Array adaptivity
The array holds 64 slots whatever the band count. Switching 8, 16, 31, 32 or 64 bands, or changing the History length, is a value change. It does not recompile. Turning Peak hold on or off recompiles. Each Spectrum has its own Count.
History texture
History is a single-channel float texture that the host fills each frame. It turns on when your code uses any History name, and costs nothing otherwise. There is no switch. The texture is SCount wide and 128 rows tall, or 256 with peak hold (the second half holds the peaks). Row r is the level at the current time minus r × length / 127. Rows before the start of the track read 0. Rows are point samples, so a long History length can skip a narrow transient. Use the helpers. Do not sample the texture yourself.
Interface budget
The Shader interface holds 64 units in total, shared with mouse input (16), the camera (4) and individual parameters. A Spectrum costs 17, or 33 with Peak hold, plus 2 when your code uses History. In an otherwise empty interface that is 3 plain Spectrums, or 1 with Peak hold.
Examples
Bars around the horizon with peak caps:
const float PI = 3.14159265359;
vec4 hxMain(in HxFrag hx) {
vec3 d = normalize(hx.direction);
float x = fract(atan(d.x, d.z) / (2.0 * PI) + 0.5);
float h = asin(clamp(d.y, -1.0, 1.0)) / (0.5 * PI);
float n = float(SCount);
int band = int(floor(x * n));
float cell = fract(x * n);
float gap = step(0.12, cell) * step(cell, 0.88);
float bar = step(0.0, h) * step(h, 0.6 * S(band)) * gap;
float cap = (1.0 - smoothstep(0.004, 0.012, abs(h - 0.6 * SPeak(band)))) * gap;
vec3 base = mix(vec3(0.05, 0.08, 0.12), vec3(0.2, 0.7, 1.0), x);
return vec4(base * bar + vec3(cap), 1.0);
}
A scrolling waterfall that uses History, with the newest row at the horizon:
const float PI = 3.14159265359;
vec4 hxMain(in HxFrag hx) {
vec3 d = normalize(hx.direction);
float x = fract(atan(d.x, d.z) / (2.0 * PI) + 0.5);
float below = -asin(clamp(d.y, -1.0, 1.0)) / (0.5 * PI);
if (below < 0.0) return vec4(vec3(S(x)) * 0.2, 1.0);
float level = SHistory(x, below);
return vec4(mix(vec3(0.02, 0.02, 0.08), vec3(1.0, 0.6, 0.2), level), 1.0);
}
Scalar modulators in GLSL
A scalar audio, MIDI, curve or label modulator is one float named by its code name. It holds min + u · (max − min), so the default 0 to 1 range gives u. A name must start with a letter, use letters, digits and underscores, stay within 32 characters, contain no double underscore and not start with P_.
Imported data signals
Data tracks make no sound. Each becomes a signal on the same grid as audio and uses the same Gain, Attack (ms), Release (ms) and Signal offset (ms). There is no analysis step and no spectrum. Times are stored as exact fractions of a second, so the Master Clock tempo is never an input.
| Source | Accepted files | Measures |
|---|---|---|
| MIDI | Standard MIDI File format 0 or 1, PPQ timing. SMPTE timing is refused | Note-on events |
| Curve | CSV or tab text with a time column and value columns, at most 1024 columns. A first line is a header only when its time field is not a number | One column |
| Labels | Audacity label export | Points and regions |
Limits: 16 MiB per file. At most 200000 MIDI notes, 1000000 curve rows and 100000 labels. A file over a limit, or malformed, is refused as a whole with the first bad line or event. Nothing is attached.
MIDI filter: All notes, One pitch (0 to 127) or Pitch range.
| Value | Reads |
|---|---|
| Trigger | Velocity ÷ 127 on the row where each note starts |
| Gate | 1 while a note is held |
| Velocity | Velocity ÷ 127 while a note is held |
Curve: Column (1 to n), Linear or Step (Between points), and Input min and Input max. A value maps to (v − min) / (max − min), clamped to 0 to 1. It is 0 before the first row.
Labels: Trigger or Hold, with Label filter (empty reads every label). The filter matches the whole label text exactly. A point label is always a trigger. A region holds from its start to its end only in Hold.
Placement rules:
- An event lands on the first analysis row at or after it. An event at 0 lands on row 1.
- Every note start and label start fills at least one row, so a very short event is never lost.
- A data track reads 0 once its duration ends. The duration is the last event plus 3072 samples (64 ms).
Not supported: MIDI CC, pitch bend, aftertouch, live MIDI, Ableton Live Set and DAWproject.
Time and sampling
Each read has an exact content time t. The value is read at t − offset, between the two nearest analysis rows by linear interpolation. Outside the track's placed and trimmed interval a read is 0. The interval is half-open, so the track's end sample reads 0.
In preview, t is the playhead. In a sequence render, frame i is read at render_start + i / fps. Preview and export use the same reader, so a preview frame equals the exported frame at the same time. A Spectrum History row is evaluated independently at its own earlier time, so it never depends on the frames drawn before.
Frozen audio and determinism
When a render is accepted, every enabled audio signal is frozen into the job. The job keeps the exact audio bytes and the derived curves, each checked against its hash, in its own folder. A closure file lists them. Nothing in it names your original file, the analysis cache or the monitor settings.
After that, replacing the audio file, editing a modulator, clearing the analysis cache or closing the Workshop never changes the accepted render. A render that resumes re-reads the frozen copy and never analyses again. Missing or corrupt frozen data is refused. It is never replaced with silence.
The Render dialog shows each signal as Ready, Preparing, Change pending, Failed or No curve. It may say "Audio sources are not ready." or "Finish or cancel the audio import before rendering." A render never starts by itself when preparation finishes.
Companion files
Next to the frames, a render of a Shader with audio tracks writes:
| File | Content |
|---|---|
soundtrack-<track>.wav |
The track's audio, one file per audio track |
timing.json |
Schema 1 |
timing.json has fps (num, den), render_start, render_end and frame_count, and a tracks list. Each track has track_id, audio_file, audio_sha256, timeline_start, sample_rate, source_in_sample and source_out_sample. Frame i is at render_start + i / fps. Placement is the true placement. Signal offset (ms), Monitor latency, gain and mute never change it.
MIDI, curve and label tracks have no soundtrack file. Their effect is already in the frozen curves. A render with audio tracks and no modulator that reads them still writes the soundtrack and timing.json.
The render writes frames and companions. It does not mux a video with sound. Combine them in your editor.
Analysis cache and storage
The audio itself is stored inside the Shader. The analysis is stored apart, in the disposable Audio Analysis cache. Plan on about 23 MB per minute of audio, as an estimate. The cache is content-addressed. It does not depend on track placement, name, code name or monitor gain, so two Shaders that import the same file share it. Clearing it never deletes audio. It is rebuilt when a modulator next needs it. See Storage and Backup.
Analysis starts only when a modulator needs it. Listening starts none. A track that was not yet analysed shows "Analysing this track once. Later band and response edits reuse it." with Cancel analysis. A failure shows "Analysis failed." with Analyse now. Edits to Gain, Attack (ms), Release (ms) and Signal offset (ms) reuse the analysis.
Limits and refusals
| Limit | Value |
|---|---|
| Audio tracks per Shader | 4 |
| Audio file | WAV, FLAC or MP3, at most 2 GiB and 4 hours |
| Modulators per Shader | 16 |
| Mappings per Shader | 32 |
| Data file | 16 MiB |
| Signal offset (ms) | −1000 to +1000 |
| Monitor latency | 0 to 500 ms |
| Spectrum bands | 8, 16, 31, 32, 64 |
| History | 128 rows, 1, 2, 4 or 8 s |
Refusals you may see:
| Message | Meaning |
|---|---|
| "No FFT bin center falls in this band." | The band holds no bin. Widen it |
| "High must be at least one octave above Low (twice Low or more)." | Spectrum range too narrow |
| "Floor must be at least -120 dB, Ceiling at most 12 dB, and at least 6 dB apart." | Bad dB range |
| "Peak hold must be 0 to 5000 ms and fall 1 to 200 dB/s." | Bad peak settings |
| "This track is too long for that many bands. Use fewer bands or turn off peak hold." | Spectrum value budget |
| "Create a new modulator: a source cannot switch between a single value and a Spectrum." | A saved Spectrum keeps its shape |
| "Data tracks take Create modulator, not a set." | Create audio set… is for audio tracks |
| "Up to 4 audio tracks for now" | Track limit |
Not supported
- Beat detection. The signal follows the energy.
- Live input: microphone, line-in, MIDI, OSC, timecode.
- MP4 or other video with sound from the Workshop. Use the companion files.
- Mixer features: solo, pan, effects, clip splitting, stretching, fades.
- Ableton and DAWproject import, MIDI CC.
- Audio modulators on Fractal. Audio belongs to Shader.
- Arrays of more than 64 bands, or a History longer than 8 seconds.
Agents use the same operations as the app. See Shader Agents.