Reply by Fred Marshall●February 12, 20052005-02-12
<nospam@om.it.eu.org> wrote in message
news:1107956328.136833.105160@z14g2000cwz.googlegroups.com...
> Hello all,
> I have coded a program that mixes an audio signal with the I/Q
> outputs of a software NCO, causing a translation in frequency, applies
> a FIR lowpass to the results and finally does a downsampling. This of
> course is all done in the time domain.
> I am wondering if there is a technique that produces the same results,
> but that works in the frequency domain. I have the feeling that I could
> save some CPU cycles...
> Feel free to offer suggestions, code snippets, pointers, whatever !
> Also suggestions to forget the idea and continue to work in the time
> domain will be accepted ! Many thanks in advance.
>
> -Fred
You might look at Rick Lyon's book in the appendices where he talks about IQ
downsampling to baseband.
There is another way to deal with a passband signal around f0:
Instead of doing IQ samples, you can multiply by a sinusoid so that the
spectrum of the original passband signal shows up just above (and
below)f=0 - then lowpass:
Original signal center frequency = f0
Bandwidth = B
Frequency span f0-B/2 to f0+B/2
Multiply by a sinusoid at f0-B/2
Yield sum and difference center frequencies:
f0+f0-B/2
f0-f0+B/2
So, the difference frequency spans B/2-B/2=0 to B
The negative frequency component starts at -f0+/-(B/2)
The sum yields:
-f0+f0-B/2
You get the same spectrum centered at B/2 and -B/2 and you had at f0
and -f0.
This needs to be lowpassed at B unless the mixing process already took care
of that.
Note that the number of samples are conceptually the same.
With IQ, the bandwidth is half but there are two samples per sample.
With the above the bandwidth is higher and the samples are real at double
the rate.
Now, how might you do this in the frequency domain?
Neglecting temporal aliasing that you might create in doing so, conceptually
circularly convolve the frequency domain signal with a picket fence of
frequency samples at 0+f0-B/2 and fs-(f0-B/2) This will result in the
non-zero passband spectrum being repeated around zero frequency.
Then you would lowpass filter.
Then you might decimate in time - which is equivalent to considering the
sample rate lower by changing the length of the frequency period.
A gross approach would be this:
Take the samples from f=0 to f0-B/2 and from f=0 to -f0+B/2 out of the
spectral sequence.
This will place the original passband frequency samples just above and just
below f=0. The sample rate will be reduced proportionately by the number of
samples that are removed from the total.
Now you may recognize that the signal is oversampled and reduce the
frequency period by removing the samples between B and fs-B.
Some will scream that removing what are nearly "zeros" will cause temporal
aliasing.
Maybe it will matter. Maybe it won't. And .... maybe I made an mistake
here. I haven't tried it.
Fred
Reply by Mark Borgerding●February 11, 20052005-02-11
nospam@om.it.eu.org wrote:
> Mark,
> thanks for your notes. I have already used the overlap-and-save, so I
> think to be somewhat familiar with it.
> One thing : if I shift samples in the frequency domain, if I understand
> correctly the characteristics of the transform pairs, the time domain
> samples are multiplied by a complex exponential. This means that an
> audio, real, signal becomes a complex signal after the FFT - shift -
> IFFT process. What could be the easiest method to bring it again in
> real form to be sent to a DAC ? Would computing the modulus, with sign
> reinsertion, be an effective technique? Thanks.
>
> -Fred
>
How does your current time domain processing get back to reality?
Shifting k frequency bins to the right is the same as time-D mult. by
the vector, exp( n * k * 2*pi/N )
In order to keep it real, you need to have sum thing left ;)
-- Mark "groans are a form of laughter" Borgerding
Reply by ●February 11, 20052005-02-11
Mark,
thanks for your notes. I have already used the overlap-and-save, so I
think to be somewhat familiar with it.
One thing : if I shift samples in the frequency domain, if I understand
correctly the characteristics of the transform pairs, the time domain
samples are multiplied by a complex exponential. This means that an
audio, real, signal becomes a complex signal after the FFT - shift -
IFFT process. What could be the easiest method to bring it again in
real form to be sent to a DAC ? Would computing the modulus, with sign
reinsertion, be an effective technique? Thanks.
-Fred
Reply by Mark Borgerding●February 10, 20052005-02-10
nospam@om.it.eu.org wrote:
> Hello all,
> I have coded a program that mixes an audio signal with the I/Q
> outputs of a software NCO, causing a translation in frequency, applies
> a FIR lowpass to the results and finally does a downsampling. This of
> course is all done in the time domain.
> I am wondering if there is a technique that produces the same results,
> but that works in the frequency domain. I have the feeling that I could
> save some CPU cycles...
> Feel free to offer suggestions, code snippets, pointers, whatever !
> Also suggestions to forget the idea and continue to work in the time
> domain will be accepted ! Many thanks in advance.
>
> -Fred
>
Yes. This can save a lot of cycles, especially for long filter lengths.
There are a lot of details you need to understand.
First get really, really familiar with overlap-add / overlap-save filtering.
You can downsample in the frequency domain by performing a smaller
inverse fft than forward. To be mathematically correct, you should fold
the energy from the discarded bins into those that are kept (i.e.
perform the aliasing in the frequency domain).
The temporal aliasing that wraps around the DFT buffer will also get
decimated -- so make sure your filter order is a multiple of the
decimation factor, or else you'll have fractional samples to deal with.
Frequency translation by shifting bins seems easy enough until you
realize that you aren't using the full DFT buffer. This gives rise to
phase discontinuites unless you only shift by a multiple of bins to
ensure phase continuity.
Good luck.
Mark Borgerding
Reply by ●February 10, 20052005-02-10
Noone has words of wisdom to offer ?
-Fred
nospam@om.it.eu.org wrote:
> Hello all,
> I have coded a program that mixes an audio signal with the I/Q
> outputs of a software NCO, causing a translation in frequency,
applies
> a FIR lowpass to the results and finally does a downsampling. This of
> course is all done in the time domain.
> I am wondering if there is a technique that produces the same
results,
> but that works in the frequency domain. I have the feeling that I
could
> save some CPU cycles...
> Feel free to offer suggestions, code snippets, pointers, whatever !
> Also suggestions to forget the idea and continue to work in the time
> domain will be accepted ! Many thanks in advance.
>
> -Fred
Reply by ●February 9, 20052005-02-09
Hello all,
I have coded a program that mixes an audio signal with the I/Q
outputs of a software NCO, causing a translation in frequency, applies
a FIR lowpass to the results and finally does a downsampling. This of
course is all done in the time domain.
I am wondering if there is a technique that produces the same results,
but that works in the frequency domain. I have the feeling that I could
save some CPU cycles...
Feel free to offer suggestions, code snippets, pointers, whatever !
Also suggestions to forget the idea and continue to work in the time
domain will be accepted ! Many thanks in advance.
-Fred