Implement ADSR envelope