# Is there any way to make a sampling rate reduction in the frequency domain?

Is there any way to take advantage of the frequency domain to make a clean/nice sampling rate reduction effect ? and how ?

Basically, deducted from my tests:

• if I set to 0 the magnitude uppon a certain threshold I only get a filter(quite obvious...)
• if I set to 0 one sample over 2 before the buffer transfrom it's not at all some freq domain processing ( if I do the same on the transformed buffers it's also a filter)

Is it possible to make SR reduction in the freq domain ? (actually I have some overlapped phase and magnitude arrays...)

If you multiply a frequency spectrum by a low-pass filter frequency response, this could leave an area in the resulting spectrum around Fs/2 zero, or nearly so, depending on the filter response. Don't use a low-pass filter with a rectangular frequency response by just zeroing FFT bins, as this frequency response has severe ripples in both the stop band and pass band.

When working with the frequency response from a DFT/FFT, after you have filtered a sufficient number of bins around Fs/2 to zero, or nearly so (down to your desired noise level), you can shorten the FFT vector by removing those bins symmetrically around Fs/2. Given a shorter complex vector in the frequency domain, an IFFT of this vector will produce a shorter vector in the time domain, equivalent to a lower sample rate over the same time period. The lower the cutoff of the low-pass filter, the shorter the truncated vectors can be, the more you can lower the sample rate.

If the frequency response is already sufficiently low-pass, or you don't care about severe ripple in the resulting frequency response, you can just reduce the size of the FFT vector and IFFT to reduce the sample rate.

• ok I see, so basically If I have a 512 samples fft: (1) I transform, (2) I set the half upper part of the bins to 0, (3) I make a 256 samples ifft instead of the expected 512 samples inverse transform. – az01 Oct 10 '11 at 23:45
• Set the bins around Fs/2 to zero, e.g. bins [128..383] out of [0..511]. Is that what you mean by "upper part"? That will halve the sample rate. But pre-filtering with a suitable low-pass function will make this sample rate reduction less noisy. – hotpaw2 Oct 10 '11 at 23:49
• I want to note that this approach is not equivalent to the typical time-domain implementation of a lowpass filter followed by a downsampler. The exactly equivalent (up to the limits of numerical precision) operation is described in the other answer, where you sum in the residual stopband energy that aliases into the passband after downsampling. It seems that the truncation approach described here would be equivalent to cascading your proposed lowpass filter with a brick-wall filter that eliminates the frequency bins that are being thrown out. I think that could cause time-domain ringing. – Jason R Oct 11 '11 at 0:49
• @Jason : Yes, this will cause ringing if the brick wall filter is around or lower than the transition frequency of the low pass filter. But if the stop band attenuation is low enough, the values that should have been "stack-and-added" will be in the noise floor. – hotpaw2 Oct 11 '11 at 2:52
• @hotpaw2: The problem with this approach (as I understand it) is to reduce the time-aliasing distortion that is introduced when manipulating the FFT bins (by e.g. zeroing out some of the bins). The implied circular convolution can lead to a noisy result. Proper zero-padding in the time-domain (before FFT) and careful smoothing of the FFT bins may lead to less noisy result. – niaren Oct 11 '11 at 6:13

Yes, you can do what you're looking for. Think about what happens in the frequency domain when you downsample a signal in the time domain: the spectrum "folds over" on top of itself and sums, the well-known aliasing effect. If your signal is already sufficiently bandlimited, then you can obtain the downsampled time-domain signal without computing the samples that you would subsequently throw out.

Given a signal $x[n], n = 0, 1, \ldots , N-1$ that has DFT $X[k], k = 0, 1, \ldots , N-1$, a new signal $x_d[n]$ that is $x[n]$ decimated by a factor $D$ can be generated by:

$$X_d[k'] = \sum_{d=0}^{D-1} X[k' + d\frac{N}{D}], k' = 0, 1, \ldots , \frac{N}{D} - 1$$

$$x_d[n] = IDFT(X_d[k'])$$

The inverse DFT (and subsequently $x_d[n]$) is of length $\frac{N}{D}$. This method is sometimes referred to as "stack and add".

• What is the length of Xd[k] here?... Shouldnt it be of length N/D, and so therefore cannot have k as an index? (Since k is from 0 to N-1)? – Spacey Oct 14 '11 at 16:10
• Good catch of the sloppy notation. I fixed it. – Jason R Oct 14 '11 at 16:36
• no problem - however the "k" is supposed to be a "k'" in the new equation too. :-) – Spacey Oct 14 '11 at 17:17
• We should be good now. – Jason R Oct 14 '11 at 18:25