The fractional resampler in Linrad.
(Dec 17 2010)


Background.

Originally, about year 2000 Linrad was designed to run efficiently on Pentium MMX computers with a single CPU core at 100MHz or so. The soundcards of that time would be used at 5000, 8000 or possibly 11025 Hz for the loudspeaker output. (Soundcards like Soundblaster 16 could be set at an arbitrary frequency in steps of about 100 Hz.)

The input would come from another soundcard running at 44100 Hz. Since input and output use non-synchronous hardware it is necessary to introduce a fractional resampler that can automatically adjust the resampling ratio to accomodate for deviations from the nominal frequencies on input and output.

Linrad uses efficient filters with very high stop band attenuation to extract the baseband signal. The bandwidth would typically be 15 to 500 Hz in CW mode and perhaps 3 kHz or less in SSB mode. To allow efficient baseband processing and correlations over long times the baseband sampling rate is made low. There is no loss of information when an SSB signal of bandwidth 2.75 kHz is sampled at a sampling rate of 5512.5 kHz (44.1kHz/8) Actually the signal would be oversampled and use only 50% of the available bandwidth.

Figure 1 shows Linrad-03.17a run in SSB mode (input from a file with an SSB signal.) The sound device selected for the output is The ALSA module snd-aloop set to a sampling speed of 8 kHz. The right hand side uses snd-aloop for input so the spectrum at the right hand side of figure 1 shows the signal that would normally be the loudspeaker output of Linrad-03-17a.


Fig 1. The left hand side shows an old version of Linrad receiving an SSB signal. The right hand side displays the loudpeaker output by use of snd-aloop, the ALSA virtual audio cable. The output sampling rate is set to 8 kHz.


The resampling from the baseband speed to the output speed creates aliasing at about 3.7 kHz. It is the dominating signal at about 300 Hz that generates an alias. With my old ears I can not hear that artifact, it is in the order of 20 dB weaker than the desired signal and it is at a frequency I can not hear well any more.

Figure 2 shows what happens when the soundcard is set to 48 kHz. There are now many more aliases at higher frequencies. I can not hear them but they may be annoying to people with healthy ears. Those new aliases are caused by the linear interpolation used for upsampling by a power of two.


Fig 2. Same as figure 1 but with a sampling rate of 48 kHz for the output.


With Linrad versions up to 03-17a one would have to use analog filters on the output or the equalizer of the computer sound system to eliminate the false signals above 2.5.kHz. Linrad-03.18 and later has a 5th order Butterworth IIR filter that removes the aliasing caused by the fractional resampler. Figure 3 shows its effect when the loudspeaker output is set to 8 kHz.


Fig 3. The left hand side shows Linrad-03.18 receiving an SSB signal with the output speed set to 8 kHz. Compare with figure 1. The 5th order Butterworth filter makes the difference.


In Linrad-03.18 there is a third order Butterworth IIR filter after the linear interpolation. This way the aliasing created in going from 6 or 12 kHz to 48 kHz is well suppressed as can be seen in figure 4.


Fig 4. Linrad-03.18 receiving SSB with the output sampling rate set to 48 kHz. The high frequency aliases are suppressed by about 70 dB.



To SM 5 BSZ Main Page