DSPRelated.com
Forums

Processing a signal stream

Started by Dr. Thomas Radtke March 7, 2005
Hi,

I asked this some time ago but wasn't clear enough about what I mean so 
I'll try again:) Suppose you have a digital signal stream and want to do 
some operations that require a FFT. The signal is divided into several 
windows, each having 512 samples. Some manipulations are done on these 
windows and then the resulting spectral signal is transformed back to 
time domain by use of the inverse FFT. Now the stream looks like a mess. 
There are discontinuities between these windows that I can't overcome by 
the famous overlap-add method since I don't have a filter kernel that 
would allow for it. Being quite naive in DSP, there is one thing I've 
tried: I let the windows overlap and add the time signals of overlapping 
windows, weighted with a sigmoidal function. As a result, the new stream 
is crystal clear with no pops and glitches. But there are some artifacts 
left, echos in particular. These artifacts aren't there when I'm not 
using overlapping windows. Also, this method doesn't look right as the 
time signals of both windows in the overlap region are very different 
from each other. Is there a standard way to solve this kind of problems 
or am I on my own?

Thomas

Dr. Thomas Radtke wrote:
> Hi, > > I asked this some time ago but wasn't clear enough about what I mean
so
> I'll try again:) Suppose you have a digital signal stream and want to
do
> some operations that require a FFT. The signal is divided into
several
> windows, each having 512 samples. Some manipulations are done on
these
> windows and then the resulting spectral signal is transformed back to
> time domain by use of the inverse FFT. Now the stream looks like a
mess. OK... your processing scheme "requres" an FFT. Why? What is it you do in frequency domain that can not be done in time domain?
> There are discontinuities between these windows that I can't overcome
by
> the famous overlap-add method since I don't have a filter kernel that
> would allow for it.
Based on my previous question, I interpret this as that you don't do standard filtering. Which makes me suspect you are into block data processing... if so, I think you are out on deep water. Block data processing schemes (MUSIC, ESPRIT,...) usually require the signal model to be stationary within each block. If the signal statistics has changed "sufficiently" between successive blocks, I would expect blocking effects that might not be easy to remove by overlap-add methods. Of course, what is a "sufficiently large" change in signal statistics to cause problems, is anybody's guess.
> Being quite naive in DSP, there is one thing I've > tried: I let the windows overlap and add the time signals of
overlapping
> windows, weighted with a sigmoidal function. As a result, the new
stream
> is crystal clear with no pops and glitches. But there are some
artifacts
> left, echos in particular. These artifacts aren't there when I'm not > using overlapping windows. Also, this method doesn't look right as
the
> time signals of both windows in the overlap region are very different
> from each other. Is there a standard way to solve this kind of
problems
> or am I on my own?
Sorry, can't help out with that. It might be that somebody could provide more help if you explained the problem and your methods in somewhat more detail.
> Thomas
Rune
Dr. Thomas Radtke wrote:
> Hi, > > I asked this some time ago but wasn't clear enough about what I mean so > I'll try again:) Suppose you have a digital signal stream and want to do > some operations that require a FFT. The signal is divided into several > windows, each having 512 samples.
I presume here that you're just cutting up the stream into blocks of 512 samples each without any weighting? This means that you're applying a rectangular window in the time domain. Remember, that the FFT works by assuming that the input sequence is periodic. If samples you choose are such that the periodicizing causes a spurious sudden discontinuity, you could end up with "spectral leakage", that is, you'll see a distorted frequency spectrum. Another way of looking at this is that multiplying by a rectangular function in the time domain is equivalent to convolving the spectrum of the original signal with a sinc function that stretches over the complete spectrum. So the spectrum you're working with is spectrally distorted. The "solution" is to use windows that smooth out these discontinuities... Some manipulations are done on these
> windows and then the resulting spectral signal is transformed back to > time domain by use of the inverse FFT. Now the stream looks like a mess. > There are discontinuities between these windows that I can't overcome by > the famous overlap-add method since I don't have a filter kernel that > would allow for it. Being quite naive in DSP, there is one thing I've > tried: I let the windows overlap and add the time signals of overlapping > windows, weighted with a sigmoidal function. As a result, the new stream > is crystal clear with no pops and glitches. But there are some artifacts > left, echos in particular. These artifacts aren't there when I'm not > using overlapping windows. Also, this method doesn't look right as the > time signals of both windows in the overlap region are very different > from each other. Is there a standard way to solve this kind of problems > or am I on my own?
What you need to ensure is that the windows you overlap should be such that the magnitude of the two windows for each sample sums to 1. Otherwise, you'd be unequally weighting some of the samples leading to distortion. I don't know if you're taking care of this when you're applying the sigmoid. You could try using one of Hamming/Hanning/Kaiser/Bartlett windows. They all have different spectral properties... Just google for these terms and you ought to be able to find good references. - Ravi
Rune Allnor schrieb:

