A system such as a speakerphone may include a processor, memory, a speaker
and a microphone. The processor may be configured (via program
instructions stored in the memory) to calibrate the speaker by:
outputting a stimulus signal; receiving an input signal corresponding to
the stimulus signal; computing a midrange sensitivity and a lowpass
sensitivity for a transfer function derived from a spectrum of the input
signal and a spectrum of the output signal; subtracting the midrange
sensitivity from the lowpass sensitivity to obtain a speaker-related
sensitivity; performing an iterative search for current parameters of a
speaker model using the input signal spectrum, the stimulus signal
spectrum and the speaker-related sensitivity; and updating averages of
the speaker model parameters using the current parameter values. The
stimulus signal may be transmitted during periods of silence in the
external environment. The parameter averages may be used to perform echo
cancellation.