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.
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:
- Validity-aware FormantPath analysis — unreliable formant frames are rejected rather than replaced with a canonical vowel.
- Dynamic PCA dimensionality — formant dimensions are used only when enough reliable landmarks exist.
- Constant-dimension removal — features with no temporal variation are excluded before PCA.
- Continuous full-file control — smoothed PC trajectories drive three IntensityTier gain curves.
- Three-band dynamic EQ — low, mid, and high bands receive independent time-varying gains.
- Exact complement residual — spectral content outside the modulated bands and filter residuals are preserved.
- Channel preservation — analysis may be mono, but filtering and rendering operate on the original multichannel Sound.
- True bypass — Pca_strength = 0 returns an exact copy without analysis, channel conversion, or output-level processing.
Quick start
- Select exactly one Sound object.
- Run
PCA_Tone_Shaper.praat. - Choose Manual or one of the five built-in presets.
- Set Control_smoothing_ms to control how quickly the PCA-derived EQ gains evolve.
- Set Pca_strength and Depth_dB to control modulation depth.
- Set the two crossover frequencies and High_band_top_hz.
- Choose an Output_level_mode.
- Enable Draw_visualization to inspect the PCA controls and gain trajectories.
- 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.
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:
- F1, F2, and F3 must all be defined.
- The three bandwidths must all be defined.
- F1 < F2 < F3.
- F3 must remain below Nyquist.
- Adjacent formant gaps must each be at least 70 Hz.
- F3 − F1 must be at least 450 Hz or 1.5 × F0, whichever is larger.
- Each formant bandwidth must be at least 15 Hz.
How are invalid spans handled?
If enough reliable formant landmarks exist, invalid gaps are reconstructed only from the source's own valid measurements:
- interior gaps are linearly interpolated,
- leading gaps hold the first valid value,
- trailing gaps hold the last valid value.
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:
- subtract its temporal mean,
- divide by 2.5 × its temporal standard deviation,
- clamp to −1…+1,
- zero any PC carrying less than 2% of the variance among PC1–PC3,
- apply forward and backward smoothing,
- 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
| Preset | Pca_strength | Crossover 1 | Crossover 2 |
|---|---|---|---|
| Manual | User value | User value | User value |
| Low crossover | 0.8 | 200 Hz | 2000 Hz |
| Wide band | 0.8 | 150 Hz | 3000 Hz |
| Mid focused | 0.8 | 300 Hz | 1800 Hz |
| Gentle | 0.4 | 200 Hz | 2000 Hz |
| Strong | 1.4 | 200 Hz | 2000 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
| Name | Type | Default | Description |
|---|---|---|---|
| Preset | option | Manual | Manual or one of five built-in strength/crossover configurations. |
| Control_smoothing_ms | positive | 200 | Timescale used to smooth the PCA control trajectories. |
| Frame_step_seconds | positive | 0.01 | Pitch/HNR analysis time step. |
| Pca_strength | real | 1.0 | Clamped to 0–1.5. A value of 0 activates exact bypass. |
| Depth_dB | positive | 9 | Base EQ modulation depth before multiplication by Pca_strength. |
| Low_hi_crossover1_hz | positive | 200 | Boundary between low and mid bands. |
| Low_hi_crossover2_hz | positive | 2000 | Boundary between mid and high bands. |
| High_band_top_hz | positive | 8000 | Upper edge of the modulated high band; automatically constrained below Nyquist. |
| Max_formant_hz | positive | 5500 | Upper region requested for FormantPath analysis, further limited by sample rate. |
| N_formants | integer | 5 | FormantPath model size; values below 3 are raised to 3. |
| F0_min | positive | 75 | Lower pitch-analysis bound. |
| F0_max | positive | 600 | Upper pitch-analysis bound, constrained by Nyquist. |
| Output_level_mode | option | Conditional limiter | Preserve gain, conditional limiter, or normalize to headroom. |
| Headroom | positive | 0.97 | Target peak used by limiting/normalization modes; invalid values reset to 0.97. |
| Draw_visualization | boolean | 1 | Draw PCA controls, gain trajectories, output waveform, and summary. |
| Play_result | boolean | 1 | Play the returned output. |
Output Level
| Mode | Behavior |
|---|---|
| Preserve gain | No peak scaling is applied. |
| Conditional limiter | Default. Scale to Headroom only if the output peak exceeds Headroom. |
| Normalize to headroom | Always scale the output peak to Headroom. |
Visualization
When Draw_visualization is enabled, the script draws:
- PCA Control Trajectories — smoothed, normalized PC1/PC2/PC3 controls.
- Dynamic EQ Gains — low, mid, and high gain trajectories in dB.
- Processed Output — waveform display; a mono copy is used only for drawing when the real output is multichannel.
- Summary strip — input channel count, formant-valid percentage, formant-PCA state, control smoothing, frame step, crossover frequencies, high-band top, level mode, and final peak.
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]