[Speex-dev] Sound card problem in acoustic echo

limaoquan2000 limaoquan2000 at 126.com
Fri Oct 1 04:48:06 PDT 2010


Hi Underwood,

Thank you for your help. I agree with your opinion. But it is almost impossible
to further reduce the frequent difference between play and capture.

1. I used a 2^18 step FFT to analyse the echo frequency. So the freq resolution
 is 8000HZ/(2^17)=0.0625Hz. The analyser need at least 2^18/8000=32 seconds
 acoustic echo record signal from the microphone.
 Better freq resolution relies on longer FFT and also longer record echo signal.
 It is almost not possible for a practical system.
2. Better resampler with smaller step size is also a challenge in its performance.

So it is difficult to reduce the frequent difference further more.

About the change of sample rates of the ADC and DAC. I don't think it is a problem
if the ADC and DAC share the same clock.
The real problem is why they have different freq clock even if they if they are
assigned with the same sample rate.

For example:

1. for a pure hardware sound card.

There is a a crystal quartz oscillator and two PLL circuits which outputs are clock
sources of ADC and DAC respectively.

When the ADC and DAC are assigned with the same sample rate, two PLLs will share
the same sub-frequency coefficient, so their output signal will also have exactly
the same frequency.

2. for a AC97 or HD sound card.

The clock frequency of both their ADC and DAC is always 48KHZ(AC97) or 192KHZ(HD).
Then the outputs of ADC and DAC are resampled according to their assigned sample rate
by software. So they will also have exactly the same frequency when they are assigned
with the same sample rate.

NOW THE PROBLEM IS WHY MOST SOUND CARDS ALWAYS HAVE DIFFERENT SAMPLE RATE WHEN
BOTH THEIR ARE ASSIGNED WITH THE SAME PLAY AND CAPTURE RATE?

