Hi @joanna0811,
If you retain only the envelope of the signal then applying average reference after that is not a good idea. After rereferencing you would get negative values at some channels/timepoints, which does not make sense for envelope (which should contain only non-zero values). I would apply average refere first and only then get the envelope of the signal.