Make envelope per channel. Move ballistics (attack/release) to log domain and after gain stage. cf Josh Reiss, Uni. London, http://c4dm.eecs.qmul.ac.uk/audioengineering/compressors/documents/Reiss-Tutorialondynamicrangecompression.pdf Thanks to Dedrick for very useful feedback.
The downward expander acts as an advanced gate with smoother effect since it lowers the level instead of discarding audio when below the threshold.