S
Scott Soderlund
Hi,
I just started working on a project where the computer captures
samples of someone's speech. Each of these samples is run through a
50 Hz High Pass Filter to improve the quality of the sample. I've
done a lot of reading about High Pass filters and think I understand
pretty well how they work. What I don't understand though is a couple
of the variables in the program where the filter is actually
implemented. Perhaps someone out there can help tell me what they
mean.
Code follows and then my questions...
public class HighPass50
{
static int NZEROS = 5;
static int NPOLES = 5;
static double GAIN = 1.095980088e+00;
double xv[] = new double[NZEROS+1];
double yv[] = new double[NPOLES+1];
public HighPass50() {}
public void process(short data[])
{
for (int i=0; i <data.length; ++i)
{
xv[0] = xv[1];
xv[1] = xv[2];
xv[2] = data / GAIN;
yv[0] = yv[1];
yv[1] = yv[2];
yv[2] = (xv[0] + xv[2]) - 2 * xv[1] + ( -0.9479259375 *
yv[0]) + ( 1.9469976496 * yv[1]);
data = (short)yv[2];
}
}
}
Looking at the method above, I don't understand the meaning of the
'GAIN' variable (and more specifically the number it is set to). Is
this likely the cutoff frequency? Also, in the next to the last line
of the method, where yv[2] = ..., there are two numbers in this line
that I have no idea what they mean. The number "-0.9479259375" and
the number "1.9469976496". My guess is that the number
"-0.9479259375" is the lowest frequency possible (zero Hz) and that
"1.9469976496" is the highest frequency possible. This would make
sense if the GAIN variable was the cutoff frequency. Again, that is
my best guess! Can someone help with my understanding???
Thanks in advance,
Scott
I just started working on a project where the computer captures
samples of someone's speech. Each of these samples is run through a
50 Hz High Pass Filter to improve the quality of the sample. I've
done a lot of reading about High Pass filters and think I understand
pretty well how they work. What I don't understand though is a couple
of the variables in the program where the filter is actually
implemented. Perhaps someone out there can help tell me what they
mean.
Code follows and then my questions...
public class HighPass50
{
static int NZEROS = 5;
static int NPOLES = 5;
static double GAIN = 1.095980088e+00;
double xv[] = new double[NZEROS+1];
double yv[] = new double[NPOLES+1];
public HighPass50() {}
public void process(short data[])
{
for (int i=0; i <data.length; ++i)
{
xv[0] = xv[1];
xv[1] = xv[2];
xv[2] = data / GAIN;
yv[0] = yv[1];
yv[1] = yv[2];
yv[2] = (xv[0] + xv[2]) - 2 * xv[1] + ( -0.9479259375 *
yv[0]) + ( 1.9469976496 * yv[1]);
data = (short)yv[2];
}
}
}
Looking at the method above, I don't understand the meaning of the
'GAIN' variable (and more specifically the number it is set to). Is
this likely the cutoff frequency? Also, in the next to the last line
of the method, where yv[2] = ..., there are two numbers in this line
that I have no idea what they mean. The number "-0.9479259375" and
the number "1.9469976496". My guess is that the number
"-0.9479259375" is the lowest frequency possible (zero Hz) and that
"1.9469976496" is the highest frequency possible. This would make
sense if the GAIN variable was the cutoff frequency. Again, that is
my best guess! Can someone help with my understanding???
Thanks in advance,
Scott