I want to extract the envelope of music signals with a sample rate of 44.1kHz.

I used the MATLAB command: abs(hilbert(mysignals)), but the resulting signal is similar to the original signal, not the envelope.

Does taking the Hilbert transform extract the envelope of an audio signal? Or is my calculation incorrect?

  • $\begingroup$ It should, but what is your original signal? $\endgroup$
    – endolith
    Jul 18, 2012 at 3:30
  • $\begingroup$ My original signal is common music signal, and sample rate is 44.1kHz $\endgroup$
    – Linda
    Jul 18, 2012 at 5:15
  • $\begingroup$ Hi endolith,Do you need other signal parameters? Thank you $\endgroup$
    – Linda
    Jul 18, 2012 at 8:55
  • $\begingroup$ Your calculation is correct, but taking the absolute value of the analytical signal in order to get an envelope works only for narrow-band signals. Otherwise you are retaining all frequencies with noise in them as well. Try band-pass filtering your signal first and then performing the above operation. $\endgroup$
    – Spacey
    Aug 13, 2012 at 13:38

4 Answers 4


That really depends on your definition of "enevelope" and what you need it for.

The Hilbert transform calculates the "analytic" signal, i.e. it calculates a matching imaginary part to a real signal by shifting the phase by 90 degrees in the frequency domain. It's reputation of calculating the "envelope" comes mainly from communication technology. It works very well with a narrow band signals, like amplitude or frequency or phase modulated signals. It's based on the simple fact that the analytic signal of a sine wave is a complex exponentional, the magnitude of which is 1. So the hilbert transform (or to be precise calculating the magnitude of the analytic signal) will eliminate the carrier quite well and leaves you with the modulation signal, or "envelope".

For broad band music, this is mostly not the case and the analytic signal isn't particularly helpful. A cymbal crash is basically a noise burst. The hilbert transform of this is just another noise burst and so is the magnitude of the analytic signal. You can't eliminate a carrier, if there isn't one to start with.

IF you are looking for something that roughly gives you "perceived loudness as a function of time", there many different ways to do this from simple lossy peak detectors all the way to sophisticated perceptual algorithms including cochlea models, binaural & temporal masking, nerve excitation models etc. It really depends on your application.


The Hilbert transform does NOT calculate an analytic signal. If we have a real-valued sequence $x(n)$, and the Hilbert transform of $x(n)$ is $x_H(n)$, the analytic signal, $a(n)$, associated with $x(n)$ is:

$$a(n) = x(n) + jx_H(n)$$

Computing the magnitude of $a(n)$ will give you the instantaneous envelope of the original $x(n)$ sequence. This works great for AM demodulation. If you compute the instantaneous phase of $a(n)$ to get $\phi(n)$, and compute the time derivative of $\phi(n)$, you have FM demodulation.

  • $\begingroup$ Good point. Good to see you here, Rick. $\endgroup$
    – Jason R
    Aug 12, 2012 at 21:57
  • 1
    $\begingroup$ This only works for sufficiently narrow band signals. Otherwise the resulting magnitude is not something recognizable as the audio envelope. $\endgroup$
    – hotpaw2
    Aug 13, 2012 at 1:25
  • $\begingroup$ Good point. I was a bit sloppy in my choice of words $\endgroup$
    – Hilmar
    Aug 14, 2012 at 9:58

Not sure about the theory, but here's something that seems to work in practice:

If you divide your audio signal into sub-bands of much less than one octave width (which obviously requires a low frequency limit for a finite number of bands), then the weighted sum of the instantaneous amplitudes from all the complex signal plus Hilbert transforms of all the sub-bands seems to approach something that looks like an instantaneous amplitude of the envelope of the whole audio signal (depending on the lowest sub-band used compared to the lowest frequency present in the audio signal, and the sub-band width(s) in fractions of an octave). You will also have to disregard the start-up transient of the longest Hilbert transform filter used (which again requires some high-pass cut-off with a long enough audio snippet).


Could the issue be a psycho-perceptual one, not a complex analytic one?

Take the sum of 2 audio frequency pure sinusoids of the same magnitude but a couple Hz apart. A human will hear a "beat" in the audio, and the Hilbert transform magnitude will also show the beating as the two analytic exponential spirals go in and out of phase. Now make the 2 sinusoids 20 Hz or more apart, and the Hilbert magnitude will still show a beating in the envelope of the sum, but a human might hear a 2 tone interval with a constant envelope instead, depending on the separation in Hz and semitones.

  • $\begingroup$ I suspect some sort of phase wrapping/unwrapping issue occurs when looking at the envelope of the Hilbert transform for signals of some bandwidth (one octave?) or greater. Anyone? $\endgroup$
    – hotpaw2
    Jul 18, 2012 at 19:03
  • $\begingroup$ Why should phase matter? The Hilbert transform extracts the magnitude by definition. Clarify? $\endgroup$
    – Phonon
    Jul 18, 2012 at 21:35
  • $\begingroup$ @Phonon : The magnitude of some analytic signal, yes. But is that the same as what someone might recognize as the envelope of their audio signal? $\endgroup$
    – hotpaw2
    Jul 18, 2012 at 21:58

