Spectral Freeze & Glitch — User Guide

Creates buffer-stutter freezes by looping short waveform segments at random source positions, with optional loop-edge smoothing, silence avoidance, and cumulative time-varying amplitude artifacts.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.6.1 (2026) License: MIT License Repo: GitHub
Contents:

What this does

Spectral Freeze & Glitch works directly on waveform samples. For each requested freeze point, it chooses a freeze-zone length and position, captures the current processed Sound as a snapshot, and fills that zone by repeatedly reading a shorter segment from the snapshot. After the freeze is written, a sinusoidal amplitude factor is applied across the full Sound.

selected Sound → copy for processing → choose freeze length and legal position → optional silence test / reroll → snapshot current result → repeat one source segment inside freeze zone → optional raised-cosine loop-edge taper → whole-file amplitude modulation → next freeze point → target peak scaling
Freeze points are processed sequentially. A later point therefore operates on the result produced by earlier points, while all repeats inside one freeze point read from the same pre-pass snapshot.

Quick start

  1. Select exactly one Sound object.
  2. Run Spectral_Freeze_&_Glitch.praat.
  3. Choose Default, Short Bursts, Long Freeze, Artifact Storm, or Custom.
  4. Set the number and duration range of freeze zones.
  5. Set the repeat divisor to control the repeated micro-segment length.
  6. Leave loop smoothing and silence avoidance enabled for the default behavior, or adjust their controls.
  7. Run. The result is named <source>_glitch.

Freeze generation

Base duration

The source length is converted to a base freeze duration in samples:

baseFreezeSamples = floor( totalSamples / Freeze_duration_divisor )

The value is clamped to at least one sample.

Per-point freeze length

minLength = floor( baseFreezeSamples × Freeze_length_min_factor ) maxLength = floor( baseFreezeSamples × Freeze_length_max_factor ) freezeLength ~ RandomInteger(minLength, maxLength)

The global minimum and maximum are constrained to the legal range 1…totalSamples. The minimum factor must not exceed the maximum factor.

Freeze position

The script first attempts to keep freeze zones away from the extreme beginning and end by using the base freeze duration as a margin. For very short files or extreme custom settings, it falls back to the complete legal start-position range.

Every accepted freeze zone is guaranteed to fit entirely inside the Sound.

Micro-loop structure & smoothing

Repeated segment length

repeatSegment = floor( freezeLength / Freeze_repeat_divisor )

The result is constrained to at least one sample and never longer than the freeze zone.

Loop read

Immediately before processing one freeze point, the current result is copied to a snapshot. Inside the freeze zone:

sourceIndex = freezeStart + ((outputIndex - freezeStart) mod repeatSegment) output = snapshot[sourceIndex] × loopEnvelope

The same snapshot grain is therefore repeated throughout that freeze zone. The processing does not recursively read back the newly written repeats of the same point.

Loop-wrap smoothing

When Smooth_loop_wraps is enabled, the beginning and end of every repeated micro-segment receive matching raised-cosine tapers. The requested width is:

requestedSmoothSamples = round( Smoothing_ms / 1000 × sampleRate ) effectiveSmoothSamples = min( requestedSmoothSamples, floor(repeatSegment / 2) )

Smoothing is disabled for that freeze point when fewer than two samples are available for a valid taper. Otherwise, each repeated grain reaches exactly zero at both loop edges.

The taper is applied inside every repeated grain. It does not overlap adjacent repeats; a short amplitude dip occurs at the loop rate instead of an overlap-add crossfade.

Silence avoidance

When Avoid_silence is enabled, the script measures the RMS of the original source and derives:

silenceThreshold = Silence_rms_factor × overallSourceRMS

For each freeze point, the RMS test is performed on the proposed loop-source region, whose duration is one repeatSegment. If its RMS is below the threshold, only the position is rerolled; the chosen freeze length and repeat length remain unchanged.

The script tries at most Max_position_attempts positions. If none passes the threshold, that freeze point is skipped.

Skipped points do not create a freeze zone and do not apply their corresponding whole-file amplitude-modulation pass.

