Non-Linear Frequency Folding — User Guide

Whole-file FFT spectral reflection with three phase characters, frequency-domain gain modulation, and optional stereo decorrelation.

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

What this does

Non-Linear Frequency Folding transforms the entire sound in the frequency domain. Frequencies below a user-defined threshold are left in place; frequencies at and above the threshold are read from new FFT-bin locations according to a discontinuous reflection map, then multiplied by a frequency-dependent sine/cosine gain pattern. The result is a deliberately knotted spectral texture rather than a conventional filter or pitch shifter.

folded_frequency(f) = | f − 2 · round(f / P) · P | for f ≥ Low_freq_threshold P = Folding_period

The mapping is evaluated in hertz, not in raw FFT-column numbers. Each output bin therefore reads spectral information from the frequency returned by this map. A frozen copy of the source spectrum is used, so the fold never reads bins that have already been rewritten during the same pass.

Important terminology: this is spectral frequency folding, not the amplitude-domain wavefolding used in analog synthesizers. Analog wavefolders bend a waveform when its amplitude crosses nonlinear thresholds; this script explicitly remaps locations on the frequency axis.

How the fold and phase modes work

The fold map changes where spectral information comes from. A second operation multiplies the folded bins by:

( sin(f / S + φ) + cos(f / C + φ) )² S = Sine_modulation_divisor C = Cosine_modulation_divisor φ = channel-dependent phase offset when stereo output is used

This squared pattern adds a comb-like spectral weighting. Because the sine and cosine terms can use different divisors, it should not be read as one simple evenly-spaced comb.

Fold phase

ModeWhat is relocatedTime character
Spectral inversion (conjugated bins; forward time)The reflected complex bin is conjugated before use.Default. The reflected band keeps its forward-time envelope while its spectrum is inverted.
Legacy magnitude on destination phaseFolded magnitude is placed on the phase already present at the destination bin.Retains the v0.5 hybrid texture; it is not a literal complex spectral reflection.
Complex binsThe reflected real and imaginary components are copied literally.Reflected bands acquire the characteristic time-reversed-band behaviour of literal complex reflection.

For the two complex modes, a real-signal Nyquist bin is kept real when present.

Quick start

  1. Select exactly one Sound.
  2. Run Non-Linear_Frequency_Folding.praat.
  3. Start with Subtle Fold or Loose Knots.
  4. Keep the default spectral inversion mode for forward-time behaviour.
  5. Lower Folding_period for denser, more frequent spectral reflections.
  6. Raise Low_freq_threshold when you want the low spectrum to remain untouched by the fold.
  7. Choose the desired channel topology and run the processor.

Presets

Presets override only the parameters shown below. All other form settings — including phase mode, FFT mode, output channels, stereo width and output peak — remain at the values currently visible in the form.

PresetChanged valuesCharacter
CustomNo overrideUses the form exactly as entered.
Tight KnotsFolding period = 500 HzMore frequent reflection cells.
Loose KnotsFolding period = 2000 HzBroader reflection regions.
High PreservationLow-frequency threshold = 500 HzLeaves a larger low-frequency region unchanged.
Fast ModulationSine divisor = 150; cosine divisor = 75Denser spectral gain variation.
MetallicPeriod = 300 Hz; sine/cosine divisors = 100/50Very dense fold and gain structure.
Subtle FoldPeriod = 1500 Hz; threshold = 300 Hz; divisors = 500/250Wider folds with gentler spectral modulation.

Controls

ControlDefaultMeaning
Fold_phaseSpectral inversionSelects how reflected spectral content receives phase.
Fast_fourierOnUses Praat's zero-padded fast-spectrum path. Off requests exact-length FFT behaviour. This can change the spectral-bin grid and therefore the texture.
Low_freq_threshold100 HzBins below this frequency are left as identity. Valid range: 0…source Nyquist.
Folding_period1000 HzControls the cell scale used by the reflection law.
Sine_modulation_divisor / Cosine_modulation_divisor300 / 150Set the frequency scale of the squared sine/cosine gain pattern.
Output_channelsMatch inputMatch input, mono, or stereo (wide). “Match input” is limited internally to at most two output channels.
Stereo_width0.60 gives the same modulation-comb phase in L/R; 1 gives ±π/4 offsets. The two combs become decorrelated but are not point-by-point complements.
Scale_peak0.88Final target peak for every result.

Processing pipeline

  1. Resolve the requested output channel count.
  2. For stereo output from a multichannel source, use source channels 1 and 2 independently. For mono output, or mono processing of a multichannel source, convert the source to mono.
  3. Transform the complete working signal to a complex Spectrum at the original sample rate.
  4. Freeze a copy of that spectrum.
  5. Below the threshold, keep the destination bin unchanged. Above it, read from the reflected frequency in the frozen spectrum, apply the selected phase rule, and multiply by the sine/cosine spectral gain law.
  6. Inverse-transform, remove FFT padding by extracting exactly the source duration, and recombine stereo channels when required.
  7. Target-normalize the final result to Scale_peak.

Channels, duration and level

Output name: <source>_freqFold_<preset>.

Visualization

The diagnostic view contains source and folded waveforms, source/output spectrograms, the actual discontinuous frequency-reflection map and a summary panel. The map deliberately breaks the drawn line when round(f/P) changes so that discontinuities are not falsely visualized as continuous sweeps. The displayed processed spectrogram uses channel 1 when the result is stereo.

Technological and compositional context

The word folding has a different history in analog synthesis. Classic wavefolders associated with the West Coast synthesis tradition are nonlinear amplitude-domain waveshapers: portions of a waveform are folded back when they exceed circuit thresholds, creating new harmonics. This processor does something fundamentally different. It starts with an FFT and reflects spectral locations, so its closest musical family is frequency-domain spectral transformation rather than analog waveshaping.

Compositionally, the fold map is useful because it preserves a deterministic relationship between input frequency and destination frequency while breaking ordinary harmonic ordering. Harmonic material can therefore become metallic or “knotted,” while broadband material exposes the discontinuous map as a more continuous spectral texture. The three phase modes add a second compositional dimension: forward-time inversion, legacy hybrid phase, or literal reflected complex bands with reversed-band character.

Further reading

Esqueda, F., Pöntynen, H., Parker, J. D., & Bilbao, S. (2017). “Virtual Analog Models of the Lockhart and Serge Wavefolders.” Applied Sciences, 7(12), 1328. This is useful specifically for understanding the different amplitude-domain meaning of wavefolding in analog synthesis.