>>"tomb18" <103312@DSPRelated> writes:
>>
>>>>On Fri, 17 Apr 2015 14:52:32 -0500, "tomb18" <103312@DSPRelated>
>>>>wrote:
>>>>
>>>>>>I'm not going to fix your top-posting, so this is just going to be
>>a
>>>>>>mess from here if the thread continues.
>>>>>>
>>>>>>You're doing things the hard way, IMHO.
>>>>>>
>>>>>>You don't need to take an FFT and then an iFFT. Take the FFT,
>>use
>>>>>>that for your spectrum analysis or whatever. Take the same
>>signal
>>>>>>that went into the FFT and mix whatever part of that you want to
>be
>>>>at
>>>>>>zero-Hz with a complex mix operation (i.e., multiply
>>sample-by-sample
>>>>>>with a complex tone at the appropriate frequency).
>>>>>>
>>>>>>You can then apply a low-pass filter to isolate the signal that
>you
>>>>>>want before detecting the magnitude.
>>>>>>
>>>>>>That'll save a ton of computation and avoid all the hassles with
>>>>>>overlap-add, etc. A LPF is much easier to design and implement
>>than
>>>>>>a BPF.
>>>>>>
>>>>>>
>>>>>>
>>>>>>On Fri, 17 Apr 2015 10:41:17 -0500, "tomb18" <103312@DSPRelated>
>>>>>>wrote:
>>>>>>
>>>>>>>Many thanks to all that replied!
>>>>>>>Starting here I will explain this a little more.
>>>>>>>1)Yes the FFT input buffer is filled with complex samples.
>>>>>>>2)I take the complex FFT and output it to the inverse FFT. I
>also
>>>>>>take
>>>>>>>the complex FFT and plot it in a spectrum (this is independent of
>>>>the
>>>>>>>demodulation).
>>>>>>>3) I take the complex values in the output buffer and convert to
>>>>>>polar.
>>>>>>>4) I only take the magnitude.
>>>>>>>
>>>>>>>The first point is better explained by my overall goal which is
>to
>>>>>>provide
>>>>>>>a spectrum scope for a software defined radio. This is
>functional
>>>>and
>>>>>>>works very well. I now wish to isolate signals (SSB or AM) from
>>the
>>>>>>>spectrum, which can be anywhere over the whole range of 192kHz (I
>>>>>>sample
>>>>>>>at 192kHz and plot positive and negative frequencies. The radio
>>>>>>provides
>>>>>>>a quadrature output).
>>>>>>>So my test application is just demodulating signals around 0-3kHz
>>>>i.e.
>>>>>>in
>>>>>>>the center of the spectrum. By tuning the radio manually, I can
>>get
>>>>>>the
>>>>>>>signals down to this frequency range and then demodulate.
>>>>>>>So the overall flow is:
>>>>>>>Stereo audio (I and Q fed into left and right channels), Sampling
>>at
>>>>>>>192kHz,
>>>>>>>FFT with blackman, plotting of spectrum (with IQ balance
>control).
>>>>>>>Now I can take the FFT with rectangular windowing, inverse FFT,
>>then
>>>>>>for
>>>>>>>AM I convert to polar and take the magnitude. Then it's off to
>>the
>>>>>>audio
>>>>>>>out.
>>>>>>>For USB I take the output of the inverse fourier, take the
>>imaginary
>>>>>>>values, send them through a hilbert transform and subtract the
>>>>shifted
>>>>>>>values from the real.Then it's out to the audio. For LSB its the
>>>>same
>>>>>>>except it's added.
>>>>>>>All of this works well.
>>>>>>>So my original question is why did the audio become distorted
>when
>>I
>>>>>>used
>>>>>>>a blackman window. That has been explained by Randy.
>>>>>>>
>>>>>>>My ultimate goal however (and I am a beginner here!) is to
>isolate
>>a
>>>>>>>signal in the frequency domain and bring it down to 0 hz.
>>>>>>>Next I need a bandpass filter. I then need to pass this filter
>>>>through
>>>>>>an
>>>>>>>inverse FFT, apply windowing to this filter. Next do an FFT on
>>this
>>>>>>>filter and multiply it with the original signals FFT. After this
>>I
>>>>do
>>>>>>an
>>>>>>>iFFT with the overlap add procedure. Whew! This is why I
>started
>>>>>>with
>>>>>>>the simple case above.
>>>>>>>So, my next questions are about the bandpass filter. How does
>one
>>>>>>create
>>>>>>>one, and also how does one apply an iFFT to it?
>>>>>>>Assuming that there is an equation for the bandpass filter, does
>>one
>>>>>>just
>>>>>>>create a buffer containing the results of the filter from -0.5 to
>>>>+0.5
>>>>>>and
>>>>>>>using the value of "1" as the input? Do you then send this
>buffer
>>>>to
>>>>>>the
>>>>>>>inverse FFT? I think this is the one area where I have not
>really
>>>>seen
>>>>>>an
>>>>>>>explanation of this.
>>>>>>>I really appreciate the help here as things are not always clear.
>>>>>>>Regards, Tom
>>>>>>
>>>>>>
>>>>>>>>Your question is missing many details. I assume you are doing
>the
>>>>>>>>following
>>>>>>>>
>>>>>>>>1) fill the fft input buffer with complex samples
>>>>>>>>2) fft, then inverse fft
>>>>>>>>3) take the complex values in the output buffer and convert to
>>>>>>>>polar.
>>>>>>>>
>>>>>>>>While you didn't say this, I assume the output you use is just
>>the
>>>>>>>>magnitude portion of the polar output (the angle is thrown away
>>so
>>>>>>don't
>>>>>>>bother
>>>>>>>>computing it)
>>>>>>>>
>>>>>>>>So, a few points.
>>>>>>>>The fft/inverse fft just cancel each other so the output buffer
>>>>>>equals
>>>>>>>>the input buffer. Were you planning to do some filtering in the
>>>>>>>frequency
>>>>>>>>domain ? If not then the whole scheme is just wasting the
>>>>fft/inverse
>>>>>>fft
>>>>>>>and
>>>>>>>>you could just compute the magnitude of the original complex
>>signal
>>>>on
>>>>>>a
>>>>>>>>sample-by-sample basis.
>>>>>>>>
>>>>>>>>If you ARE planning on doing some filtering in the frequency
>>domain
>>>>>>then
>>>>>>>>you need to use the conventional overlap-add method of
>>>>reconstructing
>>>>>>>the
>>>>>>>>time-domain signal, followed by taking the magnitude of the
>>>>resulting
>>>>>>>>samples.
>>>>>>>>
>>>>>>>>Note that none of the above can be described as AM demodulation
>>in
>>>>>>the
>>>>>>>>frequency domain, since after the ifft you are back in the time
>>>>>>domain.
>>>>>>>I've
>>>>>>>>never heard of AM demodulation in the frequency domain, perhaps
>>it
>>>>>>>exists,
>>>>>>>>I'm not a comms expert.
>>>>>>>>
>>>>>>>>Bob
>>>>>>>
>>>>>>>
>>>>>>>---------------------------------------
>>>>>>>Posted through http://www.DSPRelated.com
>>>>>>
>>>>>>Eric Jacobsen
>>>>>>Anchor Hill Communications
>>>>>>http://www.anchorhill.com
>>>>>
>>>>>Hi,
>>>>>Sorry about the top posting....I subscribe to mailing lists often
>>and
>>>>the
>>>>>ones I subscribe to suggest top posting.
>>>>>Well I'll be....you are right. I just tried this taking the IQ
>>signal
>>>>off
>>>>>before it goes into the FFT and as expected, all the demodulation I
>>>>did
>>>>>works exactly the same. No need for an inverse FFT. Not only
>that,
>>>>>getting rid of the iFFT means there is now no noticeable delay.
>>Much
>>>>>better.
>>>>>At the moment, I am just tuning the radio to get the signal to
>where
>>I
>>>>can
>>>>>hear it. Next, I need to do the multiplication with the complex
>>tone
>>>>but
>>>>>I have a question that will really show how little I know about all
>>of
>>>>>this, lol.
>>>>>The IQ signals come from the sound card. The sampling is done at
>>>>192kHz
>>>>>and 4096 byte blocks are delivered at a time. I presume I just
>need
>>>>to
>>>>>deal with one block at a time? Can I just multiply each signal ( I
>>and
>>>>Q)
>>>>>with a sine and cosine? Do I need to match the magnitudes in any
>>way?
>>>>
>>>>>Like I said, here i really don't know what I'm doing.
>>>>>Thanks, Tom
>>>>>---------------------------------------
>>>>>Posted through http://www.DSPRelated.com
>>>>
>>>>Assuming the time between the blocks is the same as the time between
>>>>the samples, it will be better to keep the phase of the mixer
>>>>continuous across the edge of the blocks. In other words, don't
>>>>reset the phase at the beginning of each block, or you may hear a
>pop
>>>>or other artifact at the block edge.
>>>>
>>>>This may be less likely since you're ultimately demodulating AM, but
>>>>if you do apply some filtering before detecting the AM you can wind
>>up
>>>>with artifacts at the block edges if you're not careful.
>>>>
>>>>
>>>>Eric Jacobsen
>>>>Anchor Hill Communications
>>>>http://www.anchorhill.com
>>>
>>> Well I have a prototype. I have an oscillator, and I am multiplying
>>each
>>> sample with the oscillator step. It works. It allows me to select a
>>> frequency for the oscillator and thus tune in to a signal in the
>>spectrum.
>>> The low pass filters(one on the real and one on the imaginary) ,
>>work.
>>> However, it seems that I hear many tones as I tune through the
>>spectrum
>>> in AM mode. When I get on a signal I have to tune the radio a bit
>>until
>>> the tone goes lower until it disappears but there is a point where
>it
>>is
>>> inaudible but I can hear a beat in the signal. It seems it is acting
>>as a
>>> synchronous detector.
>>
>>If the AM modulation has a carrier component, then this would produce
>>the tones. The difference between the actual carrier and your "digital
>>oscillator" frequency will be a tone present in the demodulated
>output.
>>
>>> In USB, I do not hear a tone. But if I just listen to a properly
>>tuned
>>> signal, it appears to slowly waver in pitch.
>>> I'm not quite sure what is happening here. Any ideas?
>>
>>Your carrier and digital oscillator are slowly varying relative to one
>>another.
>>--
>>Randy Yates
>>Digital Signal Labs
>>http://www.digitalsignallabs.com
>
>That's what I thought. However, on further investigation I believe it's
>images from the IQ imbalance. If I have a fixed oscillator frequency, as
>I
>tune a signal, I see an image in the spectrum. As I tune, the image
>gets
>closer to the carrier, the pitch lowers, and when it completely overlaps
>the carrier the pitch is gone.
>Well, this brings me right back to working in the frequency domain. My
>spectrum scope requires IQ imbalance correction in the frequency domain.
>
>The reason for this is that the imbalance is frequency dependent and
>there
>is a quadratic curve used in a digital filter to correct it. Thus I
>have
>to do demodulation after the IQ correction.
>Tom
>
>---------------------------------------
>Posted through http://www.DSPRelated.com
Hi,
No, its not the images! I recorded the IQ signal with audacity and fed it
into a third party prodcut that will do demodulation of an IQ signal and
it works perfect.
So, something in my code.
Good to know.
---------------------------------------
Posted through http://www.DSPRelated.com