(Dec 28 2010)

#### Shift to baseband and decimation in Linrad.

The hardware typically supplies data at some fairly high sampling speed. The normal procedure in DSP technology is to apply frequency mixer to move the interesting signal to DC and to apply a reasonably "cheap" filter that will attenuate more than e.g.120 dB above a certain frequency that is an integer fraction, N times smaller than the Nyquist frequency. One can then resample to a lower speed by only taking every Nth sample. (One would not compute the not needed ones in a FIR filter.)

In Linrad the filtering and decimation is made in the frequency domain. The first step is to compute an FFT. It is needed anyway for displaying power spectra and waterfall graphs. Linrad would then pick a fraction of the FFT bins and do a back transform from them. That is a frequency mixer, filter and decimation in one step. This procedure has obvious problems if transforms are small. A signal with a frequency that is not precisely on the frequency of an FFT bin is distributed over several bins. In case not all of them - or none of them is included in the back transform the signal will not be correctly reproduced. The problem is partly solved by use of a window function in the selection of the bint to apply the back transform on. This way the neighbouring bin will never differ too much in amplitude to create large errors. The decimation ratio as well as the window function used affect the performance of the first filter/decimate step in Linrad.
This page gives some examples with fairly small sizes for the full bandwidth FFT (fft1 or fft2.) The fft bandwidth is set to 1 kHz which means that the 6 dB points of the window function are separated by about 1 millisecond. The total time that the fft buffer would span will differ depending on the window used. With no window the buffer would span 1 ms, with a sine squared window the FFT buffer would span 2 milliseconds. A sine to power 7 window would span about 5 milliseconds. The time delay from antenna to loudspeaker will increase in proportion to the size of the FFT buffer. Selecting a narrower fft bandwidth and a less demanding window might give a fast enough response with adequate filtering at a much lower CPU load.

The optimum window selection depends on the desired bandwidth and decimation rate. The examples below all use the file sim1.wav (213375062 bytes) which can be downloaded here as a zipped file: sim1.zip (170614292 bytes)

#### Selected FFT1 bandwidth = 1 kHz with the erfc window.

The size of the first FFT will be 512 with the erfc window and the actual bandwidth will be 1.3 kHz. The delay due to the first FFT buffer will thus be 1.024 ms only. When decimating by a factor of 8 (2 to power 3) the baseband sampling rate becomes 67.5 kHz and the performance is excellent as can be seen in figure 1. Fig. 1.The FFT bandwidth is set to 1 kHz with the erfc window and decimation is set to 8 (two to power 3.) There are no spurs as can be seen in the S-meter graph.

When decimating by a factor of 16 (2 to power 4) only 32 of the 512 fft bins will be used for back transformation. That is enough, but there is no margin as can be seen in figure 2. Fig. 2.The FFT bandwidth is set to 1 kHz with the gaussian window and decimation is set to 16 (two to power 4.) A couple of weak spurs are visible close to the signal at -130 dB. With real hardware they are well below the noise.

When decimating by a factor of 32 (2 to power 5) only 16 of the 512 fft bins will be used for back transformation. The spurs are then at a level of about -90 dB as can be seen in figure 3. Fig. 3.The FFT bandwidth is set to 1 kHz with the gaussian window and decimation is set to 32 (two to power 5.) There are spurs that limit the dynamic ranbge to about 90 dB as can be seen in the S-meter graph.

#### Selected FFT1 bandwidth = 1 kHz with the Gaussian window.

The size of the first FFT will be 1024 with the Gaussian window and the actual bandwidth will be 1.2 kHz. An FFT1 buffer will span 2.048 ms. When decimating by a factor of 8 (2 to power 3) the baseband sampling rate becomes 67.5 kHz but that is not quite enough to avoid spurs as can be seen in figure 4. Fig. 4.The FFT bandwidth is set to 1 kHz with the gaussian window and decimation is set to 8 (two to power 3.) There are spurs that limit the dynamic ranbge to about 90 dB as can be seen in the S-meter graph.

By only decimating by a factor of 4 (to 125 kHz) one can get a spur level of about -115 dB with the Gaussian window at an fft1 bandwidth of 1 kHz. See figure 5. Fig. 5.The FFT bandwidth is set to 1 kHz with the Gaussian window and decimation is set to 4 (two to power 2.) There are spurs that limit the dynamic range to about 115 dB.

The much nicer spectral response in the main spectrum that can be obtained with the Gaussian window causes twice as much delay as the erfc window and further it requires a high baseband sampling speed for adequate spur suppression. Such parameters may be fine for QSK CW or fast break-in SSB, but it will not work with coherent modes or very narrow baseband filters. That is not really a limitation because when a narrow baseband filter is desired one can also set a narrower FFT1 bin bandwidth.

The sine to power 7 window is a little better than the Gaussian window, but sine squared is not very good.

For very fast response the erfc window is clearly the best.

#### Selected FFT1 bandwidth = 100 Hz with the erfc window.

The size of the first FFT will be 8192 with the erfc window and the actual bandwidth will be 81 Hz. The delay due to the first FFT buffer will thus be 16.4 ms. Spurs do not become clearly visible unless the decimating factor is very large.

When decimating by a factor of 512 (2 to power 9) the baseband sampling rate becomes 976 Hz only and the baseband bandwidth can not be set higher than about 800 Hz. See figure 6. The back transformation will then be 16 points only and that results in strong spurs. The spurs are all close in frequency however and may be harmless. The advantage of setting a large decimation is that the low sampling speed in the baseband will allow very high resoultion in the baseband at a low CPU load. Fig. 6.The FFT bandwidth is set to 100 Hz with the erfc window and decimation is set to 512 (two to power 9.)

With a decimation of 256 and less there are no spurs with the erfc window at an fft1 bandwidth of 100 Hz or less.

#### Selected FFT1 bandwidth = 100 Hz with the other windows.

With a decimation of 32 (two to power 5) sine to power 3 and higher is fine as well as the Gaussian window.