Wednesday, September 21, 2016

Centering (downmixing) a signal

Ever want to record a signal but your SDR just didn't have a suitable bandwidth? That's an issue on the SDRplay. If you have a 2.5 MHz signal, for example, the least bandwidth you can use is 5 MHz. That's a lot to record when you just want one signal. And what if you need to use large bandwidth to offset the signal from the center so the DC spike doesn't mess it up? The DC spike can be a huge, almost insurmountable problem in the GHz bands. See the picture below.

Apparently if you record as a WAV and open with Audacity, you can multiply both tracks by a sine wave to shift an off-center signal to the center. However, I don't know how you'd do this for a signal on the left since Audacity doesn't accept negative values.

Here's how it's done, based in part on advice from Steve the Fiddle on the Audacity mailing list:

  1. Open your IQ file
  2. Split it to mono and remove the right track
  3. Create a mono track and generate a sine wave of the desired frequency
  4. Make Stereo Track
  5. Open Nyquist Prompt and run this:
  6. (mult (aref *track* 0)(aref *track* 1))
  7. Remove one side (both will be the same) and save as a mono wav file.
  8. Repeat with the right channel.
  9. Open a new Audacity project and combine the 2 files you just created.
  10. (Obvious) The original left channel (I) must be the left channel in the resulting file, and the same with the right channel (Q).
  11. Finally, see that it worked using HDSDR or something similar.

This is what it looked like when I used a 550 kHz tone. You can see that it's not perfectly centered because 550 kHz was not quite right, but it's very close.

Seeing the double signal, I initially thought I had created a lower sideband but upon closer examination I saw that it was not mirrored like AM should be, but rather duplicated, so this apparently works. You can see the faint carrier at both plus and minus 550 kHz along with the higher, non-mirrored duplicate of the signal.

I then low-pass filtered in Audacity (Effect->Low Pass Filter) to 900 kHz to get just the desired signal.

Now it's much easier to see how off-center it still is. Finally, here's a picture of this in SpectraVue:

This has significant implications not just for analysis but for saving space on IQ recordings.


  1. You've answered your own question about how to deal with "a signal on the left". Your procedure yields a copy at higher frequency in addition to a copy at lower frequency. For a "signal on the left", you would just take the copy at higher frequency rather than the one at lower frequency.

    Actually, you should be able to get just one copy in the first place, which will be important if there are nearby signals. If you multiply the I signal by cos(kx) and the Q signal by sin(kx), you should just get the higher-frequency copy. Multiplying I by cos(kx) and Q by -sin(kx) should yield just the lower-frequency copy.

  2. Actually, the details of that last part are not right. New I should be

    cos(kx)*I - sin(kx)*Q

    and new Q

    cos(kx)*Q + sin(kx)*I

    for shifting up; change the signs on the sin terms to shift down. Or something like that.