Reply by February 17, 20052005-02-17
ok good, so it's just a logic bug with my loop. Thanks Jim.

Reply by Jim Thomas February 17, 20052005-02-17
Jon Harris wrote:
> Looks good to me! I still would use a loop for the convolution step so it is > easier to change number of taps, but that's just a programming preference.
It's more than just a preference, it's good practice. But I think I see a problem with your implementation.
>>for (int t=20; t < audioShortData.length; t++) { >>audioShortData[t] = (short)(( >>a0*audioShortData[t]+ >>a1*audioShortData[t-1]+
...
>>a20*audioShortData[t-20]
You are overwriting your input data with your filter result. That means that the each pass through the filter loop gets a different set of data, and that is incorrect. You need to store your results somewhere else. Do have a look at the FIR code on dspguru. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Quidquid latine dictum sit, altum sonatur. Whatever is said in Latin sounds profound.
Reply by Jerry Avins February 16, 20052005-02-16
samseed wrote:

   ...

> Jon and Jerry, thanks again for sharing your vast knowledge of DSP with > me and all the other newbies.
My pleasure! Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Jon Harris February 16, 20052005-02-16
"samseed" <agent3492003@yahoo.com> wrote in message
news:1108601220.386364.169590@c13g2000cwb.googlegroups.com...
> > OK, I understand you. The convolution formula is always the same > regardless of > > what filter type you are using--low-pass, high-pass, band-pass, > something > > totally arbitrary, etc.. So your filtering function can always be > the same, but > > depending on what filter coefficients you use, it may create a LP, > HP, etc.. > > excellent, that really clears up a lot of uncertainties for me. Of all > the documentation I've read nobody's just come out and said that.
That's because it's so obvious for those of us who have been doing DSP for years! :-)
> Jon and Jerry, thanks again for sharing your vast knowledge of DSP with > me and all the other newbies.
You're welcome.
Reply by samseed February 16, 20052005-02-16
> OK, I understand you. The convolution formula is always the same
regardless of
> what filter type you are using--low-pass, high-pass, band-pass,
something
> totally arbitrary, etc.. So your filtering function can always be
the same, but
> depending on what filter coefficients you use, it may create a LP,
HP, etc.. excellent, that really clears up a lot of uncertainties for me. Of all the documentation I've read nobody's just come out and said that. Jon and Jerry, thanks again for sharing your vast knowledge of DSP with me and all the other newbies.
Reply by Jon Harris February 16, 20052005-02-16
"samseed" <agent3492003@yahoo.com> wrote in message
news:1108595391.559407.170670@z14g2000cwz.googlegroups.com...
> my bad. > > >I'm guessing your audio sample rate is something around 8kHz > > correct. However, 44kHz is the only rate that has valid filter output, > but that may just be a bug in my app.
Probably.
> >Again, use your filter design program---there is no easy formula! I > think there > are some ways to transform a LP into a HP, but I would still use the > program. > > yes, I'm using the design program. What I meant to ask was, is the > high-pass a multiply/add like a low-pass, or do you multiply/ subtract > like so: > > audioShortData[t] = (short)(( a0*audioShortData[t] - > a1*audioShortData[t-1] - a2*audioShortData[t-2] - ...)
OK, I understand you. The convolution formula is always the same regardless of what filter type you are using--low-pass, high-pass, band-pass, something totally arbitrary, etc.. So your filtering function can always be the same, but depending on what filter coefficients you use, it may create a LP, HP, etc..
Reply by Jerry Avins February 16, 20052005-02-16
samseed wrote:
> my bad. > > >>I'm guessing your audio sample rate is something around 8kHz > > > correct. However, 44kHz is the only rate that has valid filter output, > but that may just be a bug in my app. > > >>Again, use your filter design program---there is no easy formula! I > > think there > are some ways to transform a LP into a HP, but I would still use the > program. > > yes, I'm using the design program. What I meant to ask was, is the > high-pass a multiply/add like a low-pass, or do you multiply/ subtract > like so: > > audioShortData[t] = (short)(( a0*audioShortData[t] - > a1*audioShortData[t-1] - a2*audioShortData[t-2] - ...)
Multiply and add is the usual. but id you always subtract, that just inverts the output signal. The operation is called MAC, for "Multiply And Accumulate". Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by samseed February 16, 20052005-02-16
my bad.

>I'm guessing your audio sample rate is something around 8kHz
correct. However, 44kHz is the only rate that has valid filter output, but that may just be a bug in my app.
>Again, use your filter design program---there is no easy formula! I
think there are some ways to transform a LP into a HP, but I would still use the program. yes, I'm using the design program. What I meant to ask was, is the high-pass a multiply/add like a low-pass, or do you multiply/ subtract like so: audioShortData[t] = (short)(( a0*audioShortData[t] - a1*audioShortData[t-1] - a2*audioShortData[t-2] - ...)
Reply by Jon Harris February 16, 20052005-02-16
"samseed" <agent3492003@yahoo.com> wrote in message
news:1108581210.574553.72530@z14g2000cwz.googlegroups.com...
> yes.
Just a tip, include some of the message you are replying too so we can see the context--what are you saying "yes" to?
> what is the correct formula for a high-pass?
Again, use your filter design program---there is no easy formula! I think there are some ways to transform a LP into a HP, but I would still use the program.
Reply by samseed February 16, 20052005-02-16
yes.

what is the correct formula for a high-pass?