Envelope
ShippingenvelopeAmplitude envelope detection: peak, RMS, or Hilbert analytic
Signature
Inputs
signalSignalrequired
Outputs
resultSignal
Parameters
| Key | Type | Default | Notes |
|---|---|---|---|
method | enum | peak | one of: peak, rms, hilbert |
window_size | int | 50 | |
attack_time | float | 0.001s | |
release_time | float | 0.1s |
Description
Envelope extracts the slowly varying amplitude contour of a signal, discarding the fast carrier while retaining the outline of its magnitude. It offers three algorithms selected by method: peak (an asymmetric attack/release follower), rms (a sliding root-mean-square window), and hilbert (the true analytic-signal envelope). The output is a Signal of the same length and same physical unit as the input, since an amplitude envelope is dimensionally identical to the quantity it tracks.
The peak follower is a one-pole tracker with independent time constants: it rises toward the rectified input with attack_time and decays with release_time. Fast attack and slow release produce the classic dynamics-processor envelope. The rms method computes over a sliding window of window_size samples, giving a smooth energy-weighted amplitude. The hilbert method forms the analytic signal and returns its instantaneous magnitude , the mathematically exact envelope for narrowband signals.
The node is stateless: each evaluation processes the full input buffer with parameters interpreted against the buffer's sample rate; no state carries between runs. Attack and release times are given in seconds and are converted to per-sample coefficients using the signal's sample rate. Uncertainty () propagates through the underlying arithmetic, though the nonlinearity of rectification, squaring, and magnitude means the reported is a first-order approximation near amplitude zero-crossings.
Mathematics
Examples
AM demodulation with the Hilbert envelope
Recover the modulating tone from an amplitude-modulated carrier. Feed the received signal into envelope with method = hilbert; the analytic magnitude tracks the amplitude regardless of carrier phase.
signal_generator (AM) --> envelope { method: hilbert } --> sinkUnlike a diode-style peak detector, the Hilbert envelope introduces no attack/release lag and is exact for a single carrier.
Dynamics-follower envelope for audio
A fast-attack, slow-release peak follower produces the control envelope used by compressors and gates:
method: peakattack_time: 0.001s (1 ms rise)release_time: 0.1s (100 ms fall)
The output rides transient peaks quickly then decays smoothly, mirroring with dynamics-processor behavior.
Applications
- AM demodulation and envelope recovery in communications and RF receivers via the Hilbert analytic method
- Audio dynamics processing: driving compressors, limiters, and gates from a peak or RMS amplitude follower
- Vibration and machine-health monitoring, where the RMS envelope of a bearing signal reveals modulating fault frequencies
- Speech and biomedical analysis (EMG/EEG), extracting the amplitude contour for feature detection and gating
Neat
The Hilbert envelope is the only one of the three methods that is exact and lag-free for a pure narrowband signal: it reflects amplitude off the analytic signal's magnitude rather than smoothing or peak-holding.
Because the output shares the input's unit, chaining `envelope` before `derivative` yields the amplitude's rate of change in units per second directly, with no manual scaling.
Known issues
The Hilbert method's FIR/FFT-based quadrature filter degrades near the buffer edges, so the first and last few samples of the analytic envelope can show transient error; window or trim boundaries for critical measurements.
For broadband or multi-tone signals the Hilbert magnitude is not a smooth amplitude and can exhibit fast fluctuations; RMS or the peak follower is more robust in those cases.