As I said in a comment, you can get the envelope of a signal by running it through a lowpass filter
Implement a lowpass filter (FIR) by creating a filter kernel of appropriate length M (h(M) ). Note that your FIR filter (sin(x)/x) should normally be multiplied by a window function (e.g Hamming, Blackman, etc).
Convolve your signal with the filter kernel.
I'm having a hard time choosing/finding a proper filter kernel function. The quote above suggests
sin(x)/x. Is this a standard kernel function? Does it have some magic properties that make it particularly suitable? What should I check if I consider another kernel function?