It's not hard at all if you know how filters work. There are many ways to do it, but the way I do it is by putting a low pass filter on the signal from the mic, and set the cutoff as low as possible (for this example), say 1hz. That will take away all the fast changes in the amplitude and leave you with a smooth signal that you can map to anything (using some basic math functions). Then you just calibrate it for your needs, for example you might want a sharper envelope response.