SM 5 BSZ - PC RADIO (1): Convert from real to complex data
(Oct 3 1998)

Real vs complex sampling

Sampling real data at 44kHz produces the same amount of information as sampling complex data at 22 kHz.

It is easier to use the computer efficiently with complex sampling because unwanted signals come at high audio frequencies regardless of their position (above or below) the desired frequency range. Unwanted signals can thus be removed by simple low pass filters at audio frequencies. Crystal filters may be used to improve the dynamic range, but direct conversion without narrow filters can produce quite good results.

For the PC radio complex sampling can not be used since the soundblaster has only 2 inputs while 4 are needed to sample the I and Q signals from the two orthogonal antennas H and V.

Another reason to not use complex sampling is that the sound board is not DC coupled so there will be a notch, (infinitely deep) and with a shape corresponding to the high pass characteristics (back to back) of the sound board in the 0 to 50Hz region. Of course the board can be modified so it becomes DC connected, but the stereo radio would need 2 sound blaster boards with syncronised clocks.

Equivalent solutions

The 3 different solutions below produce the same result. They are all designed for 20kHz bandwidth and 100 dB stop band rejection. The 3 different solutions use a crystal filter with 20kHz bandwidth at the 3dB point, but the stop band rejection required is very different.


                              (1)          (2)        (3)
                            Complex      Complex      Real

Sampling rate                22kHz        44kHz      44kHz
FFT size                     1024         2048        2048
X-tal BW for -100dB            -          60kHz      24kHz
Anti alias filter -3dB       10kHz          -          -
Anti alias filter -80dB      12kHz          -          -

Solution (1) is not suitable for a stereo system using Sound Blaster SB16 boards, but it may be a good solution for a single channel receiver. The anti alias filters built into the SB16 board provide something like 20dB, so the combined attenuation of the crystal filter and the audio low pass filters 2 kHz outside the passband limit does not have to be more than about 80dB.

Solution (2) is a "conventional" solution. The data is oversampled so the filter requirements are reduced drastically. This is a good solution for a single channel receiver because the doubled FFT size can easily be handeled with modern PC computers.

Solution (3) uses a very steep crystal filter to reject unwanted frequencies. It is of course possible to use an asymmetric filter that is very steep on one side only because it is only at the edge where the local oscillator is that all filtering has to be done by the crystal filter. The opposite edge can be improved by a low pass filter at 21kHz. The 2048 FFT has real data as imput with this solution and that makes some time saving possible.

Digital frequency mixing

The data points are multiplied with a sine and a cosine function at half the Nyquist frequency. This is exactly the same as feeding the audio signal to a pair of frequency mixers fed by a local oscillator in quadrature at 11kHz then sampling both signals at 44kHz. In both cases the output contains sum and difference frequencies so very good low pass filters are required to remove the sum frequency. These filters are the anti alias filters required to allow a resampling at 22 kHz without the introduction of spurious signals.

The sine and cosine tables are simple. They are these sequences:
sin=0,1,0,-1,0,1,0,-1,.....
cos=1,0,-1,0,1,0,-1,.....
obviousely no multiplication is really needed. By unrolling the loop multiplication is converted to making every second point zero and reversing the sign of every fourth point.

The digital low pass filter is a simple IIR filter using only additions and shifts. Unacceptable aliasing occurs outside a 15kHz passband centered at 11kHz. Over the central region of the spectrum the alias signal is suppressed by 40dB or more. If a standard FM filter with 12kHz bandwidth is used the alias signals due to inadequacies of this filter comes outside the passband.

With the very steep IF filter it is meaningful to process more bandwidth. The current passband is 0.86 to 21.14kHz corresponding to the 10dB points of the IF filter, so the processed bandwidth is 20.3kHz. The alias signal which is only 10dB below the desired signal near the edges has a phase and amplitude in relation to the desired signal that depends on the IIR filter characteristics.

Since both the desired signal and the alias signal are processed by the computer it is possible to correct for the inadequacies of the IIR filter by adding an extra loop in the FFT with a simple "butterfly stage" in which the coefficients are selected to match the IIR filter. This kind of alias removal suppresses the alias signal by another 60 dB if optimum coefficients are used.

In a time critical 8 bit system it is a good idea to ommit the IIR filter which means that conversion from real to complex data followed by resampling is just taking the data points in a different order sometimes with reversed sign. The extra "butterfly stage" will remove the alias at minimum CPU load. The coefficients then are sin and cos, which are already needed by the FFT routine. The zeroes for the imaginary part going into the real FFT of N points will not be used and the input samples are filled into both the real and the imaginary parts for a N/2 complex FFT.

Implementation

The interrupt routine receives a block of 16 bit integer data from the sound board in a small buffer. The data is converted to 32 bit integers so no loss of precision is introduced by the IIR filter. The interrupt routine also sets the amplitude and frequency of one of the voices of the FM music chip of the Soundblaster. In this way a modulated tone is obtained for the output audio signal.

The block size for the A/D data controls the update rate for the output tone. With the current program version the output signal bandwidth has to be below 150Hz.

The interrupt routine is present in two versions for fast response both when the processor is in real mode (16 bit) and protected mode (32 bit). The interrupt routines are placed in SBKINT.ASM.

To SM 5 BSZ Main Page