Re: [Ekiga-list] Bad sound quality because of missing low pass filter



Le lundi 01 mars 2010 à 22:47 -0500, Christian Jaeger a écrit :
Hello

I'm using Ekiga and Twinkle with the Diamondcard.us service as my main
phone service. People are telling me every now and then that the sound
quality is pretty poor, and in fact when I listen to my voice on the
echo service it's always been quite much worse than when using a
"normal" phone I think. It's regardless of the codec used, all that
are offered by Diamondcard are using 8000 Hz sampling rate. And I'm
using a headset and have checked sound quality locally, which is just
fine, as I can verify for example with (the bfr command is to delay
playback, so you can hear the echo better):

arecord -t raw -f dat -r 22050 -c 1 | bfr -m 33075 | aplay -t raw -f
dat -r 22050 -c 1 -

Now 8000 Hz is of course lower, and in fact when using that rate:

arecord -t raw -f dat -r 8000 -c 1 | bfr -m 12000 | aplay -t raw -f
dat -r 8000 -c 1 -

it sounds exactly as in the echo test. Now one thing I know is that if
you sample a signal, you need a low pass before the quantization, at
half the sample rate or lower, to remove frequencies that are too high
to be represented in the digitalized data. If the low pass is missing,
the high frequencies are turned to noise instead. So what happens when
a program samples data at a low frequency, will it somehow make the
sound card tune a low pass to the correct cut-off frequency when the
sample rate is changed? Sounds rather unlikely, and in fact the echo
test at 8000 Hz sounds exactly like suffering from that problem: you
can't distinguish "s" from "f" anymore, which may just be unavoidable
with no frequency spectrum above 4000 Hz, but worse, they sound very
loud and noisy, and for example an combined s and vowel, like they
often appear in french (e.g. "bourgeoisie" I think, I'm not a native
french speaker), sound really awful. Now there's a way to remedie
this: low-pass filtering can also be done computationally, so we can
digitize at say DAT quality (48000 Hz) and resample down to 8000
samples/second programmatically, which is what the following command
line is doing:

arecord -t raw -f dat -c 1 | bfr -m 36000 | sox -t raw -r 48000 -s -2
-c 1 -  -t raw -r 8000 - resample -ql |bfr -m 6000 | aplay -t raw -f
dat -r 8000 -c 1 -

It sounds more hollow/muffled now, but much cleaner. No loud noises
anymore for sharp consonants.

Would doing this in VoIP programs improve perceived sound quality for
the listener? I would expect so, but haven't been able to test. (All I
know is that more often than not I'm using Skype to call people now
(Skype-out service), because people are telling me they hear me
better.)

Note that you can very well say "you're wrong, we don't need a
low-pass, just use a higher sampling rate then it sounds just fine",
which is of course partially true, with higher sampling rates the
relevance of a low-pass decreases quickly as the spectrum of
frequencies that are higher than half the sample rate becomes narrower
(and an increasing part of the consonant frequency range is digitized
correctly instead of as noise). But given that at least Diamondcard
only offers 8000 Hz, and there may be valid reasons for this (like
maybe the phone system is still using that frequency), what's your
position on this?


Isn't it waht the "plughw:0,0" special ALSA device is supposed to do by itself ?
We rely on it.

-- 
 _     Damien Sandras
(o-      
//\    Ekiga Softphone : http://www.ekiga.org/
v_/_   Be IP           : http://www.beip.be/
       FOSDEM          : http://www.fosdem.org/
       SIP Phone       : sip:dsandras ekiga net
                       


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]