Previous answers (from @Hilmar, @RickLyons, and @hotpaw2) are very informative. Hope I can also provide some.

First of all, there are more than one way to construct an complex signal based on a real one. Think about

$x(t)=\cos(2\pi f_1 t)\cos(2\pi f_2 t)$, where $f_1<f_2$,

one can define either

$z(t)=\cos(2\pi f_1 t)e^{j2\pi f_2 t}$, or $z(t)=\cos(2\pi f_2 t)e^{j2\pi f_1 t}$

However, Hilbert transform only generates one analytic signal (the first one). According to Bedrosian's product theorem, for real signal $x(t)=a(t)\cos\phi(t)$, its Hilbert transform


if $|F\{a(t)\}|=|A(\omega)|>0$ only for $\omega<\omega_{critical}$,

while $|F\{\cos\phi(t)\}|>0$ only for $\omega>\omega_{critical}$.

In this case, $a_z(t)=|x(t)+jH\{x(t)\}|=a(t)$ will be the desirable envelope. Otherwise, $a_z(t)\ne a(t)$ and might be hard to interpret. Please refer to [2] for more details.

[I'm not quite sure about my following reasoning...]

The analytic signal associated with any real bandpass ($\omega_a<\omega<\omega_b$) signal can be expressed as $z(t)=A(t)e^{j(\omega_a+\phi(t))}=A(t)e^{j\phi(t)}e^{j\omega_a}=z_{base}(t)e^{j\omega_a}$,

where the spectrum of $z_{base}(t)$ and thus $A(t)$ is upper bounded by $\Delta\omega=\omega_b-\omega_a$,

while the spectrum of $e^{j\phi(t)}e^{j\omega_a}$ is lower bounded by $\omega_a$

If $\omega_b<2\omega_a$ (or $\Delta\omega<\omega_a$), then $H\{A(t)\cos(\omega_a+\phi(t))\}=A(t)\sin(\omega_a+\phi(t))$, and Hilbert transform will provide reasonable envelope.

I think this is why to bandpass a broadband signal (e.g., music audio) in a series of octaves before applying Hilbert transform results in reasonable outputs.

[2]: Boashash, B. (1992). Estimating and interpreting the instantaneous frequency of a signal. I. Fundamentals. Proceedings of the IEEE, 80(4).

  • $\begingroup$ Bedrosian only holds if a(t) is lowpassed at a frequency below the sine/cos. For audio that's almost never the case. Hilbert is good for calculating envelopes for AM and FM signals. For broadband signals like audio it's the wrong tool. Off course you can filter to create bandpass signal, but you end up with a large number of envelope functions which tend to be useless. A perceptual analysis is a much better choice for most applications $\endgroup$
    – Hilmar
    Oct 1, 2013 at 12:34
  • $\begingroup$ Thank you for response:) I totally agree with you that it is inappropriate to apply HT directly to broadband audio. But I guess that when you suggested cochlea models and perceptual analysis, you actually meant to feed the audio through a battery of bandpass filters, and then maybe HT (or something similar) in each subband followed by some adaptive weighted sum, etc.? $\endgroup$
    – herrlich10
    Oct 1, 2013 at 15:39
  • $\begingroup$ The quickest way to get an audio envelope is probably to do a A-weighting or C-weighting and then doing running a "lossy peak" detector or an "RMS" detector with proper time constants. It really depends on the application. I'm not sure what envelopes inside the critical bands of a cochlea model would be useful for. $\endgroup$
    – Hilmar
    Oct 1, 2013 at 19:29
  • $\begingroup$ Good to know~ I'm not sure how human brains construct the percept of instantaneous loudness, probably no by doing precise HT:) However, it has to be a recombination of information in each sub-band. If I understand it correctly, A-weighting is like a single (broad) bandpass filter, while "lossy peak" detector is like a rectifier followed by some non-linear lowpass (controlled by the time constant) filter. The latter functions as a simple envelope detector. $\endgroup$
    – herrlich10
    Oct 4, 2013 at 3:38
  • $\begingroup$ Encounter a paper demonstrating the potential usefulness of envelope inside sub-bands: healthaffairs.uci.edu/hesp/publications/… $\endgroup$
    – herrlich10
    Oct 16, 2013 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.