making sound_detector more efficient