Full-Wave Rectifier (ABS) — User Guide

Sample-by-sample full-wave rectification with optional DC removal, output-level control, spectrum comparison, and diagnostic visualization.

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

What this does

The processor applies the absolute-value function to every sample of every input channel:

y = |x|

x >= 0 → y = x
x < 0 → y = -x

Negative excursions are reflected above zero while positive excursions are retained. The core waveshaping is always the same; the presets change only the Target_peak value used by the attenuation or normalization stage.

Spectral interpretation: for a symmetric periodic input satisfying x(t + T/2) = -x(t), full-wave rectification makes the waveform repeat twice per original period, producing a DC component plus strong even harmonics such as 2f, 4f, and 6f. This is not a universal “octave doubler”: already-positive material is unchanged by abs(), DC-offset or asymmetric signals do not follow the textbook half-wave-symmetric case, and complex material can produce broader nonlinear and intermodulation products.

Quick start

  1. Select exactly one Sound object in Praat.
  2. Choose Target 0.95, Target 0.80, Target 1.00, or Custom.
  3. Choose whether to keep the raw rectified DC component or apply Remove final mean.
  4. Choose Preserve shaped level, conditional attenuation, or normalization.
  5. Optionally enable Show_spectrum and choose its reference mode.
  6. Run the script. The result is created as <source>_rectified_<preset>.
Important: under Preserve shaped level, the preset target is not used. Target 0.95, 0.80, and 1.00 therefore produce identical audio in Preserve mode; only the output object name differs.

Processing pipeline

Input Sound (all channels preserved)

ABS: y = |x|

DC handling: raw / subtract final mean

Output level: preserve / attenuate / normalize

Output Sound

1. Full-wave rectification

The script copies the selected Sound and runs Formula: ~ abs(self). Channel count and duration are preserved; the operation is applied sample by sample across the Sound.

2. DC handling

ModeBehaviorImplication
Raw rectificationKeeps the direct |x| result.A non-silent bipolar source normally acquires a positive mean (DC component). This is part of literal full-wave rectification.
Remove final meanPraat Subtract mean is applied after abs().The final result is centered around zero. The effective displayed transfer is source-dependent because the amount subtracted is the measured mean of the rectified Sound.

For a sine wave with peak amplitude A, the raw rectified mean is 2A/pi, about 63.7% of A. Removing that mean does not restore the negative half-cycle; it recenters the already-rectified waveform.

3. Output level

ModeBehavior
Preserve shaped levelNo peak scaling. If the peak exceeds 1.0, the Info window warns about playback/export clipping.
Attenuate to target only if peak > targetIf the shaped peak is above Target_peak, the whole Sound is globally scaled down to the target. If it is already at or below the target, nothing changes. This is attenuation, not a dynamics limiter.
Normalize to targetAny non-silent result is globally peak-normalized to Target_peak. A silent result is left silent and scaling is skipped.

Presets

The three factory presets do not change the rectification function, DC mode, spectrum mode, or output-level mode. They set only Target_peak.

PresetTarget_peakOutput name component
Target 0.950.95Target095
Target 0.800.80Target080
Target 1.001.00Target100
CustomUses the form valueCustom
Target_peak validation: the field is positive and, whenever attenuation or normalization uses it, the script requires it to be no greater than 1.0. In Preserve mode it is ignored.

Parameters

ParameterDefaultDescription
PresetTarget 0.95Selects a peak target or Custom.
Dc_handlingRaw rectificationKeep the positive mean created by abs(), or subtract the final mean.
Output_levelNormalize to targetPreserve, conditionally attenuate, or normalize the shaped result.
Target_peak0.95Peak target used only by attenuation and normalization.
Show_spectrumOffComputes and displays an original-versus-rectified spectrum comparison. This adds analysis time.
Spectrum_referenceMatch levelsControls whether the spectrum comparison isolates spectral change or preserves the run's rendered level relationship.
Draw_visualizationOnDraw the suite-standard diagnostic page.
Play_resultOnPlay the resulting Sound when processing finishes.

Spectrum comparison

Show_spectrum is off by default. When enabled, the script converts both comparison signals to mono for analysis and draws their spectra up to the lower of Nyquist and 5 kHz.

ReferenceWhat is compared
Match levelsThe original and pre-output-stage rectified signals are each peak-scaled to 0.95 before spectrum analysis. This suppresses simple global gain differences so the panel emphasizes spectral redistribution caused by rectification/DC handling.
Absolute levelsThe original retains its source level; the rectified comparison carries the actual level scaling of the current render. This shows the level relationship as rendered as well as the spectral change.

The spectrum is diagnostic, not a promise of a fixed harmonic series. The exact result depends on the source waveform.

Visualization

The 8 × 8 Picture page is designed to show the transformation directly:

PanelContents
A — TransferThe rectification curve. Raw mode shows the V-shaped |x| mapping; mean removal shifts the displayed curve by the measured rectified mean. If peak scaling occurred, the curve also includes that run's level scale.
B — Spectrum / Operation summarySpectrum comparison when Show_spectrum is on; otherwise an operation/parameter report with output peak, channels, duration, and the conditional spectral interpretation.
C — 20 ms zoomOriginal in gray and final rectified result in green, showing negative excursions reflected upward. The Sound's real time domain is respected even when it does not start at 0 s.
D — Output waveformFull-file output. Mono is drawn directly; for multichannel output the first two channels are shown. Additional channels are preserved but not drawn.
E — SummaryPreset, level stage, DC handling, channel count, spectrum status, conditional spectral summary, duration, and measured output peak.

Channels, timing, and output

The selected Sound is copied and processed without collapsing its channel count. Every channel is rectified, and the output retains the original Sound's duration and time domain. The visualization shows at most the first two output channels, but the remaining channels are preserved.

Output naming is:

<original-name>_rectified_Target095
<original-name>_rectified_Target080
<original-name>_rectified_Target100
<original-name>_rectified_Custom

The original Sound remains in the Objects list; processing is performed on the copy.

Interpretation and limitations

Applications

Full-wave rectification can be useful as an intentionally strong nonlinear transformation for percussion, bass attacks, synthetic material, or experimental sound design. On sustained pitched or harmonically dense material it can substantially alter pitch cues and timbre, so the result should be judged by ear rather than treated as a general-purpose enhancement.

Practical workflow: if the raw DC component is part of the desired effect, keep Raw rectification. If you want the rectified timbre without a persistent positive mean, choose Remove final mean. Use Match levels in the spectrum panel when you want to inspect harmonic redistribution without confusing it with global gain changes.