Non-Linear Frequency Folding — User Guide
Whole-file FFT spectral reflection with three phase characters, frequency-domain gain modulation, and optional stereo decorrelation.
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.
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.
How the fold and phase modes work
The fold map changes where spectral information comes from. A second operation multiplies the folded bins by:
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
| Mode | What is relocated | Time 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 phase | Folded 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 bins | The 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
- Select exactly one Sound.
- Run
Non-Linear_Frequency_Folding.praat. - Start with Subtle Fold or Loose Knots.
- Keep the default spectral inversion mode for forward-time behaviour.
- Lower Folding_period for denser, more frequent spectral reflections.
- Raise Low_freq_threshold when you want the low spectrum to remain untouched by the fold.
- 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.
| Preset | Changed values | Character |
|---|---|---|
| Custom | No override | Uses the form exactly as entered. |
| Tight Knots | Folding period = 500 Hz | More frequent reflection cells. |
| Loose Knots | Folding period = 2000 Hz | Broader reflection regions. |
| High Preservation | Low-frequency threshold = 500 Hz | Leaves a larger low-frequency region unchanged. |
| Fast Modulation | Sine divisor = 150; cosine divisor = 75 | Denser spectral gain variation. |
| Metallic | Period = 300 Hz; sine/cosine divisors = 100/50 | Very dense fold and gain structure. |
| Subtle Fold | Period = 1500 Hz; threshold = 300 Hz; divisors = 500/250 | Wider folds with gentler spectral modulation. |
Controls
| Control | Default | Meaning |
|---|---|---|
| Fold_phase | Spectral inversion | Selects how reflected spectral content receives phase. |
| Fast_fourier | On | Uses 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_threshold | 100 Hz | Bins below this frequency are left as identity. Valid range: 0…source Nyquist. |
| Folding_period | 1000 Hz | Controls the cell scale used by the reflection law. |
| Sine_modulation_divisor / Cosine_modulation_divisor | 300 / 150 | Set the frequency scale of the squared sine/cosine gain pattern. |
| Output_channels | Match input | Match input, mono, or stereo (wide). “Match input” is limited internally to at most two output channels. |
| Stereo_width | 0.6 | 0 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_peak | 0.88 | Final target peak for every result. |
Processing pipeline
- Resolve the requested output channel count.
- 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.
- Transform the complete working signal to a complex Spectrum at the original sample rate.
- Freeze a copy of that spectrum.
- 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.
- Inverse-transform, remove FFT padding by extracting exactly the source duration, and recombine stereo channels when required.
- Target-normalize the final result to
Scale_peak.
Channels, duration and level
- Sample rate: preserved; processing is always performed at the source rate.
- Duration: preserved exactly after inverse FFT.
- Mono output: multichannel input is mixed to mono before folding.
- Stereo output: a mono source is folded twice with opposite modulation offsets. A stereo or multichannel source uses channels 1 and 2 independently.
- Match input: mono stays mono; stereo stays stereo; 3+ channel input is limited to two output channels.
- Level: every result is target-normalized to
Scale_peak. Even frequencies below the fold threshold therefore participate in the final global level change.
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.