[Speex-dev] AEC and different sound cards

Justin Karneges justin at affinix.com
Sat Mar 7 15:51:55 PST 2009


Hello!

I'm attempting to implement Speex AEC support in GStreamer, using work started 
by Olivier Crête.  In the Speex manual, I see this text:

"Using a different soundcard to do the capture and plaback will *not* work, 
regardless of what you may think. The only exception to that is if the two 
cards can be made to have their sampling clock ``locked'' on the same clock 
source."

This is of course a major issue, because people may have webcams with embedded 
mics, and cancellation really ought to work with their separate speakers.  Is 
this "same card" limitation a property of the Speex AEC only or AECs in 
general?  If the latter, then I'd be curious how Skype does it, as I've used 
a USB mic and onboard output together with Skype successfully.

In any case, what about using separate cards is a problem?  Is it that the two 
cards might process the same sample rate at slightly different speeds?  For 
example, 16000 Hz on one card ends up being 16001 Hz on another card?

I'm using GStreamer, and it forces the same clock to be used for all 
simultaneous operations.  This means that if you capture and playback 
simultaneously, the whole process will be synced to the clock of one of those 
devices, and clock skew compensation will be applied to the other.  So if you 
have a 16000 Hz input and a 16001 Hz output, and the input clock is the 
master, then 1 Hz of output will be thrown away periodically.  You can also 
use a software clock, in which case compensation may need to be applied to 
the handling of both devices.  To be clear, all of the compensation occurs in 
software; there is no literal tuning of a hardware clock.

Is the above GStreamer behavior enough to satisfy what the manual states as 
having the sampling clocks of the cards locked to the same clock source?

Thanks,
-Justin


More information about the Speex-dev mailing list