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.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.8 (2026) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

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.

What does “painting the spectrum” mean here? The script defines a gain-like function of frequency and applies it directly to complex FFT bins. Positive values scale magnitude while preserving phase; a negative multiplier reverses the sign of both real and imaginary components, which is equivalent to a spectral phase rotation of π (180°), not merely “negative loudness.”

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.

Random Complex Diffusion is different: Praat's random multiplier is evaluated independently for each Spectrum cell, so the real and imaginary rows do not receive one shared gain. This alters the complex angle as well as magnitude. It is intentionally a phase/time diffusion process, not a conventional magnitude-only random EQ.

Quick start

  1. Select exactly one mono or stereo Sound.
  2. Run Spectral_Painter.praat.
  3. Try Ghost Signal for a subtle deterministic ripple, Broken Radio for hard polarity steps, or Glass Shatter for extreme random complex diffusion.
  4. Use cutoff_frequency to define how much of the spectrum is painted. Values above Nyquist are clipped to Nyquist.
  5. Use tail_duration_s to zero-pad the wet transform before FFT; hard or irregular spectral masks can then ring into that added region.
  6. 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.

PresetModeKey values
CustomUser-selectedNo override.
Broken RadioSquarecenter .15; depth 2.8; divisor 8; cutoff 6 kHz.
Demon VoiceExponentialcenter 0; depth 5; divisor 30; cutoff 1.2 kHz.
Glass ShatterRandom Complex Diffusioncenter 0; depth 3; divisor 6; cutoff 20 kHz; randomness 1.
Black HoleSquarecenter 0; depth 1; divisor 60; cutoff 18 kHz. The preset's phase_offset value is inactive in Square mode.
Bit RotSquarecenter .5; depth −2.5; divisor 18; cutoff 14 kHz.
Insect SwarmDual Sinecenter .2; depth 2.5; divisors 9 / 10; cutoff 18 kHz.
Frozen CathedralSine (Log)center .3; depth 2.2; divisor 30; cutoff 20 kHz; phase 1.57.
Dying MachineSawtoothcenter .5; depth −2; divisor 25; cutoff 8 kHz.
Quantum TunnelDual Sinecenter 0; depth 2; divisors 100 / 101; cutoff 16 kHz.
Vocal DestroyerRandom Complex Diffusioncenter .3; depth 3.5; divisor 30; cutoff 5 kHz; randomness .9.
Thunder RumbleExponentialcenter 0; depth 8; divisor 20; cutoff 400 Hz.
Crystal FractureSquarecenter .15; depth 3; divisor 5; cutoff 18 kHz.
Toxic WasteRandom Complex Diffusioncenter 0; depth −3; divisor 12; cutoff 12 kHz; randomness .95.
Ghost SignalSine (Linear)center .05; depth .12; divisor 500; cutoff 8 kHz.
Nuclear MeltdownRandom Complex Diffusioncenter 0; depth 5; divisor 4; cutoff 20 kHz; randomness 1.
Cello: Spectral Phase CombSquarecenter 0; depth 1; divisor 65; cutoff 16 kHz. Phase_offset is inactive in Square mode.
Cello: Spectral SmearRandom Complex Diffusioncenter .2; depth 4; divisor 55; cutoff 16 kHz; randomness 1.
Cello: Body Resonance WarpSine (Log)center .5; depth 3.5; divisor 60; cutoff 16 kHz; phase .78.

Controls

ControlDefaultMeaning
Modulation_typeSine Wave (Linear)Selects one of nine frequency-domain transfer laws.
cutoff_frequency15000 HzOnly bins below the effective cutoff are transformed; clipped to Nyquist.
modulation_center1.0Baseline multiplier inside the transformed band.
modulation_depth0.8Strength and polarity of the modulation term. Large values can cross zero and create π flips.
modulation_frequency_divisor150Pattern scale. Its exact interpretation is mode-dependent.
phase_offset0.01Used only by Sine Linear and Sine Log modes.
second_divisor300Second pattern scale for Dual Sine.
randomness_amount0.3Random Gaussian contribution in Random Complex Diffusion; clamped to ≥0.
tail_duration_s1 sSilence 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_s0.5 sLinear fade applied to the wet path only over the end of the padded output.
wet_dry_percent100%Blend with the untouched source.
stereo_outputOnFor mono input, widens only the wet path with a 12 ms right-channel delay. Stereo input is processed and preserved channel by channel.
scale_peak0.95When Wet > 0, final output is target-normalized to this peak.
show_visualizationOnDraws the measured mechanism-first process visualization.
play_after_processingOnPlays the final output.

Processing pipeline

  1. Reject input with more than two channels.
  2. Copy the source and append tail_duration_s of silence to the wet working copy.
  3. Process each source channel independently with a whole-sound FFT.
  4. Apply the selected complex-bin transfer law below the cutoff.
  5. Inverse-transform and trim each wet channel to the padded working duration.
  6. Apply the wet-only end fade.
  7. Preserve stereo sources, or optionally create stereo from mono by delaying only the wet right channel by 12 ms.
  8. Mix with the untouched source as dry reference. Samples after the source end contain no dry signal.
  9. If Wet > 0, target-normalize to scale_peak.

Channels, randomness, duration and bypass

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.