How about :

Code:
if signal>(0.6*prev_signal) then gosub attenuation
Ioannis