If the source's overall RMS is undefined or zero, the internal reference is replaced by 0.0001 before the silence threshold is calculated.

Time-varying amplitude artifact

After each successfully applied freeze point p, the complete Sound is multiplied by:

gain[n] = 1 + Artifact_amplitude × sin( 2π × p × n / totalSamples )

Point 1 contributes one sinusoidal gain cycle across the file, Point 2 contributes two cycles, Point 3 three cycles, and so on.

Because this multiplication is applied after every successful freeze point, the modulation accumulates multiplicatively:

final gain trajectory = gain_1[n] × gain_2[n] × ... × gain_k[n]

The artifact acts across the complete Sound, not only inside the corresponding freeze zone.

Presets

PresetPointsDuration divisorLength factorsRepeat divisorArtifact
Default12250.5–1.530.10
Short Bursts8150.3–1.020.05
Long Freeze16400.8–2.040.12
Artifact Storm20200.4–1.620.25

Named presets overwrite only the freeze parameters and Artifact_amplitude shown above. They do not change Smooth_loop_wraps, Smoothing_ms, Avoid_silence, Silence_rms_factor, Max_position_attempts, Scale_peak, Draw_visualization, or Play_result.

Parameters & effective limits

ParameterDefaultExact role
PresetDefaultDefault, Short Bursts, Long Freeze, Artifact Storm, or Custom.
Freeze_points12Requested number of freeze passes; limited internally to 5000.
Freeze_duration_divisor25Positive divisor used to derive the base freeze length from total sample count.
Freeze_length_min_factor0.5Positive lower multiplier for random freeze length.
Freeze_length_max_factor1.5Positive upper multiplier; must be at least the minimum factor.
Freeze_repeat_divisor3Positive divisor used to derive the repeated micro-segment length.
Artifact_amplitude0.10Depth of the whole-file sinusoidal gain modulation applied after each successful point.
Smooth_loop_wrapsOnEnable raised-cosine tapers at the edges of each repeated micro-segment.
Smoothing_ms2 msRequested taper width; clamped to at most half of the repeat segment.
Avoid_silenceOnReroll freeze positions whose source loop region is below the RMS threshold.
Silence_rms_factor0.15Multiplier applied to overall source RMS to define the silence threshold.
Max_position_attempts20Maximum number of position trials for one freeze point.
Scale_peak0.91Final target Sinc70 peak for non-silent output.
Draw_visualizationOnDraw source/result waveforms, freeze zones, freeze map and summary.
Play_resultOnPlay the completed result.

Channels, duration & sample rate

The result begins as a direct copy of the selected Sound. Every Formula preserves the existing channel rows and applies the same freeze timing and gain law independently to each channel.

Stereo and multichannel spatial relationships are retained because there is no mono conversion. The same freeze positions and loop timing are applied across all channels.

Final peak scaling

After all freeze points have been processed, the script measures the Sinc70 absolute extremum. For a non-silent result it applies:

Scale peak: Scale_peak

This is target peak normalization. With the default value, the final non-silent result is scaled to a Sinc70 peak of 0.91.

Digital silence is left unchanged. The public form requires Scale_peak to be positive but does not impose an upper limit of 1.

Visualization

The v0.6.1 Picture view contains three main data regions plus a summary line:

  1. Original waveform — selected source Sound.
  2. Glitched waveform — processed result, with rose background bands marking successfully applied freeze zones and vertical lines marking their starts.
  3. Freeze-position map — one horizontal bar per requested freeze index, showing the source-time position and duration of each applied freeze.
  4. Summary — applied/requested freeze count, artifact amplitude and repeat divisor.

Shared waveform scale

Original and Glitched use one amplitude scale derived from the larger Sinc70 peak, with 5% display headroom. Their displayed waveform heights are therefore directly comparable.

Freeze-position map

The x-axis is source time. Each bar begins at the actual stored freeze position and extends for the actual freeze duration. Skipped freeze points have no bar.

Bar color intensity varies with the freeze length relative to the requested factor range; it does not encode amplitude or RMS.

Output behavior

The Info window reports the requested freeze count, each applied or skipped point, its source position and duration, and the final applied-point count.