>----------------------------------------------------------------------
>
>Message: 1
>Date: Thu, 30 Sep 2010 21:27:59 +0800
>From: Steve Underwood <steveu at coppice.org>
>Subject: Re: [Speex-dev] Sound card problem in acoustic echo
>To: speex-dev at xiph.org
>Message-ID: <4CA4905F.10106 at coppice.org>
>Content-Type: text/plain; charset=UTF-8; format=flowed
>
>  Hi,
>
>0.1Hz is still a *big* difference. It means the transmitted and received
>samples are still sliding quite rapidly with respect to each other, and
>that means the adaption is proceeding too fast to ever catch up and
>eliminate all the echo. Ideally you need to eliminate all the frequency
>mismatch, but you certainly need to get so close to that goal that the
>creep rate is well within the capability of the adaption to keep up.
>
>Note that a one off measurement of the frequency difference is not
>ideal. The DAC and ADC sample rates will change with temperature, and
>not necessarily in the same direction.
>
>Steve
>
>On 09/30/2010 04:45 PM, LiMaoquan2000 wrote:
>>
>> Hi All,
>>
>> In order to deal with acoustic echo cancellation problems of most PCs
>> which
>> sound cards have different capture and play frequencies. I made a trial.
>>
>> At first, a 1000Hz sine wave is played for a long time via a speaker
>> and its
>> acoustic echo is recoreded.
>>
>> Seconds, get the frequency of the echo by a FFT analyser. So the
>> difference
>> between capture and play frequencies is obtained.
>>
>> Thirdly, before AEC, the signal captured by the soundcard is resampled
>> to the
>> play frequency. The frequency step of the resampler is 0.1Hz. So for
>> the AEC,
>> the difference between far-end signal and near-end signal is no more
>> than 0.1Hz.
>>
>> I have tested the speex AEC and my own AEC in a PC that the difference
>> between
>> its sound card is about 0.8Hz. They show the same result :
>>
>> WITHOUT the resampler, just a little acoustic echo is eliminated.
>> WITH the resampler, most acoustic echo is eliminated. But it still can
>> be heared
>> clearly, even though the echo is faint.
>>
>> This performance is still much worse than AEC in PCs which sound cards
>> have same
>> capture and play frequencies. There is almost no echo can be heard in
>> latter.
>>
>> Does anybody have advices to this problem? It's a common problem for
>> acoustic
>> echo cancellation in most computers, because most sound cards have
>> different
>> capture and play frequencies. It vital for all acoustic echo cancellers.
>>
>> Any advice is welcome.
>>
>> ----------------------------------------------------------------------
>>
>> >Date: Sun, 25 Jul 2010 20:26:44 +0000 (GMT)
>> >From: p_j_r_m <p_j_r_m at yahoo.com <mailto:p_j_r_m at yahoo.com>>
>> >Subject: Re: [Speex-dev] Sound card problem in acoustic echo
>> >To: speex-dev at xiph.org <mailto:speex-dev at xiph.org>
>> >
>> >Direct Sound AEC never worked for me, even when it did with Speex.?I
>> was told that after disabling effects in DS the play and record
>> streams could be synchronized,and then Speex AEC did the job.
>> >
>> >--- El vie, 23/7/10, limaoquan2000 <limaoquan2000 at 126.com
>> <mailto:limaoquan2000 at 126.com>> escribi?:
>> >
>> >
>> >De: limaoquan2000 <limaoquan2000 at 126.com <mailto:limaoquan2000 at 126.com>>
>> >Asunto: Re: [Speex-dev] Sound card problem in acoustic echo
>> >Para: speex-dev at xiph.org <mailto:speex-dev at xiph.org>,
>> p_j_r_m at yahoo.com <mailto:p_j_r_m at yahoo.com>
>> >Fecha: viernes, 23 de julio, 2010 22:42
>> >
>> >
>> >>I remember?I had to expose the echo cancelation level implementing a
>> get_echo_level( ) function based on this:
>> >>http://lists.xiph.org/pipermail/speex-dev/2008-September/006889.html
>> >
>> >This is really a good idea to determine the frequency difference
>> between capture
>> >and play of the sound card. But it need constant far-end voice and a
>> long time
>> >because it must repeat the process of "resampling, test echo" for
>> many times.
>> >
>> >Have you tried the AEC in DirectSound? If this AEC is usable for all
>> sound cards,
>> >perhaps microsoft has solved this problem already. Can we choose
>> proper options
>> >of the DirectSound to solved this problem and disable its AEC at the
>> same time?
>> >
>> >>
>> >>Using that value and averaging samples as?"fedback" I did small
>> corrections to sampling rate until convergence, although this not
>> always worked.When it did, convergence was quite fast (seconds).
>> >>Resampling did not introduce noticiable CPU increase.But may be the
>> small time used for conversions was the cause of non-convergence.I
>> think this path is hard and uncertain,
>> >
>> >>and now,i would dive first in DirectSound to try to obtain
>> synchronized streams before passing them to speex.
>> >
>> >Waiting for your good news.
>> >
>> >>Regarding ASIO, you have to install a special "driver"? for it to
>> work,and this seems unaceptable for general users.
>> >
>> >>--- El jue, 22/7/10, limaoquan2000 <limaoquan2000 at 126.com
>> <mailto:limaoquan2000 at 126.com>> escribi:
>> >
>> >>Thank you.
>> >
>> >>But it will cost you a long time to get the accurate play and
>> capture frequencies.
>> >>Does your program test two frequencies of the sound card each time
>> Because
>> >>different sound cards have different frequency errors.
>> >>And the resampling program is also time consuming because the target
>> frequency is
>> >>so close to the sampling frequency of the input signal, isn't it?
>> >
>> >>I have tested program based on Windows waveform functions and also
>> DirectSound.
>> >>They have similar frequency error.
>> >
>> >>BTW: What's your conclusion of ASIO driver? Why "it was of no
>> practical use"?
>> >
>> >>> I worked some time for a company doing AEC using Speex on
>> Windows.It is true it depends a lot on sound card models. I remember I
>> could do AEC by resampling frequencies so play and record frequencies
>> where equal.Frequencies where aprox 100Hz appart.Also, I know that on
>> other cases AEC was achieved by disabling FX DirectSound effects where
>> it wasn`t possible before that.Try to disable all you don't need
>> before calling Speex AEC function.
>> >>> Also, I tried the ASIO driver,as an experiment. I think it worked,
>> but it was of no practical use.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20101001/5922eeb2/attachment.htm 


More information about the Speex-dev mailing list