modified perceptual_adaptation_avgcycle for local use