Spectral Painter — User Guide
Whole-sound complex-spectrum transformation using deterministic signed frequency masks or random real/imaginary diffusion, with optional wet-tail padding and stereo widening.
What this does
Spectral Painter performs one whole-sound FFT per processed channel and edits the resulting complex Spectrum before inverse transformation. In deterministic modes it multiplies both real and imaginary components by a frequency-dependent real mask. In Random Complex Diffusion, the real and imaginary components receive independent random multipliers per bin, intentionally changing both magnitude and phase/time structure.
This is therefore a global frequency-domain transformation, not a frame-by-frame spectrogram painter. The same frequency law applies across the complete padded sound.
Complex spectrum, masks and diffusion
A Fourier Spectrum stores each frequency bin as a complex number with real and imaginary parts. Its magnitude describes how much energy is present at that bin; its phase describes temporal alignment. Multiplying the full complex bin by a real factor changes magnitude. When that factor is negative, the bin also acquires a π phase flip.
The deterministic modes create frequency-dependent masks from sine, logarithmic sine, triangle, square, sawtooth, exponential, logarithmic or dual-sine functions. Above the effective cutoff, bins are left unchanged.
Quick start
- Select exactly one mono or stereo Sound.
- Run
Spectral_Painter.praat. - Try Ghost Signal for a subtle deterministic ripple, Broken Radio for hard polarity steps, or Glass Shatter for extreme random complex diffusion.
- Use cutoff_frequency to define how much of the spectrum is painted. Values above Nyquist are clipped to Nyquist.
- Use tail_duration_s to zero-pad the wet transform before FFT; hard or irregular spectral masks can then ring into that added region.
- Use Wet/Dry for final blending. The dry reference is always the original unpadded source.
Presets
Presets override modulation settings only; tail, fade, Wet/Dry, stereo output, visualization and scale-peak values remain user-controlled.
| Preset | Mode | Key values |
|---|---|---|
| Custom | User-selected | No override. |
| Broken Radio | Square | center .15; depth 2.8; divisor 8; cutoff 6 kHz. |
| Demon Voice | Exponential | center 0; depth 5; divisor 30; cutoff 1.2 kHz. |
| Glass Shatter | Random Complex Diffusion | center 0; depth 3; divisor 6; cutoff 20 kHz; randomness 1. |
| Black Hole | Square | center 0; depth 1; divisor 60; cutoff 18 kHz. The preset's phase_offset value is inactive in Square mode. |
| Bit Rot | Square | center .5; depth −2.5; divisor 18; cutoff 14 kHz. |
| Insect Swarm | Dual Sine | center .2; depth 2.5; divisors 9 / 10; cutoff 18 kHz. |
| Frozen Cathedral | Sine (Log) | center .3; depth 2.2; divisor 30; cutoff 20 kHz; phase 1.57. |
| Dying Machine | Sawtooth | center .5; depth −2; divisor 25; cutoff 8 kHz. |
| Quantum Tunnel | Dual Sine | center 0; depth 2; divisors 100 / 101; cutoff 16 kHz. |
| Vocal Destroyer | Random Complex Diffusion | center .3; depth 3.5; divisor 30; cutoff 5 kHz; randomness .9. |
| Thunder Rumble | Exponential | center 0; depth 8; divisor 20; cutoff 400 Hz. |
| Crystal Fracture | Square | center .15; depth 3; divisor 5; cutoff 18 kHz. |
| Toxic Waste | Random Complex Diffusion | center 0; depth −3; divisor 12; cutoff 12 kHz; randomness .95. |
| Ghost Signal | Sine (Linear) | center .05; depth .12; divisor 500; cutoff 8 kHz. |
| Nuclear Meltdown | Random Complex Diffusion | center 0; depth 5; divisor 4; cutoff 20 kHz; randomness 1. |
| Cello: Spectral Phase Comb | Square | center 0; depth 1; divisor 65; cutoff 16 kHz. Phase_offset is inactive in Square mode. |
| Cello: Spectral Smear | Random Complex Diffusion | center .2; depth 4; divisor 55; cutoff 16 kHz; randomness 1. |
| Cello: Body Resonance Warp | Sine (Log) | center .5; depth 3.5; divisor 60; cutoff 16 kHz; phase .78. |
Controls
| Control | Default | Meaning |
|---|---|---|
| Modulation_type | Sine Wave (Linear) | Selects one of nine frequency-domain transfer laws. |
| cutoff_frequency | 15000 Hz | Only bins below the effective cutoff are transformed; clipped to Nyquist. |
| modulation_center | 1.0 | Baseline multiplier inside the transformed band. |
| modulation_depth | 0.8 | Strength and polarity of the modulation term. Large values can cross zero and create π flips. |
| modulation_frequency_divisor | 150 | Pattern scale. Its exact interpretation is mode-dependent. |
| phase_offset | 0.01 | Used only by Sine Linear and Sine Log modes. |
| second_divisor | 300 | Second pattern scale for Dual Sine. |
| randomness_amount | 0.3 | Random Gaussian contribution in Random Complex Diffusion; clamped to ≥0. |
| tail_duration_s | 1 s | Silence appended to the wet working signal before the whole-sound FFT. This changes transform length and provides time for frequency-domain ringing. |
| fade_out_duration_s | 0.5 s | Linear fade applied to the wet path only over the end of the padded output. |
| wet_dry_percent | 100% | Blend with the untouched source. |
| stereo_output | On | For mono input, widens only the wet path with a 12 ms right-channel delay. Stereo input is processed and preserved channel by channel. |
| scale_peak | 0.95 | When Wet > 0, final output is target-normalized to this peak. |
| show_visualization | On | Draws the measured mechanism-first process visualization. |
| play_after_processing | On | Plays the final output. |
Processing pipeline
- Reject input with more than two channels.
- Copy the source and append
tail_duration_sof silence to the wet working copy. - Process each source channel independently with a whole-sound FFT.
- Apply the selected complex-bin transfer law below the cutoff.
- Inverse-transform and trim each wet channel to the padded working duration.
- Apply the wet-only end fade.
- Preserve stereo sources, or optionally create stereo from mono by delaying only the wet right channel by 12 ms.
- Mix with the untouched source as dry reference. Samples after the source end contain no dry signal.
- If Wet > 0, target-normalize to
scale_peak.
Channels, randomness, duration and bypass
- Input: mono or stereo only.
- Stereo input: each channel receives the same deterministic law; Random Complex Diffusion generates independent random realizations per channel.
- Mono + stereo_output: only the wet right channel is delayed by 12 ms; the dry component remains centred.
- Randomness: no exposed seed and no predictable initialization; Random Complex Diffusion can differ on every run.
- Output duration: source duration +
tail_duration_s. - Wet = 0: no peak normalization and sample values over the source interval come from the dry reference, but the output still has the padded duration and follows the requested mono/stereo output layout. It is therefore not a bit-for-bit file bypass.
- Output name:
<source>_<preset>.
Visualization
The mechanism-first visualization uses the actual retained representative channel (stronger RMS channel for stereo). It shows the realized transfer law or random complex realization, measured source/wet spectral information, phase-change metrics, waveform/tail behaviour and the final output. Deterministic curves represent the actual frequency mask used by the DSP rather than a generic illustration.
Technological context
Spectral Painter belongs to the broad computer-music tradition of direct Fourier-domain sound transformation: analyze a sound into complex frequency bins, alter those bins, and reconstruct the waveform. The important distinction here is between magnitude-only spectral shaping and complex spectral editing. Because this script multiplies the complete complex bin, signed masks can produce 180° phase reversals; Random Complex Diffusion goes further by perturbing real and imaginary components independently.
The word “Painter” is therefore descriptive rather than a claim about a specific historical synthesis system: the user draws a frequency-dependent transfer law over the complete spectrum rather than editing a time-varying spectrogram with a graphical brush.