Envelope of a signal via Convex hull / Edge detection
You can use the Hilbert transform to get the analytic signal.  The absolute value of the analytic signal is the envelope.  It's available in SciPy and many other software suites, though it's usually poorly named.