Dale is correct that its easier to smooth the spectrum by convolution rather than the method I proposed. This should represent linear-phase filtering. Of course you need to impose the symmetry conditions to insure that the reconstructed signal is real-only. Bob
Whitening in Frequency Domain
Started by ●March 7, 2013
Reply by ●March 8, 20132013-03-08
Reply by ●March 8, 20132013-03-08
On Fri, 08 Mar 2013 13:32:08 -0600, dspillini wrote:>>What are you _really_ trying to do? Given that you're talking about >>whitening, I assume that somewhere buried underneath whatever >>razz-matazz > >>you're dealing with is a desire to make a Wiener filter. > > I am trying to remove interference from my signal of interest. The SOI > is bursty, so there are periods where it is off. So, during those OFF > periods, I want to estimate the spectra in an attempt to "whiten" the > interferers. In order to do so, I am performing the following: 1. set > ON periods to 0 to obtain x_gate 2. take fft of x_gate to get X_gate > 3. take fft of x to get X > 4. calculate H=1/|X_gate| > 5. multiply X*H > 6. perform IFFT to get y = IFFT(X*H) > >>Why, if you're doing signal estimation, do you feel that you must use an >>FFT? >> >>If you don't feel that you must use an FFT, why do you feel that an FFT >>is best? > > I was only using an FFT so I could estimate the spectra in order to > obtain the inverse magnitude (1/|X_gate|).I think there's a seed of a good technique in there, except that (a) you're making the implicit assumption that your signal spectrum (while it's transmitting) is unknown or white, and (b) you're not accounting for the fact that your measured X_gate is going to itself be noisy. You probably want to take |X_gate| and smooth it somehow, then take the IFFT. You're still probably going to be far from optimal in a mathematical sense, but "good enough and working" is a lot more optimal in the real world than "half way done with the calculations, no data yet". -- 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 ●March 8, 20132013-03-08
>You probably want to take |X_gate| and smooth it somehow, then take the >IFFT. >Tim - excuse my ignorance, but why would I want to smooth |X_gate|? What is that going to buy me? Thanks.
Reply by ●March 8, 20132013-03-08
On 3/8/2013 1:56 PM, dspillini wrote:>> You can't do bin-by-bin frequency response manipulation like you are > propos= >> ing without having aliasing effects. You will need to use a smoothed > versio= >> n of H. >> >> One way to do this is to calculate H as you are presently doing, then > inver= >> se transform back to the time domain, and the apply a window function > where= >> the length of the window is N/2. Then forward transform back to the > frequ= >> ency domain and use this new H function to multiply your frames. The new H > = >> function will be a smoothed version of the original. >> >> Full disclosure, I have never tried this myself so I'm not sure if my > theor= >> y is correct, but it has a certain feel of truthiness to it :) >> >> Bob >> >> > > Bob - > > I had this thought as well, however how do I guarantee that this way would > provide me with constant group delay? My original H is purely real with > phase = 0, thus a group delay of 0. With what your proposing, a group > delay of zero, or even a constant group delay would not be guaranteed, > correct?Hold on! Do you distinguish between zero group delay and constant group delay? You can't do any processing (or even data acquisition) in the real world without at least some delay. Think "latency." Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●March 8, 20132013-03-08
>Hold on! Do you distinguish between zero group delay and constant group >delay? You can't do any processing (or even data acquisition) in the >real world without at least some delay. Think "latency." > >JerryYou can if you can look into the future!
Reply by ●March 8, 20132013-03-08
On 3/8/13 4:34 PM, radams2000@gmail.com wrote:> Dale is correct that its easier to smooth the spectrum by convolution rather than the method I proposed.Bob, ain't "small convolution in the frequency domain" pretty much the same as multiplication (by something wide) in the time domain? doesn't windowing the impulse response necessarily perform a convolution in the frequency domain? they seem like the same method to me. just done in different domains. it might be circular convolution (so there is some reflection about Nyquist, we expect reflection about DC anyway), but if the convolution is short (or "small") the smoothing everywhere other than around Nyquist should behave exactly as we would expect.> This should represent linear-phase filtering. Of course you need to impose the symmetry conditions to insure that the reconstructed signal is real-only.and symmetry conditions to the window so that the delay is constant. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●March 9, 20132013-03-09
Robert Yes, I was agreeing that the 2 methods are the same and that a short convolution is easier then what I proposed. The only thing that might be better about the time domain technique is that by limiting the time-domain record such that 50% of the samples are 0, I think you get rid of ALL the aliasing, whereas some of the simple 3-term convolutions may only get rid of most of the aliasing; do you think that is a correct assertion? Actually I have a question about the freq-domain convolution method; how to you handle the end points? Sorry if my postings are hard to read, I use my ipad for all of them, and the posting window comes up blank so I have no control. There must be a solution to this, I'll look into it. Bob
Reply by ●March 9, 20132013-03-09
On 3/9/13 8:06 AM, radams2000@gmail.com wrote:> Robert > > Yes, I was agreeing that the 2 methods are the same and that a short convolution is easier then what I proposed.why is convolution in one domain easier than multiplication in the other? especially when you need to insure that the impulse response is of a limited length so that you can accomplish linear convolution with the circular convolution tool? you have to convert to the time domain anyway. may as well shorten the impulse response and window it at the same time. then, with the windowed and shortened impulse response, you FFT it back to freq domain and that is what you use in the fast and circular convolution.> The only thing that might be better about the time domain technique is that by limiting the time-domain record such that 50% of the samples are 0, I think you get rid of ALL the aliasing, whereas some of the simple 3-term convolutions may only get rid of most of the aliasing; do you think that is a correct assertion?i don't see the convolution in the frequency domain as better. you still have to limit the length of the FIR if you want to avoid aliasing in the time domain within the circular convolution.> > Actually I have a question about the freq-domain convolution method; how to you handle the end points?i dunno. you throw them away in overlap-save (a better name that i learned recently is "overlap-scrap", still "OLS"). and with overlap-add (OLA), you add the down-ramping tail of the previous frame to the up-ramping tail of the current frame. this is not quite the same as the overlap-add that some of us folks do for more sophisticated processing like a phase vocoder. that's not an LTI filter and might have issues joining one frame to the adjacent frame. i remember learning from Jean Laroche about an 75% overlap scheme with a Hann window *squared* (he applied a single Hann on the input an another on the output just before the overlap-add, and it turns out that it was complementary). normally we do a 50% overlap with a single Hann window (applied at the input, no additional windowing applied to the output). but this overlap-add in the phase vocoder is not the same thing as the overlap-add in fast convolution (an LTI operation). then there should be absolutely no glitches at the joints or end points if you line your ducks up. and in fast convolution, there is no need that the impulse response length be half of your FFT buffer length. it could be, but the only limit on the FIR length is how many samples you want to get processed per frame; the frame "hop length". that's where the tradeoff is. for a fixed FFT length, N, the FIR length, L, and the hop length add to N+1. but with the overlap-add done in frame-based processing like a phase vocoder, it's pretty much a different puppy. and then edge effects might appear.> > Sorry if my postings are hard to read, I use my ipad for all of them, and the posting window comes up blank so I have no control. There must be a solution to this, I'll look into it. >use the ipad. it's fine, Bob. but this is one reason my heart is with the Luddites. for tasks that we've been doing, literally for the last 2 decades, the software is getting WORSE. consistently getting worse since 1999. our computers are faster and worse (for doing the basic things we do with them) than they were 20 years ago. it's a damn shame. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●March 9, 20132013-03-09
robert bristow-johnson wrote:> On 3/9/13 8:06 AM, radams2000@gmail.com wrote:<snip>> > use the ipad. it's fine, Bob. but this is one reason my heart is with > the Luddites. for tasks that we've been doing, literally for the last 2 > decades, the software is getting WORSE. consistently getting worse > since 1999. our computers are faster and worse (for doing the basic > things we do with them) than they were 20 years ago. it's a damn shame. > >VMs allow you to entertain Captain Ned all you want, long as the original install media hold up. -- Les Cargill
Reply by ●March 9, 20132013-03-09
Robert Thanks, I think I see what you are saying. But the question that the OP wants to answer is, lets assume that through some process you end up modifying each fft frame in a way that would cause aliasing in the reconstruction, for example by multiplying bins by 1 or 0. What's the best way to fix up the spectrum such that, after inverse transform and overlap-add, the aliases are completely eliminated? I think Dale's answer is to smooth the spectrum directly in the frequency domain by convolving with a simple 3-term weighting vector. Can this eliminate ALL the aliasing? I don't know. Bob






