DSPRelated.com
Forums

How to decimate/nterpolate in frequency domain and recover a proper causal time signal ?

Started by scoubi November 20, 2006
Hi Jason,

I've worked on what we told yesterday, but I don't still manage to get
any results for the moment; Actually, I'm getting stuck on the problem
of the interpolation.
I really have some difficulties in putting the theory into practice
(and certainly integrating all what the theory initially involves, a
task which may take several months).
Could you help me further by providing me a small example in matlab
code, starting from the decimation of a complex spectrum, including the
convolution calculation and going until the correction of the time
signal obtained by ifft, in the case of the sinc interpolant ?

Thank you very much in advance.

Scoubi

> Could you help me further by providing me a small example in matlab > code, starting from the decimation of a complex spectrum, including the > convolution calculation and going until the correction of the time > signal obtained by ifft, in the case of the sinc interpolant ?
What sort of data does your vibro-acoustic tool directly measure? Does it generate frequency-domain values directly at its output, or does it generate time-domain measurements which you then FFT to get to the frequency domain? If you have the time-domain data and you would like to get more detail in the frequency domain, it is as easy as zero-padding the time signal before inputting it into the FFT; this will give you an FFT evaluated at more points. So, if you actually have access to the time-domain values, you can just zero-pad your sample to get more finely-grained FFT bins. If you only have frequency-domain values, then you can do the dual of time-domain interpolation (upsample in frequency, inverse transform to get the time-domain signal, then "chop" the signal in an analogous way to lowpass-filtering the signal in the time-interpolation case) to get the resolution you want. Also, are you doing this in real time? If real-time operation is not a requirement, I would consider the possibility of just storing the samples for later computation; if you're trying to impose real-time operation when it's not really required, you can end up making tradeoffs like what you're proposing when you really don't need to. Jason
scoubi skrev:
> Hi everyone ! > > I'm new in this group and quite intermediate in DSP applications. I'm > facing the following problem in the framework of my study. > > I've got some 4 seconds recorded sounds (44100Hz, 16bits) for which I'd > like to modify the FFT spectrum. Actually, I'd like to replace at a > constant rate (e.g. 3 values every four values, from the DC component) > some initial values with "new" values issued from the linear > interpolation between the remaining values, and get back the > corresponding modified sound, thus keeping the same sampling frequency, > i.e. 44100Hz.
This seems to be an interesting exercise, although a bit off "the beaten path". What do you hope to achieve by this?
> I've thought about the following steps for the process : > - first, applying FFT to get the original spectrum.
OK
> - then, retaining 1 value every 4 values from sample 0 to > sample N/2, amounting in a way to frequency decimation,
Yes...
> - Interpolating linearly the real and imaginary parts of the spectrum > to recover values at the decimated frequency bins.
This is the hard part, but leave it for now....
> - reconstituting the complete spectrum [0-Fe[ by flipping complex > numbers 1 to N/2 of the vector obtained at the previous step, taking > their conjugate and concatenating them with the above vector,
Some details to keep track of, but correct...
> - finally, recompute the time signal by processing an ifft on the > previous sequence and keeping the real part of the result.
Correct.
> I've tried this process but it seems it doesn't work : the obtained > time signal looks really distorted, probably owing to a phenomenon of > time aliasing.
No, the problems are not due to time aliasing. Not time aliasing alone, at least..
> I've read in the litterature about decimation / interpolation > especially in the time domain (and problems of frequency aliasing), but > I've found nothing about equivalent processes in the frequency domain.
Few, if any, such techniques are implemented in frequency domain.
> I'm really getting stuck on this problem; can anyone help me to detect > where my reasonning is erroneous and indicate me how to process in a > proper way to obtain the expected result ?
Well, it's hard to guide you to an expected result, for the simple reason that I don't know what results you expect. Indicating whiy you have problems is easier. The issue is that there are very strong relations between the real and imaginary parts of the spectrum in causal real-valued sequences. To get this right requires that you to solve a system of two complex-valued integral equations, which is not something one attempts unless one absolutely has to (and most likely, not even then). The theory is outlined in Oppenheim and Schafer's book from 1975. Rune
scoubi skrev:
> > What exactly are you trying to accomplish? > > Actually, I'm trying to make a parallel between the numerical and > experimental parts of my work that deals with the sound quality of > structures. > In short, I'm going in a future stage to calculate with a > vibro-acoustic tool (in the frequency domain) some sounds radiated by a > structure, from the knowledge of its vibratory velocities. But, owing > to computation limitations, I will not be able to calculate the > frequency responses (complex spectra of the noises) with a fine > frequency step (at best maybe 1 or 2 Hz), I will then have to linearly > interpolate the spectra to create additional "fictive" values and then > get a sufficient number of values (i.e. 176400) so that, when going > back to the time domain by IFFT, I can get a sound sample 4s in length > of quite good quality, i.e. involving a sampling rate compatible (i.e. > 44100 Hz) with the purpose of subjective evaluation I wanna run. > Thus, from the radiated sounds I have already recorded experimentally > (the same as the ones I will calculate), I'd like to collect some > useful information about the value of the maximum frequency step I > could later use in simulations without significantly modyfing the > perceptual trends I would get from an evaluation of the recorded > noises, modified following the procedure we are discussing (and thus > involving a first stage of "decimation" to simulate the future coarse > frequency step used under the vibro-acoustic tool). > > Sorry if I have dwelt too much, it may be a little boring or confuse ! > :-)) > But this is the why of the how :-)
Let's see if I have understood: - You have some structure where you have done acoustic measurements - You have some computer model for the same structure, that works in frequency domain but has certain limitations - You want to compare the measured and modeled data - Your efforts are motivated by the need to get the model data with the correct sampling frequency If the above is correct, this is what I would do: - Run the computer model with parameters that are acceptable for the model code, and get whatever sampling frequency pop out - Interpolate the modeled data in time domain (splines?) and re-sample to 44.1 kHz in time domain. Rune
Hi Jason,

Thanks for your help,

> What sort of data does your vibro-acoustic tool directly measure?.... >... or does it generate time-domain measurements which you then FFT to get to the > frequency domain?
Yes I've got the time-domain measurements, what I measured was the acoustic pressure (with a microphone), but...
> If you have the time-domain data and you would like > to get more detail in the frequency domain, it is as easy as > zero-padding the time signal before inputting it into the FFT; this > will give you an FFT evaluated at more points.
... actually, I'm not trying to get more detail in the frequency domain, I'm rather trying to ''reshape'' the FFT spectrum of my time-domain measurements.
>... If you only have frequency-domain values, then you can do the dual > of time-domain interpolation (upsample in frequency, inverse transform > to get the time-domain signal, then "chop" the signal in an analogous way to > lowpass-filtering the signal in the time-interpolation case) to get the > resolution you want.
At some point, I had looked for this possibility of proceeding, but found nothing quite explicit. Would you have a reference explicitly describing what you called the "choping" process and defining the dual of low-pass filtering for frequency interpolation (I don't manage to visualize what it could be) ?
> Also, are you doing this in real time? If real-time operation is not a > requirement, I would consider the possibility of just storing the > samples for later computation; if you're trying to impose real-time > operation when it's not really required, you can end up making > tradeoffs like what you're proposing when you really don't need to.
I'm not really sure about in what the real-time operation consists, but I would say no. Thanks in advance, Scoubi.
Hi Rune,

Thanks a lot for looking into my problem.

I'm gonna go over your two previous messages.

>... The issue is that there are very strong relations between > the real and imaginary parts of the spectrum in causal > real-valued sequences. To get this right requires > that you to solve a system of two complex-valued integral equations, > which is not something one attempts unless one absolutely has to > (and most likely, not even then).
Do you mean that I should deal with this system of integral equations since the decimation-like process I mentioned ? Does the term ''integral'' mean that only the continuous-time issue is dealt with in the reference you gave ? Are these equations anywhere written for the discrete-time issue (DFT) ?
> Let's see if I have understood: > > - You have some structure where you have done acoustic > measurements > - You have some computer model for the same structure, > that works in frequency domain but has certain limitations > - You want to compare the measured and modeled data > - Your efforts are motivated by the need to get the model > data with the correct sampling frequency
You've all well understood...
> - Run the computer model with parameters that are acceptable > for the model code, and get whatever sampling frequency > pop out > - Interpolate the modeled data in time domain (splines?) > and re-sample to 44.1 kHz in time domain.
... but, actually, one of the parameters I have to set is precisely the frequency step. The value I opt for will notably have an effect on the resolution of the computed frequency responses (and e.g. its peaks). The subjective evaluation of the recorded sounds I modify according to the entire process I described in my first post precisely aims at checking whether the adopted value of frequency step is ''acceptable'' from a perceptual point of view. That's why I was thinking about acting in the frequency domain. In addition, the time-domain resampling may involve additional operations such as low-pass filtering in the frequency domain (doesn't it?), which is not necessarily desirable. Does this help to clarify the problem or rather make it more obscur ? Scoubi.
scoubi skrev:
> Hi Rune, > > Thanks a lot for looking into my problem. > > I'm gonna go over your two previous messages. > > >... The issue is that there are very strong relations between > > the real and imaginary parts of the spectrum in causal > > real-valued sequences. To get this right requires > > that you to solve a system of two complex-valued integral equations, > > which is not something one attempts unless one absolutely has to > > (and most likely, not even then). > > Do you mean that I should deal with this system of integral equations > since the decimation-like process I mentioned ? Does the term > ''integral'' mean that only the continuous-time issue is dealt with in > the reference you gave ? Are these equations anywhere written for the > discrete-time issue (DFT) ?
If you want to implement time-domain re-sampling in the form of frequency domain interpolation, you *have* to deal with the integral equations. That does NOT mean you *should* deal with them. In fact, those integral equations are very compelling reasons for solving your task by other means than spectrum interpolation. As for the integral equations, they are formulated in z domain. The z transform of a discrete-time sequence is continuous in z domain, and these equations represent z transforms of a certain representation of the discrete-time causal signal.
> > Let's see if I have understood: > > > > - You have some structure where you have done acoustic > > measurements > > - You have some computer model for the same structure, > > that works in frequency domain but has certain limitations > > - You want to compare the measured and modeled data > > - Your efforts are motivated by the need to get the model > > data with the correct sampling frequency > > You've all well understood... > > > - Run the computer model with parameters that are acceptable > > for the model code, and get whatever sampling frequency > > pop out > > - Interpolate the modeled data in time domain (splines?) > > and re-sample to 44.1 kHz in time domain. > > ... but, actually, one of the parameters I have to set is precisely the > frequency step. The value I opt for will notably have an effect on the > resolution of the computed frequency responses (and e.g. its peaks).
I know, but my point is that it is better for you to accept whatever pops out of that model, provided the data are good, and treat the resampling as a separate issue. Frequency-domain models are difficult enough as it is, even whithout trying to force them into a particular time domain representation. Handle the modeling and the resampling as two separate stages: First make data that you are happy with, that have arbitrary sampling parameters; then resample to 44.1 kHz.
> The subjective evaluation of the recorded sounds I modify according to > the entire process I described in my first post precisely aims at > checking whether the adopted value of frequency step is ''acceptable'' > from a perceptual point of view. That's why I was thinking about acting > in the frequency domain.
Again, these are separate issues. The model may be specified in frequency domain, but that doesn't mean you have to do all your computations in frequency domain.
> In addition, the time-domain resampling may > involve additional operations such as low-pass filtering in the > frequency domain (doesn't it?), which is not necessarily desirable.
Time domain *decimation* requires LP filtering. That's a non-issue here, since you want a denser spectrum. Implicitly, this means that you want a data sequence with the same duration but denser samples in time domain. This is not decimation, it is up-sampling. Model your data and then do an up-sampling. As long as the bandwidth of your modeled data is lower than 22 kHz, your only consideration is to model good data of the correct duration. Once you have the time series, you use a time domain method to resample. Rune