Spectral Morph — User Guide

STFT spectral morphing between two Sounds, with proportional time mapping, two spectral interpolation modes, a controllable morph-frequency band, and weight-normalized overlap-add reconstruction.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 3.2 (2026) Category: Time & Granular License: MIT License Repo: Praat AudioTools
Contents:

What this does

Spectral Morph creates a time-varying spectral transition between two selected Sounds. Each source is analyzed in overlapping short-time frames. The script maps both sources proportionally onto one common output timeline, transforms each frame to a complex spectrum, and blends the spectra according to a morph curve that moves from A toward B.

The transformation can interpolate spectral magnitude while retaining A as the phase reference, or it can interpolate the full complex spectrum. A user-defined frequency limit determines which bins participate in the morph; frequencies above that limit remain from Sound A. The processed frames are reconstructed with periodic sqrt-Hann analysis/synthesis windows and overlap-weight normalization.

Core idea: the morph factor m varies from 0 to 1 over the chosen region. At m=0, the processed spectrum is A. As m increases, bins below Morph max freq move toward B according to the selected morph mode, while higher bins remain A.

Quick start

  1. Select exactly two Sound objects. The first selected Sound is A; the second is B.
  2. Run Spectral_Morph.praat.
  3. Choose a preset or Custom.
  4. Use Start morph and End morph to place the transition on the output timeline. End morph = 0 means the end of the output.
  5. Choose Log magnitude for magnitude morphing with A-reference phase, or Full complex to interpolate real and imaginary spectral values.
  6. Set Morph max freq to define the highest frequency that participates in the morph.
  7. Leave Safety peak = 0.99 for attenuation-only peak protection, or set it to 0 to disable the safety stage.
Good first test: use two similarly timed sounds and the Tonal Sustained or Voice Morph preset. Similar temporal structures make the spectral transition easier to interpret because less proportional time remapping is required.

Processing pipeline

1. Prepare the two sources

Both working copies are shifted internally to start at time 0. Depending on Speed mode, they are resampled to the processing rate. The final output is later restored to Sound A's original sampling rate and start time.

2. Build one common timeline

The output duration is the longer of the two working sources. Each source is mapped proportionally across that duration:

A time = output time × (duration A / output duration)
B time = output time × (duration B / output duration)

This uses the whole duration of both sources. If one source is shorter, its frame centres are sampled more slowly across the longer output timeline.

3. Analyze overlapping frames

The window length is converted to an even number of samples, with a minimum of 64 samples. Hop size is exactly half the window length. Each frame is multiplied by a periodic sqrt-Hann window:

w[n] = sin(π(n + 0.5) / N)

Fixed zero padding around each source guarantees a complete frame at the beginning and end.

4. Morph the spectra

Each windowed frame is converted with To Spectrum: "no", so no additional FFT zero-padding is requested. Bins at or below Morph max freq are transformed according to the chosen morph mode. Higher bins are copied from A.

5. Reconstruct with overlap-add

After inverse transformation, the same sqrt-Hann window is applied again. Frames are added directly to the preallocated output Sound. A separate weight buffer accumulates the effective Hann overlap, and the final output is divided sample-by-sample by that weight. This also corrects the beginning and end of the file, where ordinary 50% overlap is incomplete.

6. Restore output format and apply safety attenuation

If a reduced processing rate was used, the result is resampled back to Sound A's original rate. The output start time is restored to Sound A's xmin. The Safety stage only attenuates when the peak exceeds the chosen limit; it never boosts a quieter result.

Morph modes

Log magnitude (A-reference phase)

Below the morph-frequency limit, magnitudes are interpolated geometrically:

|Y| = |A|^(1-m) × |B|^m

The phase normally follows A. If A is effectively near zero relative to B in a bin, B phase is used as a fallback so the interpolated magnitude can still be represented. At m=0, A is returned exactly. At m=1, the magnitude equals B below the morph limit, while the phase remains A-referenced except where the fallback is used.

Full complex (blend phase too)

Real and imaginary FFT values are linearly interpolated:

Y = (1-m)A + mB

This interpolates magnitude and phase together. At a frame where m=0, the spectrum is A. At m=1, bins below the morph limit are B. Bins above the limit remain A in both modes.

Endpoint identity: exact A/B waveform identity also depends on time mapping and the active frequency limit. With equal source durations, Full-complex processing, and the morph limit reaching Nyquist, an all-A or all-B frame sequence can reconstruct the corresponding source. With unequal durations, each source is first represented on the common proportional timeline.

Presets

Presets override Window, Morph max freq, Speed mode, Morph mode, and Curve type. Morph-region times, Safety peak, visualization, and playback remain user-controlled.

PresetWindowMorph maxProcessing rateModeCurve
CustomUserUserUserUserUser
Tonal Sustained60 ms8000 Hz22050 HzLog magnitudeCosine
Percussive30 ms10000 Hz22050 HzLog magnitudeLinear
Voice Morph50 ms6000 Hz22050 HzLog magnitudeCosine
Texture Blend80 ms12000 HzFullFull complexCosine
Fast Preview120 ms5000 Hz11025 HzLog magnitudeLinear

Parameters

ParameterDefaultWhat it controls
PresetCustomSelects a predefined analysis/morph strategy or leaves all relevant controls manual.
Start_morph_s0Output-relative time at which m begins rising from 0.
End_morph_s0Time at which m reaches 1. A value of 0, or an end not later than the start, resolves to the output end.
Curve_typeCosineLinear ramp, or cosine S-curve 0.5 - 0.5 cos(πu).
Window_ms60Requested STFT window length. Internally clamped to 2–1000 ms, converted to an even sample count, and kept at least 64 samples.
Morph_max_freq_Hz8000Actual DSP boundary. Bins above it remain from A. It is clamped to the processing Nyquist frequency and to at least 20 Hz.
Speed_mode22050 Hz processingFull uses the higher of A and B sample rates; reduced modes process at 22050 or 11025 Hz. Final output always returns to A's sample rate.
Morph_modeLog magnitudeGeometric magnitude interpolation with A-reference phase, or linear interpolation of the complete complex spectrum.
Safety_peak0.99Attenuation-only final peak ceiling. Set 0 to disable. Values are clamped to 0–1.
Draw_visualizationOnDraws the AudioTools diagnostic page. Does not alter the audio path.
Play_outputOnPlays the finished Sound after processing.

Input & output behavior

Required input
Exactly two selected Sound objects.
Output name
A_SpectralMorph_B
Output duration
The longer of the two working source durations.
Output sample rate
Sound A's original sample rate.
Output start time
Sound A's original xmin.
Randomness
None. The same inputs and settings are deterministic.

Channel handling

Level behavior

There is no automatic peak normalization and no forced fade-in/fade-out. With Safety peak enabled, only outputs above the selected ceiling are scaled down. Outputs already below the ceiling retain their natural level.

Reduced-rate processing

The 22050 Hz and 11025 Hz modes intentionally reduce analysis bandwidth and computation. The result is then resampled back to A's sample rate; resampling restores the file rate, not spectral content that was unavailable at the lower processing Nyquist frequency.

Visualization

The v3.2 AudioTools visualization is diagnostic only. It converts multichannel sources to mono copies for drawing while leaving audio processing multichannel.

Interpretation: the spectrograms are visual summaries, not the frames used for synthesis. The actual morph uses the custom sqrt-Hann STFT loop described above.

Notes & limitations