[Speex-dev] Downsampling

Thorvald Natvig speex at natvig.com
Tue Jun 7 13:16:38 PDT 2005


Ok, this is slightly offtopic, but relates to the quality of input for 
speex :)

I'm working on echo cancellation by means of sampling the wave mix 
of the sound card as well as the microphone. I originally had two sound 
cards, which had some synchronization problems (now solved, more or 
less), but I have also discovered a much better solution using ASIO 2.0, 
which enables me to sample multiple sources on the same soundcard.

Unfortunately, ASIO is limited to the internal sampling frequency of the 
sound card, which for my Audigy 2 is 48 khz, and only delivers stereo. As 
I understand it, just picking every 3rd sample and averaging left and 
right will introduce aliasing, so I added a FIR-filter to remove all 
components above 7.5 khz before downsampling. While I can't say I really 
notice any difference in audible audio quality, the samples seem to have 
slightly better SNR when inspected in various audio programs.

However, I still downmix to mono by just averaging the left and right 
samples, which (from my googling) I can tell will introduce aliasing but I 
found no good highquality solution to this :(

The question is, is this FIR-decimator the best method to downsample? I 
thought of converting the frame to the frequency domain, drop components 
> 8khz and convert back, but I'm not sure if that would produce a 
better signal or worse.

Also, would it be best to do echo cancellation and preprocessing at 48khz 
and then decimate to 16khz, or (as I currently do) decimate first then do 
echo cancellation and preprocessing?


More information about the Speex-dev mailing list