Autocorrelation-Based Self-Filtering — User Guide
A time-varying self-filter that derives a short color kernel from each frame's autocorrelation, removes the zero-lag impulse, and convolves the frame with the remaining correlation pattern. The processed signal can be blended with the dry source, level-matched, and optionally widened through small channel-dependent lag differences.
What this does
The filter listens to the short-term repetition pattern inside the source and turns that pattern into a changing convolution kernel. Periodic or strongly structured material can therefore produce pronounced resonant coloration, while less correlated material produces a different, often subtler response. The kernel is recalculated for every overlapping frame, so the filtering follows changes in the source over time.
Autocorrelation compares a frame with time-shifted copies of itself. Repeated structures appear as peaks at corresponding time lags. The script keeps a short region around zero lag, removes the large zero-lag sample itself, normalizes the remaining color tail, and uses that tail as the convolution kernel. The original signal is added separately through the Dry/Wet control.
The result is not a fixed EQ curve and there is no explicit pitch detector. The filter kernel comes directly from each frame's autocorrelation and changes with the source.
Quick start
- In Praat, select exactly one Sound object.
- Run
Autocorrelation-Based_Self-Filtering.praat. - Choose a preset, or leave Manual selected and set the four processing controls yourself.
- Use Dry_wet_mix to decide how much of the self-filtered signal is heard.
- Leave Match_RMS_to_input enabled for automatic level alignment, or disable it when level change is part of the intended effect.
- Enable Spatial_stereo_widening if you want the channel-dependent lag variation described below.
- Click OK. The result is created as
<source>_autocorr_<preset>.
Presets
Presets override only Window_duration, Max_lag, Resonance_gain, and Dry_wet_mix. Stereo widening, RMS matching, peak normalization, visualization, and playback keep the values shown in the form.
| Preset | Window | Max lag | Resonance gain | Dry/Wet |
|---|---|---|---|---|
| Manual | form value | form value | form value | form value |
| Tight/Metallic | 100 ms | 8 ms | 1.30 | 55% |
| Medium/Resonant | 150 ms | 20 ms | 1.15 | 55% |
| Loose/Ambient | 250 ms | 50 ms | 0.95 | 50% |
| Extreme Resonance | 200 ms | 80 ms | 2.20 | 70% |
| Subtle Enhancement | 120 ms | 15 ms | 0.60 | 40% |
Controls
| Control | Default | What it changes |
|---|---|---|
| Preset | Manual | Selects one of the parameter sets above. Manual leaves the four processing values untouched. |
| Window_duration | 0.15 s | Length of each local analysis/processing frame. The hop is always half this value, giving 50% frame spacing. Values below 0.04 s are raised to 0.04 s. |
| Max_lag | 0.02 s | Half-width of the autocorrelation region retained around zero lag. If it exceeds half the window duration, it is clamped to that limit. |
| Resonance_gain | 1.15 | Scales the normalized autocorrelation color tail before convolution. Higher values strengthen the wet self-filtering contribution before the Dry/Wet blend. |
| Dry_wet_mix | 0.55 | Linear amplitude blend: 0 = dry input, 1 = wet convolution result. Values outside 0–1 are rejected. |
| Spatial_stereo_widening | On | Introduces a small lag difference between left and right processing for mono or stereo input. See Channels & stereo widening. |
| Match_RMS_to_input | On | Adjusts the result toward the input RMS after recombination. Upward gain is limited by Max_makeup_gain_dB; downward matching is not limited by that ceiling. |
| Max_makeup_gain_dB | 6.0 dB | Maximum positive gain that RMS matching may add when the processed result is quieter than the input. |
| Peak_normalize_output | Off | If enabled, performs final target peak normalization after RMS matching. |
| Scale_peak | 0.95 | Target peak used only when Peak_normalize_output is enabled. Values above 1.0 are rejected. |
| Play_after_processing | On | Auditions the result after processing. A separate playback-only safety rule is used if the stored result exceeds 1.0 peak. |
| Draw_visualization | On | Draws original/output waveforms, one example autocorrelation color kernel, and a parameter summary. |
How the sound is processed
source channel → padded copy → overlapping Hanning frames → remove frame DC → autocorrelation → keep ±Max_lag → remove zero-lag sample → spectral-peak normalize the color tail → apply Resonance_gain → convolve the frame → Hanning trim → normalized overlap-add → exact-duration trim → linear Dry/Wet blend
Frame reconstruction
The frame hop is fixed at Window_duration / 2. The source frame and the center-trimmed convolution result both receive Hanning shaping. Processed frames are accumulated into a wet buffer, while a matching window-weight buffer is accumulated in parallel. Dividing by that weight buffer performs normalized overlap-add rather than simple concatenation.
The autocorrelation color kernel
For every frame, the script computes Praat's autocorrelation using sum amplitude scaling with zero outside the time domain. It extracts the region from −Max_lag to +Max_lag and applies a Hanning window. Because extraction is performed with Preserve times off, that extracted object has local times from 0 to 2×Max_lag; the original lag-0 point is therefore at local time Max_lag. That center sample is set to zero before normalization.
The remaining tail is converted to a spectrum, its largest magnitude is measured, and the tail is divided by that spectral peak multiplied by the sample rate. Resonance_gain then scales the normalized kernel before convolution.
Channels & stereo widening
| Input | Spatial widening | Output behavior |
|---|---|---|
| Mono | On | Creates stereo. Left uses Max_lag; right uses 1.12× Max_lag, capped at half the window duration. |
| Stereo | On | Left and right source channels are processed independently. Left uses Max_lag; right uses 1.08× Max_lag, capped at half the window duration. |
| Mono or multichannel | Off | Each input channel is processed independently with the same Max_lag. Channel count is preserved. |
| More than 2 channels | On | The widening branch is not used; all channels are processed independently with the same Max_lag and the original channel count is preserved. |
Sample rate and nominal duration are preserved. Processing is performed on a work copy shifted to start at 0; the output is shifted back to the source's original start time after recombination.
Output level & safety
RMS matching
With Match_RMS_to_input enabled, the script compares the raw output RMS with the input RMS. If the result is quieter, positive makeup gain is limited to Max_makeup_gain_dB. If the result is louder, the script can attenuate it by the full amount required for RMS matching.
Peak normalization
Peak_normalize_output is off by default. When enabled, Scale peak performs target peak normalization to Scale_peak after RMS matching. Because it runs last, it can change the RMS relationship established by the preceding RMS-matching stage.
Visualization
The Picture display contains:
- Original waveform with its measured peak.
- Output waveform with its measured peak.
- Example Color Kernel captured from the middle frame of the first processed channel. Its time axis is shifted back to lag coordinates, with zero lag marked by a vertical dotted line.
- Parameter summary showing window duration, Max_lag, Resonance_gain, Dry/Wet mix, applied RMS adjustment, and output channel count.
When stereo widening is active, the example kernel comes from the first processed channel, which uses the unmodified Max_lag value.