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.
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.
Key Features:
- 5 Operations — No shift, Shift up, Shift down, Envelope only, Phase rotate
- Independent L/R processing — Different operations per channel for stereo effects
- Frequency shifting — Single-sideband modulation (no carrier leak, no mirrored sidebands)
- Envelope extraction — RMS-style amplitude envelope from analytic signal
- Phase rotation — Rotate the complex analytic signal by arbitrary angle
- Antialiasing — Zeroes frequencies that would alias after shift
- Envelope smoothing — Lowpass filter on extracted envelope (0 = off)
- 5 Presets — Stereo shift, envelope+phase combos, plus Custom
- Dry/wet mix — Blend processed and original signals
Quick start
- In Praat, select exactly one Sound object (mono or stereo).
- Run script… →
Hilbert_Audio_Processor.praat. - Choose a preset from the dropdown, or select "Custom".
- Set Operation for Left and Right channels independently (No shift / Shift up / Shift down / Envelope only / Phase rotate).
- Adjust Shift amount (Hz) or Phase angle (degrees) for each channel.
- Enable/disable Antialiasing to prevent frequency wrap-around on up-shifts.
- Set Dry/wet mix (0–100% wet).
- Click OK — script processes and creates output.
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
| Preset | Left Op | Right Op | Shift L/R | Phase L/R | Character |
|---|---|---|---|---|---|
| L: Shift Up (+50) / R: Shift Down (-50) | Shift up | Shift down | +50 Hz / -50 Hz | — | Stereo widening: left rises, right falls. Creates floating, disorienting effect. |
| L: Envelope Only / R: Hilbert Phase | Envelope only | No shift | — | — | Left = amplitude control signal, Right = 90° phase-shifted audio. Combine for modulation. |
| Stereo Shift Up (+200Hz) | Shift up | Shift up | +200 Hz / +200 Hz | — | Both channels shifted up by 200 Hz — bright, metallic, inharmonic texture. |
| Stereo Hilbert Phase | No shift | No shift | — | — | Both channels output the Hilbert quadrature component. Stereo phase difference. |
Theory: From Hilbert to Frequency Shift
The analytic signal
Frequency shifting via quadrature modulation
Phase rotation
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.
• 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)
- 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