Hi group I am coding a program to do some filtering on an audio file. So using the method described in Steven Smith's excellent book "The Scientist and Engineer's Guide to Digital Signal Processing", I have designed a filter with 41 coefficients and having a desired frequency response. Now I need to convolve this with a number of input samples. I have randomly chosen to use 81 samples. Convolving with the filter gives a result of length 121. From this I write one output samples. Then I shift the input by 1 sample and read a new input sample and repeating the process. I have 2 questions regarding this: 1) I convolved with 81 samples. How many should I use? Does it depend on the filter length? 2) By experimenting I noticed that I should use the centered output value from the convolution as my output sample. That is sample no. 60. Is that correct? I tries others, but the filter worked with the centered value. TIA, Michael
Convolving input samples with a filter
Started by ●May 15, 2013
Reply by ●May 15, 20132013-05-15
On Thursday, May 16, 2013 12:36:58 AM UTC+12, Michael P. wrote:> Hi group > > > > I am coding a program to do some filtering on an audio file. > > So using the method described in Steven Smith's excellent book > > "The Scientist and Engineer's Guide to Digital Signal Processing", > > I have designed a filter with 41 coefficients and having a desired > > frequency response. > > > > Now I need to convolve this with a number of input samples. > > I have randomly chosen to use 81 samples. > > Convolving with the filter gives a result of length 121. > > From this I write one output samples. > > Then I shift the input by 1 sample and read a new input sample > > and repeating the process. > > > > I have 2 questions regarding this: > > > > 1) I convolved with 81 samples. How many should I use? > > Does it depend on the filter length? > > > > 2) By experimenting I noticed that I should use the centered output > > value from the convolution as my output sample. That is sample no. 60. > > Is that correct? > > I tries others, but the filter worked with the centered value. > > > > TIA, > > MichaelFor an FIR filter you need only implement the difference equation (which is convolution) and this gives you 1 new output point for one new input point. eg y(k)=b0*u(k)+b1*u(k-1) now u and y are not normally conveniently in arrays so we do this Loop:{ u1=u0 read new u0 y0=b0*u0+b1*u1 output y0 }
Reply by ●May 15, 20132013-05-15
On Wed, 15 May 2013 14:36:58 +0200, Michael P. wrote:> Hi group > > I am coding a program to do some filtering on an audio file. So using > the method described in Steven Smith's excellent book "The Scientist and > Engineer's Guide to Digital Signal Processing", I have designed a filter > with 41 coefficients and having a desired frequency response. > > Now I need to convolve this with a number of input samples. I have > randomly chosen to use 81 samples. Convolving with the filter gives a > result of length 121. From this I write one output samples. Then I shift > the input by 1 sample and read a new input sample and repeating the > process. > > I have 2 questions regarding this: > > 1) I convolved with 81 samples. How many should I use? > Does it depend on the filter length? > > 2) By experimenting I noticed that I should use the centered output > value from the convolution as my output sample. That is sample no. > 60. Is that correct? > I tries others, but the filter worked with the centered value.You're confusing theoretical convolution with actually filtering a signal. I'm assuming you've made an FIR. The answer for an IIR is slightly different. If you're doing the filtering in real time you find the value of the latest filter output from the 41 filter coefficients and the 41 most recent input samples. Then you wait until the next input sample and do it again (this is why DSP chips feature a multiply-accumulate instruction -- it's at the core of a fast vector dot product, which is what you're doing here). If you're doing the filtering as a batch process, then there are various speedups. Generally your output vector is as big as your input vector, but sometimes you might want output size = input size - filter size (because the transients aren't "right", or aren't defined, or whatever), or you might want output size = input size + filter size (because you want to keep everything, including the transients). If you don't know how big your output vector is, then you don't know what you're doing. You should gives us more detail about what you want than "some filtering", and let us tell you. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by ●May 15, 20132013-05-15
<gyansorova@gmail.com> wrote in message news:d80592fc-cd12-43de-a5ae-35034c63b266@googlegroups.com...> On Thursday, May 16, 2013 12:36:58 AM UTC+12, Michael P. wrote: >> Hi group >> >> >> >> I am coding a program to do some filtering on an audio file. >> >> So using the method described in Steven Smith's excellent book >> >> "The Scientist and Engineer's Guide to Digital Signal Processing", >> >> I have designed a filter with 41 coefficients and having a desired >> >> frequency response. >> >> >> >> Now I need to convolve this with a number of input samples. >> >> I have randomly chosen to use 81 samples. >> >> Convolving with the filter gives a result of length 121. >> >> From this I write one output samples. >> >> Then I shift the input by 1 sample and read a new input sample >> >> and repeating the process. >> >> >> >> I have 2 questions regarding this: >> >> >> >> 1) I convolved with 81 samples. How many should I use? >> >> Does it depend on the filter length? >> >> >> >> 2) By experimenting I noticed that I should use the centered output >> >> value from the convolution as my output sample. That is sample no. 60. >> >> Is that correct? >> >> I tries others, but the filter worked with the centered value. >> >> >> >> TIA, >> >> Michael > > For an FIR filter you need only implement the difference equation (which > is convolution) and this gives you 1 new output point for one new input > point. > eg > > y(k)=b0*u(k)+b1*u(k-1) > > now u and y are not normally conveniently in arrays so we do this > > Loop:{ > > u1=u0 > read new u0 > > y0=b0*u0+b1*u1 > > output y0 > } >I see - thank you. I have already done this in an averaging filter. I just got confused when reading about convolution knowing that I was supposed to convolve the samples with the filter.
Reply by ●May 15, 20132013-05-15
"Tim Wescott" <tim@seemywebsite.com> wrote in message news:nIednfZDsvhbew7MnZ2dnUVZ5qGdnZ2d@giganews.com...> On Wed, 15 May 2013 14:36:58 +0200, Michael P. wrote: > >> Hi group >> >> I am coding a program to do some filtering on an audio file. So using >> the method described in Steven Smith's excellent book "The Scientist and >> Engineer's Guide to Digital Signal Processing", I have designed a filter >> with 41 coefficients and having a desired frequency response. >> >> Now I need to convolve this with a number of input samples. I have >> randomly chosen to use 81 samples. Convolving with the filter gives a >> result of length 121. From this I write one output samples. Then I shift >> the input by 1 sample and read a new input sample and repeating the >> process. >> >> I have 2 questions regarding this: >> >> 1) I convolved with 81 samples. How many should I use? >> Does it depend on the filter length? >> >> 2) By experimenting I noticed that I should use the centered output >> value from the convolution as my output sample. That is sample no. >> 60. Is that correct? >> I tries others, but the filter worked with the centered value. > > You're confusing theoretical convolution with actually filtering a signal. > > I'm assuming you've made an FIR. The answer for an IIR is slightly > different. > > If you're doing the filtering in real time you find the value of the > latest filter output from the 41 filter coefficients and the 41 most > recent input samples. Then you wait until the next input sample and do > it again (this is why DSP chips feature a multiply-accumulate instruction > -- it's at the core of a fast vector dot product, which is what you're > doing here). > > If you're doing the filtering as a batch process, then there are various > speedups. Generally your output vector is as big as your input vector, > but sometimes you might want output size = input size - filter size > (because the transients aren't "right", or aren't defined, or whatever), > or you might want output size = input size + filter size (because you > want to keep everything, including the transients). > > If you don't know how big your output vector is, then you don't know what > you're doing. You should gives us more detail about what you want than > "some filtering", and let us tell you. > > -- > My liberal friends think I'm a conservative kook. > My conservative friends think I'm a liberal kook. > Why am I not happy that they have found common ground? > > Tim Wescott, Communications, Control, Circuits & Software > http://www.wescottdesign.comYou're right, it is a FIR and I was confused :-) By "some filtering" I mean that I have created a filter with a desired freq. response. I am not doing it real time, but I don't need a speedup. I have already done an averaging filter, so I know what to do now. Thank you for explaining. In what situations would you use theoretical convolution? I guess analysing, but what can you deduce from a convolution output?
Reply by ●May 15, 20132013-05-15
On Wed, 15 May 2013 22:58:35 +0200, Michael P. wrote:> "Tim Wescott" <tim@seemywebsite.com> wrote in message > news:nIednfZDsvhbew7MnZ2dnUVZ5qGdnZ2d@giganews.com... >> On Wed, 15 May 2013 14:36:58 +0200, Michael P. wrote: >> >>> Hi group >>> >>> I am coding a program to do some filtering on an audio file. So using >>> the method described in Steven Smith's excellent book "The Scientist >>> and Engineer's Guide to Digital Signal Processing", I have designed a >>> filter with 41 coefficients and having a desired frequency response. >>> >>> Now I need to convolve this with a number of input samples. I have >>> randomly chosen to use 81 samples. Convolving with the filter gives a >>> result of length 121. From this I write one output samples. Then I >>> shift the input by 1 sample and read a new input sample and repeating >>> the process. >>> >>> I have 2 questions regarding this: >>> >>> 1) I convolved with 81 samples. How many should I use? >>> Does it depend on the filter length? >>> >>> 2) By experimenting I noticed that I should use the centered output >>> value from the convolution as my output sample. That is sample no. >>> 60. Is that correct? >>> I tries others, but the filter worked with the centered value. >> >> You're confusing theoretical convolution with actually filtering a >> signal. >> >> I'm assuming you've made an FIR. The answer for an IIR is slightly >> different. >> >> If you're doing the filtering in real time you find the value of the >> latest filter output from the 41 filter coefficients and the 41 most >> recent input samples. Then you wait until the next input sample and do >> it again (this is why DSP chips feature a multiply-accumulate >> instruction -- it's at the core of a fast vector dot product, which is >> what you're doing here). >> >> If you're doing the filtering as a batch process, then there are >> various speedups. Generally your output vector is as big as your input >> vector, but sometimes you might want output size = input size - filter >> size (because the transients aren't "right", or aren't defined, or >> whatever), or you might want output size = input size + filter size >> (because you want to keep everything, including the transients). >> >> If you don't know how big your output vector is, then you don't know >> what you're doing. You should gives us more detail about what you want >> than "some filtering", and let us tell you. >> >> -- >> My liberal friends think I'm a conservative kook. My conservative >> friends think I'm a liberal kook. Why am I not happy that they have >> found common ground? >> >> Tim Wescott, Communications, Control, Circuits & Software >> http://www.wescottdesign.com > > You're right, it is a FIR and I was confused :-) By "some filtering" I > mean that I have created a filter with a desired freq. response. > I am not doing it real time, but I don't need a speedup. I have already > done an averaging filter, so I know what to do now. Thank you for > explaining. > > In what situations would you use theoretical convolution? I guess > analysing, but what can you deduce from a convolution output?I should have said "batch convolution" (which isn't really a formal term -- I'm not sure that there is one). You use the symbolic representation of convolution mostly for making the tools you'll use for analysis -- not to do analysis itself. The output of the convolution is the filtered signal, plus some transients on the end which are the length of the filter impulse response. Convolution will go much faster if you do it in batches, but there's 'i's to dot and 't's to cross and if you're not up on the theory it's like wandering through a minefield with a blindfold on. Get your stuff working, and if you despair over how slow it is then look to doing batch convolution to speed things up. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by ●May 16, 20132013-05-16
"Tim Wescott" <tim@seemywebsite.com> wrote in message news:nIednfFDsvgjYg7MnZ2dnUVZ5qGdnZ2d@giganews.com...> On Wed, 15 May 2013 22:58:35 +0200, Michael P. wrote: > >> "Tim Wescott" <tim@seemywebsite.com> wrote in message >> news:nIednfZDsvhbew7MnZ2dnUVZ5qGdnZ2d@giganews.com... >>> On Wed, 15 May 2013 14:36:58 +0200, Michael P. wrote: >>> >>>> Hi group >>>> >>>> I am coding a program to do some filtering on an audio file. So using >>>> the method described in Steven Smith's excellent book "The Scientist >>>> and Engineer's Guide to Digital Signal Processing", I have designed a >>>> filter with 41 coefficients and having a desired frequency response. >>>> >>>> Now I need to convolve this with a number of input samples. I have >>>> randomly chosen to use 81 samples. Convolving with the filter gives a >>>> result of length 121. From this I write one output samples. Then I >>>> shift the input by 1 sample and read a new input sample and repeating >>>> the process. >>>> >>>> I have 2 questions regarding this: >>>> >>>> 1) I convolved with 81 samples. How many should I use? >>>> Does it depend on the filter length? >>>> >>>> 2) By experimenting I noticed that I should use the centered output >>>> value from the convolution as my output sample. That is sample no. >>>> 60. Is that correct? >>>> I tries others, but the filter worked with the centered value. >>> >>> You're confusing theoretical convolution with actually filtering a >>> signal. >>> >>> I'm assuming you've made an FIR. The answer for an IIR is slightly >>> different. >>> >>> If you're doing the filtering in real time you find the value of the >>> latest filter output from the 41 filter coefficients and the 41 most >>> recent input samples. Then you wait until the next input sample and do >>> it again (this is why DSP chips feature a multiply-accumulate >>> instruction -- it's at the core of a fast vector dot product, which is >>> what you're doing here). >>> >>> If you're doing the filtering as a batch process, then there are >>> various speedups. Generally your output vector is as big as your input >>> vector, but sometimes you might want output size = input size - filter >>> size (because the transients aren't "right", or aren't defined, or >>> whatever), or you might want output size = input size + filter size >>> (because you want to keep everything, including the transients). >>> >>> If you don't know how big your output vector is, then you don't know >>> what you're doing. You should gives us more detail about what you want >>> than "some filtering", and let us tell you. >>> >>> -- >>> My liberal friends think I'm a conservative kook. My conservative >>> friends think I'm a liberal kook. Why am I not happy that they have >>> found common ground? >>> >>> Tim Wescott, Communications, Control, Circuits & Software >>> http://www.wescottdesign.com >> >> You're right, it is a FIR and I was confused :-) By "some filtering" I >> mean that I have created a filter with a desired freq. response. >> I am not doing it real time, but I don't need a speedup. I have already >> done an averaging filter, so I know what to do now. Thank you for >> explaining. >> >> In what situations would you use theoretical convolution? I guess >> analysing, but what can you deduce from a convolution output? > > I should have said "batch convolution" (which isn't really a formal term > -- I'm not sure that there is one). You use the symbolic representation > of convolution mostly for making the tools you'll use for analysis -- not > to do analysis itself. > > The output of the convolution is the filtered signal, plus some > transients on the end which are the length of the filter impulse response. > > Convolution will go much faster if you do it in batches, but there's 'i's > to dot and 't's to cross and if you're not up on the theory it's like > wandering through a minefield with a blindfold on. > > Get your stuff working, and if you despair over how slow it is then look > to doing batch convolution to speed things up. > > -- > My liberal friends think I'm a conservative kook. > My conservative friends think I'm a liberal kook. > Why am I not happy that they have found common ground? > > Tim Wescott, Communications, Control, Circuits & Software > http://www.wescottdesign.comThank you for explaining the output of theoretical convolution. Transients at the end/ends fits with my experimental result placing the filtered result in the middle. I think that in the end I will want a much longer filter. So I will probably FFT the samples and multiply in the frequency domain before doing the IFFT. Of course I will have to use overlap-add.
Reply by ●May 16, 20132013-05-16
On Thu, 16 May 2013 18:37:40 +0200, Michael P. wrote:> "Tim Wescott" <tim@seemywebsite.com> wrote in message > news:nIednfFDsvgjYg7MnZ2dnUVZ5qGdnZ2d@giganews.com... >> On Wed, 15 May 2013 22:58:35 +0200, Michael P. wrote: >> >>> "Tim Wescott" <tim@seemywebsite.com> wrote in message >>> news:nIednfZDsvhbew7MnZ2dnUVZ5qGdnZ2d@giganews.com... >>>> On Wed, 15 May 2013 14:36:58 +0200, Michael P. wrote: >>>> >>>>> Hi group >>>>> >>>>> I am coding a program to do some filtering on an audio file. So >>>>> using the method described in Steven Smith's excellent book "The >>>>> Scientist and Engineer's Guide to Digital Signal Processing", I have >>>>> designed a filter with 41 coefficients and having a desired >>>>> frequency response. >>>>> >>>>> Now I need to convolve this with a number of input samples. I have >>>>> randomly chosen to use 81 samples. Convolving with the filter gives >>>>> a result of length 121. From this I write one output samples. Then I >>>>> shift the input by 1 sample and read a new input sample and >>>>> repeating the process. >>>>> >>>>> I have 2 questions regarding this: >>>>> >>>>> 1) I convolved with 81 samples. How many should I use? >>>>> Does it depend on the filter length? >>>>> >>>>> 2) By experimenting I noticed that I should use the centered output >>>>> value from the convolution as my output sample. That is sample >>>>> no. 60. Is that correct? >>>>> I tries others, but the filter worked with the centered value. >>>> >>>> You're confusing theoretical convolution with actually filtering a >>>> signal. >>>> >>>> I'm assuming you've made an FIR. The answer for an IIR is slightly >>>> different. >>>> >>>> If you're doing the filtering in real time you find the value of the >>>> latest filter output from the 41 filter coefficients and the 41 most >>>> recent input samples. Then you wait until the next input sample and >>>> do it again (this is why DSP chips feature a multiply-accumulate >>>> instruction -- it's at the core of a fast vector dot product, which >>>> is what you're doing here). >>>> >>>> If you're doing the filtering as a batch process, then there are >>>> various speedups. Generally your output vector is as big as your >>>> input vector, but sometimes you might want output size = input size - >>>> filter size (because the transients aren't "right", or aren't >>>> defined, or whatever), or you might want output size = input size + >>>> filter size (because you want to keep everything, including the >>>> transients). >>>> >>>> If you don't know how big your output vector is, then you don't know >>>> what you're doing. You should gives us more detail about what you >>>> want than "some filtering", and let us tell you. >>>> >>>> -- >>>> My liberal friends think I'm a conservative kook. My conservative >>>> friends think I'm a liberal kook. Why am I not happy that they have >>>> found common ground? >>>> >>>> Tim Wescott, Communications, Control, Circuits & Software >>>> http://www.wescottdesign.com >>> >>> You're right, it is a FIR and I was confused :-) By "some filtering" I >>> mean that I have created a filter with a desired freq. response. I am >>> not doing it real time, but I don't need a speedup. I have already >>> done an averaging filter, so I know what to do now. Thank you for >>> explaining. >>> >>> In what situations would you use theoretical convolution? I guess >>> analysing, but what can you deduce from a convolution output? >> >> I should have said "batch convolution" (which isn't really a formal >> term -- I'm not sure that there is one). You use the symbolic >> representation of convolution mostly for making the tools you'll use >> for analysis -- not to do analysis itself. >> >> The output of the convolution is the filtered signal, plus some >> transients on the end which are the length of the filter impulse >> response. >> >> Convolution will go much faster if you do it in batches, but there's >> 'i's to dot and 't's to cross and if you're not up on the theory it's >> like wandering through a minefield with a blindfold on. >> >> Get your stuff working, and if you despair over how slow it is then >> look to doing batch convolution to speed things up. >> >> -- >> My liberal friends think I'm a conservative kook. My conservative >> friends think I'm a liberal kook. Why am I not happy that they have >> found common ground? >> >> Tim Wescott, Communications, Control, Circuits & Software >> http://www.wescottdesign.com > > Thank you for explaining the output of theoretical convolution. > Transients at the end/ends fits with my experimental result placing the > filtered result in the middle. > > I think that in the end I will want a much longer filter. So I will > probably FFT > the samples and multiply in the frequency domain before doing the IFFT. > Of course I will have to use overlap-add.If you're doing this work in Scilab then there's a function that does that -- it's either 'convolve', or 'conv', or 'convol'. The nice thing is that much of the work has been done for you, and they have a rational technique for doing the overlap-add with the fewest lines of code. I suspect that Matlab and Octave have something similar. Of course, in this degenerate age where memory is cheap and labor is dear, it is often quite practical to just suck in a million data points, do the FFT magic, and use the result. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by ●May 16, 20132013-05-16
"Tim Wescott" <tim@seemywebsite.com> wrote in message news:KOWdnZt18IDUvgjMnZ2dnUVZ5o2dnZ2d@giganews.com...> On Thu, 16 May 2013 18:37:40 +0200, Michael P. wrote: > >> "Tim Wescott" <tim@seemywebsite.com> wrote in message >> news:nIednfFDsvgjYg7MnZ2dnUVZ5qGdnZ2d@giganews.com... >>> On Wed, 15 May 2013 22:58:35 +0200, Michael P. wrote: >>> >>>> "Tim Wescott" <tim@seemywebsite.com> wrote in message >>>> news:nIednfZDsvhbew7MnZ2dnUVZ5qGdnZ2d@giganews.com... >>>>> On Wed, 15 May 2013 14:36:58 +0200, Michael P. wrote: >>>>> >>>>>> Hi group >>>>>> >>>>>> I am coding a program to do some filtering on an audio file. So >>>>>> using the method described in Steven Smith's excellent book "The >>>>>> Scientist and Engineer's Guide to Digital Signal Processing", I have >>>>>> designed a filter with 41 coefficients and having a desired >>>>>> frequency response. >>>>>> >>>>>> Now I need to convolve this with a number of input samples. I have >>>>>> randomly chosen to use 81 samples. Convolving with the filter gives >>>>>> a result of length 121. From this I write one output samples. Then I >>>>>> shift the input by 1 sample and read a new input sample and >>>>>> repeating the process. >>>>>> >>>>>> I have 2 questions regarding this: >>>>>> >>>>>> 1) I convolved with 81 samples. How many should I use? >>>>>> Does it depend on the filter length? >>>>>> >>>>>> 2) By experimenting I noticed that I should use the centered output >>>>>> value from the convolution as my output sample. That is sample >>>>>> no. 60. Is that correct? >>>>>> I tries others, but the filter worked with the centered value. >>>>> >>>>> You're confusing theoretical convolution with actually filtering a >>>>> signal. >>>>> >>>>> I'm assuming you've made an FIR. The answer for an IIR is slightly >>>>> different. >>>>> >>>>> If you're doing the filtering in real time you find the value of the >>>>> latest filter output from the 41 filter coefficients and the 41 most >>>>> recent input samples. Then you wait until the next input sample and >>>>> do it again (this is why DSP chips feature a multiply-accumulate >>>>> instruction -- it's at the core of a fast vector dot product, which >>>>> is what you're doing here). >>>>> >>>>> If you're doing the filtering as a batch process, then there are >>>>> various speedups. Generally your output vector is as big as your >>>>> input vector, but sometimes you might want output size = input size - >>>>> filter size (because the transients aren't "right", or aren't >>>>> defined, or whatever), or you might want output size = input size + >>>>> filter size (because you want to keep everything, including the >>>>> transients). >>>>> >>>>> If you don't know how big your output vector is, then you don't know >>>>> what you're doing. You should gives us more detail about what you >>>>> want than "some filtering", and let us tell you. >>>>> >>>>> -- >>>>> My liberal friends think I'm a conservative kook. My conservative >>>>> friends think I'm a liberal kook. Why am I not happy that they have >>>>> found common ground? >>>>> >>>>> Tim Wescott, Communications, Control, Circuits & Software >>>>> http://www.wescottdesign.com >>>> >>>> You're right, it is a FIR and I was confused :-) By "some filtering" I >>>> mean that I have created a filter with a desired freq. response. I am >>>> not doing it real time, but I don't need a speedup. I have already >>>> done an averaging filter, so I know what to do now. Thank you for >>>> explaining. >>>> >>>> In what situations would you use theoretical convolution? I guess >>>> analysing, but what can you deduce from a convolution output? >>> >>> I should have said "batch convolution" (which isn't really a formal >>> term -- I'm not sure that there is one). You use the symbolic >>> representation of convolution mostly for making the tools you'll use >>> for analysis -- not to do analysis itself. >>> >>> The output of the convolution is the filtered signal, plus some >>> transients on the end which are the length of the filter impulse >>> response. >>> >>> Convolution will go much faster if you do it in batches, but there's >>> 'i's to dot and 't's to cross and if you're not up on the theory it's >>> like wandering through a minefield with a blindfold on. >>> >>> Get your stuff working, and if you despair over how slow it is then >>> look to doing batch convolution to speed things up. >>> >>> -- >>> My liberal friends think I'm a conservative kook. My conservative >>> friends think I'm a liberal kook. Why am I not happy that they have >>> found common ground? >>> >>> Tim Wescott, Communications, Control, Circuits & Software >>> http://www.wescottdesign.com >> >> Thank you for explaining the output of theoretical convolution. >> Transients at the end/ends fits with my experimental result placing the >> filtered result in the middle. >> >> I think that in the end I will want a much longer filter. So I will >> probably FFT >> the samples and multiply in the frequency domain before doing the IFFT. >> Of course I will have to use overlap-add. > > If you're doing this work in Scilab then there's a function that does > that -- it's either 'convolve', or 'conv', or 'convol'. The nice thing > is that much of the work has been done for you, and they have a rational > technique for doing the overlap-add with the fewest lines of code. > > I suspect that Matlab and Octave have something similar. > > Of course, in this degenerate age where memory is cheap and labor is > dear, it is often quite practical to just suck in a million data points, > do the FFT magic, and use the result. > > -- > My liberal friends think I'm a conservative kook. > My conservative friends think I'm a liberal kook. > Why am I not happy that they have found common ground? > > Tim Wescott, Communications, Control, Circuits & Software > http://www.wescottdesign.comActually I'm doing this in VB6 :-) I have written a dll to do FFT/IFFT and a class file to handle reading and writing wave files.
Reply by ●May 17, 20132013-05-17
About your center point question, Length_output = Length_input + Length_filter - 1 Transients are the first Length_filter/2 samples and the last Length_filter/2 samples, given that the input signal is long. Start with Length_filter/2 + 1 th sample in your output signal. The boundary samples are the ones which make linear and circular convolutions different and this is what is compensated in overlap methods.






