Harmonic Formant Locking — User Guide

Spectral-envelope transformation that moves energy from measured formant-landmark regions toward exact harmonics of F0 while preserving the original complex-spectrum phase.

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

What this does

Harmonic Formant Locking uses pitch and formant analysis to reshape the spectral envelope of a selected Sound. The measured formants are treated as robust spectral-envelope landmarks. They do not become LPC resonator poles and the script does not perform LPC resynthesis.

For each reliable landmark, the processor chooses an allowed harmonic number and defines the destination as exactly n × F0. A broad Gaussian-shaped attenuation is placed around the original landmark region and a matching enhancement is placed around the harmonic destination. The same real-valued gain is applied to the real and imaginary spectrum components, so the original complex-spectrum phase is retained.

What “locking” means here

The tool does not literally move an LPC formant track. It redistributes spectral-envelope emphasis from a measured landmark toward an exact harmonic of the current or stable F0. This creates source/filter coupling while keeping the transformation within the original signal’s spectrum rather than rebuilding the voice from a separate excitation and filter model.

Core invariant: every defined target is an integer harmonic of F0. In Dynamic mode the target may change from grain to grain as F0 changes; in Stable-note mode one median F0 is used for the whole file.

Quick start

  1. Select exactly one Sound object in Praat.
  2. Run Harmonic_Formant_Locking.praat.
  3. Start with Safe Start (20%) or Subtle Shimmer (35%).
  4. Use Dynamic F0 / stable formant landmarks for changing pitch, speech, or singing.
  5. Use Stable note for a sustained pitch when you want one fixed spectral curve across the complete sound.
  6. Keep Preserve frame energy enabled unless level change inside the spectral transformation is part of the desired effect.
  7. Leave Safety ceiling selected for a conservative output level.
  8. Enable the visualization to inspect the measured landmarks and harmonic targets.
Best source material: the processor needs both a reliable voiced F0 and a sufficiently broad spectral envelope. Sustained vowels, singing, pitched instruments, and harmonically rich sounds are the most predictable sources. If no reliable F0 or envelope structure can be established, the script stops or returns the input unchanged rather than forcing a transformation.

Processing pipeline

1. Validate input, duration, sample rate and level 2. Make a time-zero work copy 3. Build an analysis source • mono input: use the channel directly • multichannel input: try a mono fold • if the fold nearly cancels: use the loudest real channel instead 4. FormantPath analysis • extract up to 5 formants • reduce each trajectory to median + IQR landmarks • derive a broad processing width for each landmark 5. Pitch analysis • wide first pass estimates an adaptive pitch range • second cross-correlation pass supplies F0 6. Structural confidence check • reject a collapsed/narrow landmark set 7. Build harmonic targets • nearest / upward / downward / octave harmonic • target frequency is always exactly n × F0 8. Shape the original complex spectrum • attenuate around source landmark • enhance around harmonic target • optionally compensate exact frame energy 9. Process every input channel with the same analysis-derived target structure 10. Dry/Wet mix 11. Output-level stage 12. Restore the original start time and rename the result

Formant landmarks

To FormantPath (burg) is used for analysis. For each of up to five formants, the script takes the median frequency and the interquartile range over the file. These statistics define a stable landmark and a broad envelope-region width. The width is constrained by a per-formant floor, a fraction of the landmark frequency, the observed IQR spread, and a 900 Hz cap.

Harmonic target selection

The allowed harmonic ceiling is calculated from F0 and Nyquist for each target, with an additional safety cap of harmonic 64. There is no fixed “maximum harmonic 20” limit. The minimum harmonic is 2.

Nearest: n = round(F_landmark / F0) Upward: n = ceiling(F_landmark / F0) Downward: n = floor(F_landmark / F0) Octave: n = nearest permitted power of two Target frequency = n × F0

Dynamic mode adds harmonic hysteresis so a target does not switch harmonics unnecessarily near a boundary. Octave mode keeps targets on powers of two even when constrained by Nyquist.

Spectral shaping

For each active landmark, the maximum shaping amount is:

shape dB = Max_shape_dB × formant_weight × Lock_strength

The built-in landmark weights are F1 0.60, F2 1.00, F3 1.00, F4 0.80, F5 0.60. A positive Gaussian region is centered at the harmonic target and a corresponding negative region is centered at the original landmark. Overlapping contributions add and the final spectral gain is clamped to ±Max_shape_dB.

