Automatic detection of noise level