3
$\begingroup$

I have written a Software Defined Radio. I take I/Q audio into the computer at a 192K sample rate and perform a 4096 sample Complex FFT. I display the spectrum (PSD) to the user so they can pick the signal they want to listen to, and capture the given frequency bin. So far so good.

I copy a set of frequency bins around the selected bin (based on the bandwidth I want) to baseband, following the approach in the QEX article "SDR For the Masses" by Youngblood. I multiply the copied bins with a blackman window whoes width is the same as the bandwidth. I then run an inverse FFT, and FM demodulate using a fast Arctan algorithm.

Everything works well, except with some frequency bins I get terrible phase distortion and at some bins it sounds perfect. I can literally nudge the center bin a few to the right or left and clean up the audio completely.

I read that this is an issue associated with copying the bins to baseband and that only certain bins avoid the issue. Specifically the paper says:

The mixing precision is limited further by the fact that we don't use complete buffer of output in fast convolution. We use only L samples. We must restrict the mixing to the subset of frequencies whose periods complete in those L samples. Otherwise, phase discontinuities occur. That is, one can only shift in multiples of V bins

So my question is how do I determine which bins are good? I have tried many calculations to get "V", which is the Overlap Factor but can't seem to find an algorithm that sorts the good bins from the bad. I think it's because V is defined in terms of the filter length and I do not know my filter length


I can also comment on the alternative approach, which is mixing in the time domain. I have written a Numerically Controlled Oscillator (NCO) to generate a Complex "carrier" and multiplied it by the I/Q signals thus: $$ i = i \sin(p) + q \cos (p) \\ q = q \cos(p) - i \sin (p) $$ (where $p$ is the phase accumulator).

This also works well and you get nice clear audio after FM demodulation. But it needs to be low pass filtered, otherwise you FM demodulate the entire IF. When I low pass filter it, again it sounds terrible. Much worse than copying the bins.

My understanding is that a complex signal can be filtered with a linear filter by just filtering the I and Q individually. I have lots of digital filters working for other audio purposes, but in this case they do not work. I tried IIR filters (because of linear phase response) as well as FIR, but no difference.

$\endgroup$
5
  • $\begingroup$ It would be really useful if you could post links to articles you refer to. If you can't do it directly, try posting them in comments and someone will edit them in. $\endgroup$
    – AndrejaKo
    Jun 12, 2015 at 17:46
  • $\begingroup$ By the way, this is very related to what I'm doing now, so I'm really interested in helping out. $\endgroup$
    – AndrejaKo
    Jun 12, 2015 at 17:50
  • 1
    $\begingroup$ Also, could you post a block diagram of what you're doing exactly? Are you doing FFT directly or are you using some sort of filtering before FFT, using a window function or something similar? How does it work for say SSB signals, which only need down-conversion? $\endgroup$
    – AndrejaKo
    Jun 12, 2015 at 17:55
  • $\begingroup$ I have updated my question to make it clear that I am windowing the bins I copy and I have referenced the papers I read. I have also added a note about the alternative approach, which is mixing the signal to baseband and not using the FFT. $\endgroup$ Jun 13, 2015 at 19:18
  • $\begingroup$ Thanks for the useful update. I'll report back when I finish analyzing everything. $\endgroup$
    – AndrejaKo
    Jun 13, 2015 at 21:11

1 Answer 1

2
$\begingroup$

I don't have a complete understanding of the implications here, but here's a vague gesture in the direction of the answer which might be helpful.


What you are doing is filtering. And you've defined your filter as a brick-wall in the frequency domain (by copying some bins and ignoring the rest), without regard for the phase or time-domain characteristics. Therefore it's garbage in those ways.

I'll guess that you should be able to fix the phase response by applying the appropriate phase offsets to each bin, but I don't know what those offsets would look like (likely linear).

FFT-modify-IFFT is a valid implementation strategy for a filter, and it can be more efficient than a straightforward FIR filter while getting the same answer, but you need to actually design a sensible filter (not a rectangular-in-the-frequency-domain one) to use it with.


Here's a question over on Signal Processing Stack Exchange that I think is essentially the same question. The answers aren't all that illuminating for me, though, so I don't know if it'll help you: What are the problems with designing an FIR filter using FFT? The answers suggest that part of the problem with this approach is that it's defining the filter to be perfect at each frequency bin but disregarding its characteristics at the frequencies between the bins.

$\endgroup$
5
  • 1
    $\begingroup$ I'm not sure if what's happening here is filtering, it really looks like FFT downconversion (which does include filtering internally, more or less explicitly). See first figure on this page. The linked answer is more related to getting FIR filter using frequency sampling. $\endgroup$
    – AndrejaKo
    Jun 12, 2015 at 22:43
  • 1
    $\begingroup$ Well, it's both. But you are quite likely right that the downconversion is more relevant to the phase problem. I'm not sure — I tried to think about what happens and couldn't work it out in my head. Really, need an answer from someone who knows the details of this area of DSP. $\endgroup$
    – Kevin Reid AG6YO
    Jun 12, 2015 at 23:07
  • $\begingroup$ I'm sort of doing that right now, but only at an introductory level at unniversity. In any case, I just found the referenced article, so I'll have to make some sense of what exactly is OP doing and then try to figure out what could be happening. $\endgroup$
    – AndrejaKo
    Jun 12, 2015 at 23:37
  • 1
    $\begingroup$ I'm not actually using a brick wall. I window the section that I copy. Otherwise you get aliases and that sounds bad once it is FM demodulated. I currently use a blackman window on the section, but the type of window does not seem to be critical. I also can toggle windowing the data before it is FFT'd. That makes the spectrum "look" better but makes little difference to how it sounds once demodulated. $\endgroup$ Jun 13, 2015 at 17:26
  • $\begingroup$ @ChrisAC2CZ Those kinds of details are critical. Please update your question to describe all of the operations you're doing, as AndrejaKo already asked. $\endgroup$
    – Kevin Reid AG6YO
    Jun 13, 2015 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .