Hilbert Audio Processor — Analytic Signal DSP

Hilbert Transform, Envelope Generator, Quadrature Shifter, and Phase Rotator. Native spectral manipulation operating independently on Left and Right channels via the analytic signal.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.2 (2026) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

This script implements Hilbert Transform-based audio processing using the analytic signal. It extracts the real, imaginary, and envelope components of a sound via the Hilbert transform, then applies frequency shifting, phase rotation, or envelope extraction independently to each channel (left/right). The result is a versatile toolkit for single-sideband modulation, pitch shifting without time stretching, quadrature phase effects, and envelope-controlled amplitude processing.

What is the Hilbert Transform? The Hilbert transform produces a 90-degree phase-shifted version of a signal (the imaginary part). Together with the original signal (real part), they form the analytic signal: a complex representation that separates instantaneous amplitude (envelope) from instantaneous phase. This decomposition enables clean frequency shifting (without the mirrored sidebands of ring modulation), envelope extraction, and arbitrary phase rotation — all without FFT-based resynthesis artifacts.

Key Features:

Implementation (Praat-native): The script uses Praat's Spectrum → Hilbert transform via FFT: the spectrum's real and imaginary parts are swapped/negated to create the 90° phase shift, then inverted back to time domain. Frequency shifting uses the quadrature formula: y = real·cos(2πft) - imag·sin(2πft) (up) or + (down). Envelope = sqrt(real² + imag²). Phase rotation = real·cosθ - imag·sinθ. All processing is sample-accurate and uses Praat's native C++ FFT.

Quick start

  1. In Praat, select exactly one Sound object (mono or stereo).
  2. Run script…Hilbert_Audio_Processor.praat.
  3. Choose a preset from the dropdown, or select "Custom".
  4. Set Operation for Left and Right channels independently (No shift / Shift up / Shift down / Envelope only / Phase rotate).
  5. Adjust Shift amount (Hz) or Phase angle (degrees) for each channel.
  6. Enable/disable Antialiasing to prevent frequency wrap-around on up-shifts.
  7. Set Dry/wet mix (0–100% wet).
  8. Click OK — script processes and creates output.
Quick tip: Try Stereo Shift Up (+200Hz) to pitch both channels up while preserving transients. For dramatic stereo effects, use L: Shift Up (+50) / R: Shift Down (-50) — the left channel rises, right falls. Envelope only extracts the amplitude envelope — useful as a control signal or for tremolo effects (combine with original via dry/wet).
Important: Frequency shifting is NOT pitch shifting in the traditional sense — it adds a constant frequency offset to all partials, which changes the harmonic structure. Non-integer ratios become inharmonic. For low shift amounts (±50–200 Hz), the effect is subtle. Large shifts (±1000 Hz) produce metallic, ring-modulated-like textures. Antialiasing prevents frequencies from wrapping around the Nyquist limit when shifting up — always enable for up-shifts near Nyquist.

5 Operations (per channel)

No shift

Outputs the Hilbert-transformed signal (the quadrature component, 90° phase-shifted). This is the imaginary part of the analytic signal.

Use: Creating phase-difference effects when mixed with dry signal (Haas effect, phasing).

Shift up / Shift down

Single-sideband modulation: y = real·cos(2πft) ∓ imag·sin(2πft). Shifts the entire spectrum up or down by a constant frequency.

Use: Pitch-like shifting without time stretching, but harmonic ratios change. Small shifts (±50–200 Hz) = subtle; large shifts = metallic/inharmonic.

Envelope only

Extracts the instantaneous amplitude envelope: sqrt(real² + imag²). Optional lowpass smoothing removes ripple.

Use: Amplitude control signal, tremolo generation, ducking effects, or amplitude-based sidechain.

Phase rotate

Rotates the complex analytic signal by angle θ: y = real·cosθ - imag·sinθ.

Use: Continuous phase control; combined with dry signal produces variable cancellation for phaser/flanger effects.

Analytic signal & Hilbert transform

Given real signal x(t), its Hilbert transform is ĥ(t) = x(t) ∗ (1/πt).

The analytic signal is a(t) = x(t) + j·ĥ(t) = A(t)·e^{jφ(t)}.

Instantaneous amplitude: A(t) = √(x(t)² + ĥ(t)²)

Instantaneous phase: φ(t) = atan2(ĥ(t), x(t))

Frequency shift by Δf: y(t) = x(t)·cos(2πΔf·t) ∓ ĥ(t)·sin(2πΔf·t)

5 Presets

PresetLeft OpRight OpShift L/RPhase L/RCharacter
L: Shift Up (+50) / R: Shift Down (-50) Shift upShift down+50 Hz / -50 Hz Stereo widening: left rises, right falls. Creates floating, disorienting effect.
L: Envelope Only / R: Hilbert Phase Envelope onlyNo shift Left = amplitude control signal, Right = 90° phase-shifted audio. Combine for modulation.
Stereo Shift Up (+200Hz) Shift upShift up+200 Hz / +200 Hz Both channels shifted up by 200 Hz — bright, metallic, inharmonic texture.
Stereo Hilbert Phase No shiftNo shift Both channels output the Hilbert quadrature component. Stereo phase difference.

