Wednesday, February 22, 2017

audio - Hilbert transform to compute signal envelope?


I've heard that the Hilbert transform can be used to calculate the envelope of a signal. How does this work? And how is this "Hilbert envelope" different from the envelope one gets by simply rectifying a signal?


I'm interested specifically in finding a way to calculate an envelope for use in dynamic range compression (i.e., "turning down the volume" of the loud parts of an audio signal automatically).



Answer



The Hilbert transform is used to calculate the "analytic" signal. See for example http://en.wikipedia.org/wiki/Analytic_signal. If your signal is a sine wave or an modulated sine wave, the magnitude of the analytic signal will indeed look like the envelope. However, the computation of the Hilbert transform is not trivial. Technically it requires a non-causal FIR filter of considerable length so it will require a fair amount of MIPS, memory and latency.


For a broad band signal, it really depends on how you define "envelope" for your specific application. For your application of dynamic range compression you want a metric that is well correlated with the the perception of loudness over time. The Hilbert Transform is not the right tool for that.


A better option would be to apply an A-weighted filter (http://en.wikipedia.org/wiki/A-weighting) and then do a lossy peak or lossy RMS detector. This will correlate fairly well with perceived loudness over time and is relatively cheap to do.


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...