PCA Tone Shaper – User Guide

Validity-aware adaptive three-band equalization driven by smoothed principal-component trajectories derived from acoustic features measured across the full sound.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.0 (2026) Praat Script: PCA_Tone_Shaper.praat
Contents:

What this does

PCA Tone Shaper analyzes one Sound over time, derives up to eight acoustic feature trajectories, standardizes the time-varying dimensions, runs PCA, converts the first three principal components into smooth control signals, maps those controls onto low-, mid-, and high-band gain trajectories, and applies those gains continuously across the full sound.

The audio is not cut into processing chunks. The three fixed frequency bands are filtered once across the entire source. Control_smoothing_ms determines the smoothing timescale of the PCA-derived controls.

Key Features:

Quick start

  1. Select exactly one Sound object.
  2. Run PCA_Tone_Shaper.praat.
  3. Choose Manual or one of the five built-in presets.
  4. Set Control_smoothing_ms to control how quickly the PCA-derived EQ gains evolve.
  5. Set Pca_strength and Depth_dB to control modulation depth.
  6. Set the two crossover frequencies and High_band_top_hz.
  7. Choose an Output_level_mode.
  8. Enable Draw_visualization to inspect the PCA controls and gain trajectories.
  9. Set Pca_strength to 0 when an exact bypass copy is desired.

Analysis Features

Feature analysis is performed on a mono copy when the source has more than one channel. Processing itself still uses the original Sound.

When formant analysis is reliable, the PCA input contains eight dimensions:

F1
F2
F3
F2 / F1
F3 / F2
F0
Intensity
HNR

When reliable formant structure is insufficient, the formant-derived dimensions are removed and PCA uses only three dimensions: F0, Intensity, and HNR.

F0
Intensity
HNR

Every retained feature is standardized as a z-score before PCA. Dimensions whose temporal standard deviation is effectively zero are omitted entirely.

Important: the principal components do not have fixed semantic meanings such as “brightness,” “presence,” or “body.” Their loadings, signs, and ordering depend on the current source.

Formant Validity

What makes a formant frame valid?

The script uses FormantPath/Burg analysis and accepts F1–F3 only when the frame satisfies structural checks:

How are invalid spans handled?

If enough reliable formant landmarks exist, invalid gaps are reconstructed only from the source's own valid measurements:

The script does not insert a fixed canonical vowel template.

Formant features are activated only when at least max(5, ceil(15% of analysis frames)) frames are valid. Otherwise the formant dimensions are removed from the PCA.

PCA Control Generation

How does a principal component become a control signal?

After PCA projection, each of the first three available principal-component trajectories is converted into a bounded control signal:

  1. subtract its temporal mean,
  2. divide by 2.5 × its temporal standard deviation,
  3. clamp to −1…+1,
  4. zero any PC carrying less than 2% of the variance among PC1–PC3,
  5. apply forward and backward smoothing,
  6. renormalize the smoothed control to unit peak magnitude when it is nonzero.

The result is therefore not a raw PCA score. It is a PCA-derived normalized control trajectory.

Control_smoothing_ms

This parameter controls the temporal smoothing scale, not an audio block size. The smoothing coefficient is derived from:

tau = max(dt, Control_smoothing_ms / 1000 / 3)
alpha = dt / (tau + dt)

Smoothing is applied forward and backward, reducing directional lag.

PCA-to-EQ Mapping

How are PCA controls mapped to Low, Mid, and High EQ?

The three normalized control trajectories are combined with fixed coefficients:

Low control  = -0.55 × PC1 + 0.45 × PC3
Mid control  =  0.60 × PC2 - 0.40 × PC3
High control =  0.55 × PC1 + 0.45 × PC2

Each control is then converted to gain in decibels:

Gain_dB =
    Depth_dB
  × Pca_strength
  × mapped_control

The resulting values are capped symmetrically by:

cap_dB = max(6, Depth_dB × 2.5)

This is a fixed control law. Because PCA axes are source-dependent, the same PC-to-band coefficients may respond to different acoustic structures in different sources.