Theory: From Hilbert to Frequency Shift

The analytic signal

For a real signal x(t), its Hilbert transform ĥ(t) is the convolution with 1/(πt): ĥ(t) = x(t) ∗ 1/(πt) The analytic signal is: a(t) = x(t) + j·ĥ(t) = A(t)·e^{jφ(t)} Where: A(t) = √(x(t)² + ĥ(t)²) — instantaneous amplitude (envelope) φ(t) = atan2(ĥ(t), x(t)) — instantaneous phase

Frequency shifting via quadrature modulation

To shift the spectrum by Δf Hz (without unwanted sidebands): y(t) = Re[ a(t)·e^{j·2πΔf·t} ] = x(t)·cos(2πΔf·t) - ĥ(t)·sin(2πΔf·t) (Shift up) = x(t)·cos(2πΔf·t) + ĥ(t)·sin(2πΔf·t) (Shift down) This is single-sideband modulation — only the upper or lower sideband is retained, unlike ring modulation which produces both.

Phase rotation

Rotating the analytic signal by angle θ: y(t) = Re[ a(t)·e^{jθ} ] = x(t)·cosθ - ĥ(t)·sinθ This changes the phase relationship between real and imaginary parts, affecting the timbre when mixed with the original.
Why not use FFT resynthesis? Frequency shifting via the analytic signal is sample-accurate, preserves transients perfectly, and requires no windowing/overlap-add. However, it applies a constant frequency offset to all partials, which breaks harmonic relationships. For harmonic pitch shifting (preserving ratios), use Praat's PSOLA or Manipulation objects instead.

Applications

Single-sideband modulation / Frequency shifting

Use case: Create metallic, ring-modulator-like textures without carrier bleed.

Settings: Shift up/down by 100–1000 Hz. Small shifts = subtle detuning; large shifts = inharmonic, bell-like timbres.

Preset: Stereo Shift Up (+200Hz) — both channels brightened.

Envelope extraction for sidechain / ducking

Use case: Extract amplitude envelope from a signal, then use it to control another sound (or itself).

Settings: Envelope only operation. Enable envelope smoothing (20–50 Hz) to remove ripple.

Workflow: Process a drum loop to get its envelope, then multiply with a pad in Praat's Formula editor for rhythmic gating.

Stereo widening / phase effects

Use case: Create wide stereo image by processing L/R differently.

Settings: L = Shift up (+50), R = Shift down (-50). Or L = No shift (real), R = No shift (imag).

Result: The two channels become decorrelated, spreading across the stereo field.

Variable phase rotation (phaser/flanger)

Use case: Sweep the phase angle over time to create phaser-like notches.

Settings: Phase rotate with angle varying. Since the script processes a static angle per run, combine multiple runs or use with dry/wet mix for fixed comb filtering.

Workflow: Drum loop → Envelope follower for gating

Sound: Drum loop + sustained pad (two separate sounds).
Step 1: Run Hilbert Processor on drum loop, Operation = Envelope only, smoothing=30 Hz. Export as Sound "drum_env".
Step 2: In Praat, select pad and drum_env, use Formula: self * object["drum_env", row, col].
Result: Pad is rhythmically gated by drum envelope — classic sidechain pumping.

Workflow: Voice → frequency-shifted chorus

Sound: Vocal recording.
Settings: Process twice: first copy shifted up +15 Hz, second shifted down -15 Hz. Mix both with original (dry/wet = 50% each).
Result: Dense, chorus-like effect from constant frequency offsets, without the warble of LFO modulation.

Workflow: Field recording → phase-rotated texture

Sound: Ambient field recording.
Settings: Operation = Phase rotate, angle = 90°. Output is the Hilbert transform (imaginary part). When played alone, it sounds similar to original but with altered phase. When mixed with original (dry/wet = 50%), creates comb filtering and spectral notches.

Troubleshooting:
Frequency shift produces quiet output: The single-sideband modulation reduces amplitude by 3 dB (0.707) per channel. Increase Dry/wet mix to 100% and use output scaling.
Aliasing / high-frequency distortion: Enable Antialiasing, which zeros frequencies that would wrap around Nyquist after an up-shift. For down-shifts, antialiasing removes frequencies below the shift amount.
Envelope has ripple / modulation: The raw Hilbert envelope has ripple at 2× the carrier frequency. Enable envelope smoothing (10–50 Hz lowpass) to smooth it into a usable control signal.
Phase rotate sounds identical to original: Phase rotation alone (without mixing with dry signal) changes the waveform shape but may be imperceptible. Mix with dry signal (dry/wet = 50%) to hear cancellation/comb filtering.

Visualization (Suite 8×8)

When Draw_visualization is enabled, the script generates a Praat picture with:
  • Title bar — sound name, preset, operations, dry/wet mix
  • Input waveform (left) — original (grey)
  • Processed waveform (right) — output (blue)
  • Input spectrum (left) — frequency content before processing
  • Output spectrum (right) — shows the frequency shift (signature of Hilbert processor)
  • Summary bar — shift amounts, phase angles, antialiasing, envelope smoothing, output scale
The output spectrum is particularly revealing: a clean up-shift moves all frequencies upward without introducing mirrored sidebands (unlike ring modulation).