Gain modulation of recurrent networks