<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Massimo wrote:
<blockquote cite="mid1104832148.3036.5.camel@Pal" type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="GENERATOR" content="GtkHTML/1.1.8">
Il ven, 2004-12-31 alle 20:19, Jean-Marc Valin ha scritto:
<blockquote type="CITE">
<pre><font color="#737373" size="3"><i>DC (aka frequency zero) means that the signal isn't centered around
zero. When there's a DC or lots of low frequencies, Speex cannot do a
very good job.</i></font></pre>
</blockquote>
<font size="3">Since in the future I'll hopefully have some time to
experience Speex, this catched my attention.<br>
How can I understand when I got a DC?<br>
I have an idea which is to look all the samples for min/max values and
translate them but it looks way too much simple to work.<br>
</font></blockquote>
<br>
This isn't speex-specific, although other codecs may do this
internally, or may not be sensitive to it, but it's a good idea anyway
(otherwise, you can't get the actual energy level, etc).<br>
<br>
You can remove DC like this:<br>
<br>
static long bias = 0;<br>
<br>
/* remove bias -- whether ec is on or not. */<br>
for(i = 0; i < n; i++) {<br>
bias += ((((long)inputBuffer[i]) << 15) - bias) >>
14;<br>
inputBuffer[i] -= (bias >> 15);<br>
}<br>
<br>
(or, you could just to the inside of the loop for each sample, in a
different loop; it needn't be in it's own loop).<br>
<br>
<br>
-SteveK<br>
<br>
</body>
</html>