PCA Tone Shaper – User Guide

Applies dynamic spectral shaping by using Principal Component Analysis to derive time-varying equalization curves from acoustic features, processing audio in chunks with adaptive three-band filtering.

Category: Synthesis / Processing Praat Script: PCA_Tone_Shaper.praat
Contents:

What this does

This Praat script implements an intelligent tone shaping system that uses Principal Component Analysis to create adaptive spectral equalization based on the evolving acoustic characteristics of the audio. The script first extracts eight acoustic features per analysis frame: the first three formants (F1, F2, F3), formant ratios (F2/F1 and F3/F2), fundamental frequency (F0), intensity, and harmonics-to-noise ratio (HNR). These features are standardized into z-scores and projected into a three-dimensional principal component space, where the components typically capture information about spectral tilt, presence/harmonicity, and body/low-end characteristics. For each processing chunk (user-defined duration, default 200ms), the script computes the mean values of the first three principal components and maps these to gain values for three frequency bands: low (0–200 Hz), mid (200–2000 Hz), and high (2000–8000 Hz). The audio is split into these bands using Hann-windowed spectral filtering, each band is scaled by its computed gain factor (constrained between 0.5× and 1.5×), and the bands are recombined to produce a dynamically equalized output where the tonal balance evolves in response to the timbral content, creating an adaptive tone shaping effect that emphasizes different spectral regions based on the acoustic character of each moment in the audio.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…PCA_Tone_Shaper.praat.
  3. Set chunk duration (default 200ms) to control temporal resolution of adaptive equalization.
  4. Adjust PCA strength (default 0.8) to control the intensity of the tone shaping effect.
  5. Customize frequency band crossover points if needed (defaults: 200 Hz and 2000 Hz).
  6. Configure analysis parameters (formant analysis, pitch range) as appropriate for your audio.
  7. Enable play_result if you want to hear the output immediately.
  8. Click OK.
  9. The output object, named [OriginalName]_PCATone, is created alongside the original sound.

Parameters (form fields)

Name (GUI)TypeDefaultDescription
chunk_mspositive200Duration in milliseconds of each processing chunk. Smaller values create more temporally detailed tone shaping; larger values produce smoother, more stable equalization curves.
frame_step_secondspositive0.01Time step in seconds between consecutive analysis frames (10ms default).
max_formant_hzpositive5500Maximum formant frequency in Hz for formant analysis (adjust based on voice type or instrument range).
n_formantsinteger5Number of formants to track during analysis (first three are used as features).
f0_minpositive75Minimum fundamental frequency (Hz) for pitch analysis.
f0_maxpositive600Maximum fundamental frequency (Hz) for pitch analysis.
pca_strengthpositive0.8Overall scaling factor (0.0–1.5) controlling how strongly PCA-derived parameters influence band gains. Higher values create more dramatic tone shaping.
low_hi_crossover1_hzpositive200Crossover frequency in Hz between low and mid bands. Defines the upper boundary of the low-frequency band.
low_hi_crossover2_hzpositive2000Crossover frequency in Hz between mid and high bands. Defines the transition from midrange to high frequencies.
high_band_top_hzpositive8000Upper frequency limit in Hz for the high band (must be below Nyquist frequency).
headroompositive0.97Peak amplitude scaling factor (0.0–1.0) applied to final output to prevent clipping.
play_resultboolean0 (false)If enabled (1), automatically plays the processed audio after completion.

Outputs