Full-Wave Rectifier (ABS) — User Guide
Sample-by-sample full-wave rectification with optional DC removal, output-level control, spectrum comparison, and diagnostic visualization.
What this does
The processor applies the absolute-value function to every sample of every input channel:
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.
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
- Select exactly one Sound object in Praat.
- Choose Target 0.95, Target 0.80, Target 1.00, or Custom.
- Choose whether to keep the raw rectified DC component or apply Remove final mean.
- Choose Preserve shaped level, conditional attenuation, or normalization.
- Optionally enable Show_spectrum and choose its reference mode.
- Run the script. The result is created as
<source>_rectified_<preset>.
Processing pipeline
↓
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
| Mode | Behavior | Implication |
|---|---|---|
| Raw rectification | Keeps 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 mean | Praat 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
| Mode | Behavior |
|---|---|
| Preserve shaped level | No peak scaling. If the peak exceeds 1.0, the Info window warns about playback/export clipping. |
| Attenuate to target only if peak > target | If 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 target | Any 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.
| Preset | Target_peak | Output name component |
|---|---|---|
| Target 0.95 | 0.95 | Target095 |
| Target 0.80 | 0.80 | Target080 |
| Target 1.00 | 1.00 | Target100 |
| Custom | Uses the form value | Custom |
Parameters
| Parameter | Default | Description |
|---|---|---|
| Preset | Target 0.95 | Selects a peak target or Custom. |
| Dc_handling | Raw rectification | Keep the positive mean created by abs(), or subtract the final mean. |
| Output_level | Normalize to target | Preserve, conditionally attenuate, or normalize the shaped result. |
| Target_peak | 0.95 | Peak target used only by attenuation and normalization. |
| Show_spectrum | Off | Computes and displays an original-versus-rectified spectrum comparison. This adds analysis time. |
| Spectrum_reference | Match levels | Controls whether the spectrum comparison isolates spectral change or preserves the run's rendered level relationship. |
| Draw_visualization | On | Draw the suite-standard diagnostic page. |
| Play_result | On | Play 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.
| Reference | What is compared |
|---|---|
| Match levels | The 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 levels | The 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:
| Panel | Contents |
|---|---|
| A — Transfer | The 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 summary | Spectrum comparison when Show_spectrum is on; otherwise an operation/parameter report with output peak, channels, duration, and the conditional spectral interpretation. |
| C — 20 ms zoom | Original 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 waveform | Full-file output. Mono is drawn directly; for multichannel output the first two channels are shown. Additional channels are preserved but not drawn. |
| E — Summary | Preset, 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_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
- Raw output is unipolar. For typical bipolar material,
abs()introduces a substantial positive mean. Use Remove final mean when that DC component is undesirable. - Frequency doubling is conditional. It is exact for the half-wave-symmetric periodic case, not for arbitrary recordings.
- Rectification is nonlinear. Complex sources can generate harmonics and intermodulation products, including energy above Nyquist that may alias. The script does not oversample or apply an anti-aliasing stage around the nonlinear transform.
- Normalization changes level, not the waveshaping law. It can make a quiet source much louder; use Preserve or conditional attenuation when retaining source-relative level matters.
- No dry/wet mix is built in. Parallel blending, filtering, or subsequent dynamics processing must be done separately.
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.