> OK... your processing scheme "requres" an FFT. Why? What is > it you do in frequency domain that can not be done in time > domain?
Replacing the amplitude spectrum, leaving the phase as it is. The new spectrum is similar to the one to be replaced.
> Based on my previous question, I interpret this as that you don't > do standard filtering. Which makes me suspect you are into > block data processing... if so, I think you are out on deep water. > Block data processing schemes (MUSIC, ESPRIT,...) usually require > the signal model to be stationary within each block. If the
Lets see if I get you right. Stationary means pitch==window size i.e., same waveform in any window? Thats for sure not the case.
> signal statistics has changed "sufficiently" between successive > blocks, I would expect blocking effects that might not be easy to > remove by overlap-add methods. Of course, what is a "sufficiently > large" change in signal statistics to cause problems, is anybody's > guess.
The statistics changes heavily:(. Thomas
Ravi Srikantiah schrieb:

> > I presume here that you're just cutting up the stream into blocks of 512 > samples each without any weighting? This means that you're applying a > rectangular window in the time domain. Remember, that the FFT works by > assuming that the input sequence is periodic. If samples you choose are > such that the periodicizing causes a spurious sudden discontinuity, you > could end up with "spectral leakage", that is, you'll see a distorted > frequency spectrum.
Sorry, forgot that I used a hamming window on the time signal.
> > What you need to ensure is that the windows you overlap should be such > that the magnitude of the two windows for each sample sums to 1.
Yep, I used a cosine in the range 0,PI warped to return values in the range 1,0. The overlapping samples got weighted by 1 minus this function. Overlap is 50% of the window size, probably a bit too much?
> Otherwise, you'd be unequally weighting some of the samples leading to > distortion. I don't know if you're taking care of this when you're > applying the sigmoid. You could try using one of > Hamming/Hanning/Kaiser/Bartlett windows. They all have different > spectral properties... Just google for these terms and you ought to be > able to find good references.
Thanks for the hints. I will try some different weighting functions and see what fits best. Thomas
Dr. Thomas Radtke wrote:
> Rune Allnor schrieb: > >> OK... your processing scheme "requres" an FFT. Why? What is >> it you do in frequency domain that can not be done in time >> domain? > > > Replacing the amplitude spectrum, leaving the phase as it is. The new > spectrum is similar to the one to be replaced. > >> Based on my previous question, I interpret this as that you don't >> do standard filtering. Which makes me suspect you are into >> block data processing... if so, I think you are out on deep water. >> Block data processing schemes (MUSIC, ESPRIT,...) usually require >> the signal model to be stationary within each block. If the > > > Lets see if I get you right. Stationary means pitch==window size i.e., > same waveform in any window? Thats for sure not the case. > >> signal statistics has changed "sufficiently" between successive >> blocks, I would expect blocking effects that might not be easy to >> remove by overlap-add methods. Of course, what is a "sufficiently >> large" change in signal statistics to cause problems, is anybody's >> guess. > > > The statistics changes heavily:(. > > Thomas
You might look into sliding FFT. Perhaps you can devise a sliding IFFT (shouldn't that be FIFT?) to use with it. http://www.hunteng.co.uk/bench/fft-bench.htm Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
"Dr. Thomas Radtke" <thradtke@freenet.de> wrote in message 
news:422C8C00.8050808@freenet.de...
> Ravi Srikantiah schrieb: > >> >> I presume here that you're just cutting up the stream into blocks of 512 >> samples each without any weighting? This means that you're applying a >> rectangular window in the time domain. Remember, that the FFT works by >> assuming that the input sequence is periodic. If samples you choose are >> such that the periodicizing causes a spurious sudden discontinuity, you >> could end up with "spectral leakage", that is, you'll see a distorted >> frequency spectrum. > > Sorry, forgot that I used a hamming window on the time signal. > >> >> What you need to ensure is that the windows you overlap should be such >> that the magnitude of the two windows for each sample sums to 1. > > Yep, I used a cosine in the range 0,PI warped to return values in the > range 1,0. The overlapping samples got weighted by 1 minus this function. > Overlap is 50% of the window size, probably a bit too much? > >> Otherwise, you'd be unequally weighting some of the samples leading to >> distortion. I don't know if you're taking care of this when you're >> applying the sigmoid. You could try using one of >> Hamming/Hanning/Kaiser/Bartlett windows. They all have different spectral >> properties... Just google for these terms and you ought to be able to >> find good references. > > Thanks for the hints. I will try some different weighting functions and > see what fits best. > > Thomas >
Hi Thomas - from your discription it sounds as though you don't window again after the ifft and before you reassemble your overlapped blocks - I would certainly try this , in fact I would try doing this without windowing in the forward process first then try different weights in the forward/return direction. Best of Luck - Mike
This is a long-established phase vocoder technique typically termed 
cross-synthesis. The phase vocoder does overlap add (or overlap-save, whichever) 
FFT analysis/resynthesis, generating a stream of frames of (usually) amp/freq 
data). It can be done in real-time (apart from a bit of latency), and you can 
find a lot of examples in Csound (e.g  the "pvscross" opcode, which applies the 
spectrum of one sound onto the frequency data of another, frame by frame). Also 
look up "FFTease" for the phase vocoder processes concocted by Eric Lyuon and 
Christopher Penrose. They are now mostly known in their incarnation as externals 
for Max/MSP, but the original command-line programs are still around (e.g. 
"PVNation", "PowerPV"). Their code is based on the phase vocoder code included 
in "Elements of Computer Music" by F.R.Moore.

Also, Stephan Sprenger's "dspdimension" page (www.dspdimension.com) has an 
example phase vocoder implementation. That example does pitch shifting, but of 
course once you have a stream of analysis frames, you can do whatever you want 
with them!


Richard Dobson



Dr. Thomas Radtke wrote:
> Rune Allnor schrieb: > >> OK... your processing scheme "requres" an FFT. Why? What is >> it you do in frequency domain that can not be done in time >> domain? > > > Replacing the amplitude spectrum, leaving the phase as it is. The new > spectrum is similar to the one to be replaced. >
Dr. Thomas Radtke wrote:
> Rune Allnor schrieb: > > > OK... your processing scheme "requres" an FFT. Why? What is > > it you do in frequency domain that can not be done in time > > domain? > > Replacing the amplitude spectrum, leaving the phase as it is. The new
> spectrum is similar to the one to be replaced.
To me, this sounds as a zero-phase filter. Is is possible to use a linear phase filter and delay the output stream sligthly? Rune
Jerry Avins schrieb:
> > You might look into sliding FFT. Perhaps you can devise a sliding IFFT > (shouldn't that be FIFT?) to use with it. > http://www.hunteng.co.uk/bench/fft-bench.htm >
If nobody did it before then I guess thats not too easy for a hobbyist but more a project for a *real* Engineer/Scientist;). Anyway, a sliding window sounds exactly like what could be the solution here. I'll have a closer look at it. Thomas