Tracking modes

Dynamic F0 / stable formant landmarks

The formant landmarks remain fixed, but F0 is sampled over time. The processor uses approximately 50 updates per second and a 40–80 ms adaptive grain. Each grain receives exact harmonic targets derived from its stabilized F0.

Audio is reconstructed with integer-sample Hann analysis/synthesis and Hann² weighted overlap-add normalization.

Stable note

The median F0 and the robust landmarks define one fixed spectral curve. Each channel is transformed with a single FFT and the same curve is applied across the whole file.

This mode is time-invariant. Gate weak/unvoiced is not used in Stable-note mode.

Dynamic F0 stabilization and gating

With Stabilize F0 enabled, each dynamic F0 estimate is replaced by a small running median of nearby valid estimates. This suppresses isolated tracking errors without averaging the harmonic target frequency itself.

With Gate weak/unvoiced enabled, a dynamic grain must have a valid F0 and sufficient intensity. The threshold is relative to the loudest analyzed grain:

gate threshold = maximum analyzed intensity + Min_intensity_dB Default Min_intensity_dB = -25 dB → grains more than 25 dB below the maximum are not locked.

When a grain is inactive, no spectral-locking curve is applied to that grain.

Presets

PresetLockMax shapeSnapCharacter
CustomForm valueForm valueForm valueUses the controls as entered.
Safe Start20%±6 dBForm valueConservative spectral coupling.
Subtle Shimmer35%±9 dBForm valueModerate harmonic emphasis.
Moderate Bell60%±12 dBForm valueClearly audible harmonic locking.
Strong Metal85%±15 dBForm valueStrong spectral relocation.
Extreme Synth100%±18 dBOctave harmonicMaximum shaping with power-of-two harmonic targets.
Preset override rule: presets change Lock strength and Max shape; Extreme Synth additionally forces Octave harmonic snap. Tracking mode, energy preservation, gating, Dry/Wet, output level, diagnostics, visualization and playback are not preset-overridden.

Parameters

ControlDefaultMeaning
PresetSafe StartLoads the musical strength settings shown above.
Lock strength (%)35Scales how strongly each landmark-region transfer is applied. 0% is a true bypass.
Max shape dB9Maximum positive or negative spectral gain after overlapping landmark contributions are summed.
Tracking modeDynamic F0Chooses dynamic grain-based targets or one fixed stable-note curve.
Snap modeNearest harmonicDefines how the harmonic number is selected.
Preserve frame energyOnApplies exact spectral-energy compensation after shaping. In Stable mode this is whole-file FFT energy; in Dynamic mode it is per processed grain.
Stabilize F0OnSmall running-median stabilization in Dynamic mode. Stable-note mode already uses median F0.
Gate weak/unvoicedOnDynamic mode only. Suppresses locking in grains without valid F0 or below the relative intensity threshold.
Min intensity dB-25Dynamic gate offset relative to the maximum analyzed intensity, not an absolute dBFS threshold.
Dry/Wet mix1.00 = true bypass before analysis; 1 = fully processed. Intermediate values linearly mix processed and original channel samples.
Output level modeSafety ceilingChooses final level handling.
Ceiling peak0.95Peak used by Safety ceiling, RMS+ceiling and Peak normalize.
Show diagnosticsOnAdds target/gating information to the Info window.
Draw visualizationOnDraws the suite-standard diagnostic page.
Play resultOnAuditions the final object. If its peak exceeds 1, playback uses a temporary scaled copy while the stored output remains unchanged.

Output level modes

ModeBehavior
Natural levelNo final gain correction. Peaks above 1 are possible.
Safety ceilingAttenuates only when the processed peak exceeds Ceiling_peak; otherwise leaves level unchanged.
Match input RMS + safety ceilingFirst matches the input RMS, then attenuates if the resulting peak exceeds the ceiling.
Peak normalizeAlways scales a non-zero result so its peak equals Ceiling_peak.

Input & output behavior

Visualization

The visualization is diagnostic; it does not alter the stored audio.

Notes & limitations

This is spectral-envelope landmark locking, not literal formant resynthesis. The FormantPath estimates are analysis landmarks. The output is made by modifying the original complex spectrum; there is no separate excitation, no FormantGrid filtering, and no LPC synthesis stage.

Further Reading