Frequency Bands and Residual

The source is filtered once into three full-length Hann bands:

LOW   0 Hz → crossover 1
MID   crossover 1 → crossover 2
HIGH  crossover 2 → High_band_top_hz

The low, mid, and high bands are multiplied by their respective IntensityTier gain trajectories.

What is the residual band and why is it preserved?

The script also computes an exact complement:

Residual =
    Original
  - Low
  - Mid
  - High

The final result is:

Output =
    modulated Low
  + modulated Mid
  + modulated High
  + unmodified Residual

This guarantees unity reconstruction when the three EQ gains are 0 dB and also preserves content above High_band_top_hz and any complement left by the Hann filters.

Channel behavior

The filters are applied to the original Sound, not to the mono analysis copy. All source channels are therefore preserved, with the same dynamic gain trajectory applied to each channel.

Presets

PresetPca_strengthCrossover 1Crossover 2
ManualUser valueUser valueUser value
Low crossover0.8200 Hz2000 Hz
Wide band0.8150 Hz3000 Hz
Mid focused0.8300 Hz1800 Hz
Gentle0.4200 Hz2000 Hz
Strong1.4200 Hz2000 Hz

Presets change only Pca_strength and the two crossover values. Depth_dB, High_band_top_hz, analysis settings, output-level mode, headroom, visualization, and playback remain user-controlled.

Parameters

NameTypeDefaultDescription
PresetoptionManualManual or one of five built-in strength/crossover configurations.
Control_smoothing_mspositive200Timescale used to smooth the PCA control trajectories.
Frame_step_secondspositive0.01Pitch/HNR analysis time step.
Pca_strengthreal1.0Clamped to 0–1.5. A value of 0 activates exact bypass.
Depth_dBpositive9Base EQ modulation depth before multiplication by Pca_strength.
Low_hi_crossover1_hzpositive200Boundary between low and mid bands.
Low_hi_crossover2_hzpositive2000Boundary between mid and high bands.
High_band_top_hzpositive8000Upper edge of the modulated high band; automatically constrained below Nyquist.
Max_formant_hzpositive5500Upper region requested for FormantPath analysis, further limited by sample rate.
N_formantsinteger5FormantPath model size; values below 3 are raised to 3.
F0_minpositive75Lower pitch-analysis bound.
F0_maxpositive600Upper pitch-analysis bound, constrained by Nyquist.
Output_level_modeoptionConditional limiterPreserve gain, conditional limiter, or normalize to headroom.
Headroompositive0.97Target peak used by limiting/normalization modes; invalid values reset to 0.97.
Draw_visualizationboolean1Draw PCA controls, gain trajectories, output waveform, and summary.
Play_resultboolean1Play the returned output.

Output Level

ModeBehavior
Preserve gainNo peak scaling is applied.
Conditional limiterDefault. Scale to Headroom only if the output peak exceeds Headroom.
Normalize to headroomAlways scale the output peak to Headroom.

Visualization

When Draw_visualization is enabled, the script draws:

How to read the PCA control plot

The curves are the normalized control trajectories after PCA projection, variance gating, clipping, and zero-phase smoothing. They are not raw PCA scores and should not be interpreted as fixed acoustic categories.

How to read the EQ gain plot

The low, mid, and high curves show the actual time-varying dB gains sent to the three IntensityTier modulators. Zero dB is unity gain for that band.

Bypass and Degenerate Cases

Pca_strength = 0

Returns an exact copy named [OriginalName]_PCATone_Bypass. No analysis, channel conversion, or level stage is performed.

No active time-varying dimensions

If every usable feature dimension is constant, the script returns [OriginalName]_PCATone_StaticBypass.

No robust formants + static F0/intensity

If formant analysis is disabled and both F0 and intensity are essentially static, HNR-only numerical motion is rejected and the script returns [OriginalName]_PCATone_NarrowbandBypass.

Normal processed output

When adaptive processing is performed, the result is named:

[OriginalName]_PCATone_[PresetName]