Phase History Swap — User Guide

Self-cross-synthesis that combines the late segment’s spectral magnitude with phase taken from an earlier segment, then creates a related stereo pair.

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

What this does

Phase History Swap divides one mono analysis driver into an early and a late time segment, then constructs a new spectrum whose magnitude comes from the late segment and whose phase comes from the early segment. The reconstructed signal is therefore not a splice of early and late audio; it is a spectral hybrid.

OUTPUT SPECTRUM(f) = magnitude_of_late(f) · exp(j · phase_of_early(mapped f))

The operation is performed twice with slightly different split positions to create a synthetic stereo pair. The left channel uses Split_at_percent; the right uses Split_at_percent + Stereo_offset_percent, clamped to 1…99%.

What is “phase history” here?

In a Fourier spectrum, each frequency bin has a magnitude and a phase. Magnitude describes how much energy is present at that frequency; phase describes the angular relationship needed to reconstruct the waveform in time.

The script uses the word history because the phase donor is taken from an earlier time region of the same recording. It does not track a continuously evolving phase history sample-by-sample. Instead, it analyzes two entire segments separately and combines one segment's spectral phase with the other's magnitude.

Consequence: the early segment is not heard as an early section followed by the late segment. Its role is to supply phase. The audible core duration is based on the late segment, plus any retained inverse-FFT tail.

Quick start

  1. Select exactly one Sound.
  2. Run Phase_History_Swap.praat.
  3. Start with Subtle Swap (50%).
  4. Use Frequency-aligned swap when you want early and late spectra matched by their actual FFT frequency grids.
  5. Move the split earlier for a longer late-magnitude segment; move it later for a shorter, more compressed output core.
  6. Increase stereo offset to make L/R use more different early/late divisions.

Presets

PresetLeft splitStereo offset
CustomForm valueForm value
Subtle Swap50%1.0%
Early Swap30%1.5%
Late Swap70%1.5%
Extreme Early20%2.0%
Extreme Late80%2.0%
Ghost Echo10%3.0%
Time Smear90%2.0%
Wide Stereo50%5.0%
Narrow Focus50%0.5%
Asymmetric40%3.0%

Presets change only split and stereo offset. Phase mapping, tail, fade, scale peak and output switches remain whatever is set in the form.

Phase mapping modes

ModeMappingMeaning
Warped history (v0.3 character)Early phase-bin index is scaled by split_time / late_duration.Preserves the original duration-ratio warp. Frequencies are not matched directly in hertz.
Frequency-aligned swapMaps late bins to early bins using the measured FFT bin widths.Matches the same physical frequency as closely as the two zero-padded FFT grids allow. DC/Nyquist imaginary components are forced to zero.

Controls

ControlDefaultMeaning
Split_at_percent50Left-channel division between early phase donor and late magnitude donor. Must be >0 and <100.
Stereo_offset_percent1.0Added to the right split; 0 is allowed. Final right split is clamped to 1…99%.
Tail_duration_seconds0.5Maximum inverse-FFT tail retained beyond the late segment. The actual retained tail depends on FFT reconstruction and is reported separately for L/R.
Fade_out_seconds0.3Raised-cosine fade to zero at the end. 0 disables it.
Scale_peak0.95Final target peak for non-silent output.

Processing pipeline

  1. Choose one mono analysis driver. Mono input is copied directly; for multichannel input the highest-RMS channel is selected instead of averaging.
  2. For the left channel, split that driver into early and late sections at the requested percentage.
  3. FFT the early section and retain its phase information.
  4. FFT the late section and retain its magnitude.
  5. Map early phase bins according to the selected phase-mapping mode and combine them with late magnitudes.
  6. Inverse-transform the hybrid spectrum. Keep at most late_duration + Tail_duration_seconds.
  7. Repeat the complete process at the offset split to create the right channel.
  8. Pad the shorter reconstructed channel with silence so L/R durations match, combine to stereo, apply the optional end fade, then target-normalize to Scale_peak.

Channels, duration and level

Output name: <source>_phaseswap_<preset>.

Visualization

The figure shows the mono analysis driver and stereo result on one shared amplitude scale, driver/output spectrograms, the source split diagram, the output core plus actual retained FFT tail, and a summary of mapping, split and tail values. Red marks the source split; orange marks the final fade region.

Technological and compositional context

Fourier-domain processing makes it possible to separate two properties that are inseparable in an ordinary waveform display: spectral magnitude and spectral phase. That separation has long been central to spectral analysis, phase-vocoder techniques and experimental cross-synthesis. Phase History Swap applies the idea within one recording: one time region provides spectral energy, another provides phase geometry.

Compositionally, this creates a kind of temporal self-cross-synthesis. The past is not replayed; it acts as a structural template for the later spectrum. Moving the split changes both the donor material and the output duration, while the stereo offset creates two related but non-identical hybridizations. The legacy warped mapping pushes the idea further by deliberately decoupling phase-bin position from exact physical frequency.