A method for attenuating an input signal to obtain an output signal within a device comprising a transducer with a speaker, a microphone and an echo cancellation circuit (1036, 1037), the method comprising: - receiving the input signal, - attenuating the input signal with a gain factor to obtain the output signal, - applying a filter having a frequency response with a frequency-dependent filter gain to at least one of a copy of the input signal and a copy of the output signal to obtain a filtered signal; - determining a signal strength of the filtered signal, and - determining the gain factor from at least the signal strength, such that the gain factor is reduced if the signal strength increases; wherein - the speaker is adapted to render a first signal derived from the output signal, thereby providing a rendered signal; - the microphone is adapted to sense the rendered signal, thereby providing a sensed signal; - the echo cancellation circuit (1036, 1037) is adapted to predict the sensed signal from the first signal, thereby providing a predicted signal, and to determine an echo-cancelled signal by determining a difference of the predicted signal and the sensed signal; - a frequency-dependent performance characteristic of the echo cancellation circuit (1036, 1037) is determined as the ratio of the power of the echo-cancelled signal and the power of the sensed signal; - the frequency-dependent performance characteristic comprises N, with N>1, frequency ranges for which the device creates undesirable distortions that cannot be compensated by the echo cancellation circuit (1036, 1037); - the frequency-dependent filter gain is determined using the frequency-dependent performance characteristic of the echo cancellation circuit (1036, 1037), such that the frequency-dependent filter gain emphasizes frequencies within the N frequency ranges; and - the filter comprises a sequence ofN peaking filters, each one of the N peaking filters having a frequency response adapted to emphasize frequencies within a corresponding one of the N frequency ranges. - receiving the input signal, - attenuating the input signal with a gain factor to obtain the output signal, - applying a filter having a frequency response with a frequency-dependent filter gain to at least one of a copy of the input signal and a copy of the output signal to obtain a filtered signal; - determining a signal strength of the filtered signal, and - determining the gain factor from at least the signal strength, such that the gain factor is reduced if the signal strength increases; - the speaker is adapted to render a first signal derived from the output signal, thereby providing a rendered signal; - the microphone is adapted to sense the rendered signal, thereby providing a sensed signal; - the echo cancellation circuit (1036, 1037) is adapted to predict the sensed signal from the first signal, thereby providing a predicted signal, and to determine an echo-cancelled signal by determining a difference of the predicted signal and the sensed signal; - a frequency-dependent performance characteristic of the echo cancellation circuit (1036, 1037) is determined as the ratio of the power of the echo-cancelled signal and the power of the sensed signal; - the frequency-dependent performance characteristic comprises N, with N>1, frequency ranges for which the device creates undesirable distortions that cannot be compensated by the echo cancellation circuit (1036, 1037); - the frequency-dependent filter gain is determined using the frequency-dependent performance characteristic of the echo cancellation circuit (1036, 1037), such that the frequency-dependent filter gain emphasizes frequencies within the N frequency ranges; and - the filter comprises a sequence ofN peaking filters, each one of the N peaking filters having a frequency response adapted to emphasize frequencies within a corresponding one of the N frequency ranges.