Get ADSR working, improve code elsewhere