```Hi Mark,

> Do I need to do this bandpass filtering before I do the complex FFT below,
> or can I use filtering in the frequency domain? If I do filter it here,
> should I decimate the sample to a lower sampling rate before
> doing the FFT?
No.

Do the FFT of the input. If the input is complex (I and Q) or
if it is real valued (single audio channel) does not matter.
The output will be in complex format in both cases.
If you use a complex FFT algorithm on a real input,
just skip half the output (but it is better to use a real to
hermitian FFT)

> > Now you have to demodulate SSB, choosing between USB and LSB. To do
> > this, you compute a complex
> > FFT on your complex signal described by I and Q, the first half of the
> > transform output describes the
> > USB component, while the second half describes the LSB.
> > You just take the half you are interested in, do a mirroring and a
> > complex conjugation of it, filling the other
> > half with the result of this, and finally compute an inverse
> complex FFT.
> > The (real) result is the demodulated audio.
You do not demodulate SSB. Just pick those frequency bins in which
the desired signal falls. It is a good idea to use a window in the
frequency domain to not have the amplitude going from 1 to zero
from one bin to the next.

When you have picked the bins you want, then shift them to the right
frequency which means put the bin where the suppressed carrier should be
at frequency zero. See the FFT data as residing in a circular buffer.
You can renumber freely, just remember direction of rotation.

When you do the back transform you get the SSB signal for
the loudspeaker directly. It is a complex time function I and Q.
just pick one of them, skip the other.

In case you find that more than 50 % of the FFT buffer is filled
with zeroes you can reduce the number of points and do the
backwards transform in a smaller size and get an output time
function with a lower sampling speed. This is the way Linrad
operates. The code from fft1/fft2 to the baseband is in mix1.c
and the baseband processing is in mix2.c. Both contain the function
of a filter, a frequency shift (mixer) and a resampling.

73

Leif / SM5BSZ

>
> I think I understand what you are saying, but let me make sure.  A graph
> would be helpful, but I'll try and explain my understanding in words.
>
> Lets say that I do a 1024 point complex FFT and the (complex) bins are
> numbered from 0 to 1023.  The contents of bins 0 to 511 represent the USB
> signal and bins from 1023 to 512 represent the LSB.
>
> To receive USB, I replace bin 1023 with the complex conjugate of
> bin 0, bin
> 1022 with the CC of bin 1, 1021 with CC of bin 2 and so forth.
>
> To receive LSB, I replace bin 0 with the CC of bin 1023, 1 with the CC of
> bin 1022, etc.
>
> > Naturally, while you are at
> > this, it is a breeze to apply a bandpass
> > filtering, using the windowed sync approach, while you are in the
> > frequency domain. This allows to change
> > the bandpass limits in real time, perhaps under user control with the
> mouse.
>
> and it looks
> pretty impressive. Is the source code of at least the demodulation
> available? A lot of time, I can understand an algorithm better if it's
> expressed in code, even if it's not in a language that I use.
>
> > 73  Alberto  I2PHD
>
> > P.S. An excellent book on this stuff is "Digital Signal Processing in
> > Communication Systems",
> > by Marvin E. Frerking, ISBN 0-442-01616-6
>
> Thanks for the pointer on the Frerking book.
>
>
> Thanks again and 73,
> Mark
>

```