Reply by robert bristow-johnson July 1, 20062006-07-01
dbd wrote:
> > Your response to my post seems to refer to simply the > complex ffts of complex ffts.
those are the most fundamental FFTs to talk about.
> What an interesting new idea for the > subject "FFTs of FFTs"! If we want to start in on that subject maybe we > need a new thread! But what should we call it?
google around, we've discussed the topic before. one thing i learned only from comp.dsp: the unitary DFT (the one with 1/sqrt(N) in it and inverse), like the unitary continuous Fourier Transform, is an isomorphism (a structure preserving mapping of something to another thing of the same kind) and is also *quantitatively* circular with period = 4. that means you can create, from an arbitrary element in that class of "things" that DFTs work on, an eigenvector that has unity gain eigenvalue (that is, you transform the thing and you get thge same thing as a result). given any x0[n], construct x1[k] = DFT{ x0[n] } x2[k] = DFT{ x1[n] } x3[k] = DFT{ x2[n] } we know that x0[k] = DFT{ x3[n] } . then, x[n] = x0[n] + x1[n] + x2[n] + x3[n] is such a thing that DFT{ x[n] } = x[k] the thing gets mapped to itself. r b-j
Reply by Jerry Avins July 1, 20062006-07-01
dbd wrote:
> Jerry Avins wrote: >> dbd wrote: >> ... >>> If you are really calculating the magnitude spectrum of the first fft, >>> as you said, the DC term of the magnitude spectrum of the first fft is >>> the square root of the square of the sum of the inputs to the first >>> fft. ... >> Not so. Depending on scaling, the DC term is the sum of the inputs, >> their arithmetic mean, or something between. There is no squaring, >> rooting, or other non-linear operation involved. >> >> Jerry > > Jerry, > > Mr Burnst presented code: >>> S = flipud(specgram(signal, 512, 11025, hamming(512))); >>> S = abs((S .* conj(S) / 512)).^2; > > There seem to be (at least) three topics in this thread: > 1) MrBurnst's stated magnitude spectrum statement to which I began by > responding. > 2) MrBurnst's original code which Martin Eisenberg noted is not really > the magnitude spectrum. > 3) The hypothetical subject FFTs of FFTs into which most seem to have > log between the fft's > > The code: > S = flipud(specgram(signal, 512, 11025, hamming(512))); > S = abs(S / 512)); > would give a magnitude spectrum via squares and square roots. > > MrBurnst's code includes even more multiplies and squares. > > The log is nonlinear. > > Nonlinearities seem to abound. Magnitude spectrum implys squares and > square roots. Your response to my post seems to refer to simply the > complex ffts of complex ffts. What an interesting new idea for the > subject "FFTs of FFTs"! If we want to start in on that subject maybe we > need a new thread! But what should we call it?
I didn't address any of those issues. Unfortunately, I wasn't careful to exclude them from the scope of my remarks. The gist of what I tried to convey is that the DC term of a FT is related to the sum or average of the samples, not to RMS. MrBurnst, Consider that unless all (real) samples are zero, the RMS must be a positive value. The average DC of two samples, 1 and -1 is zero. The RMS is sqrt(2). Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by MrBurnst July 1, 20062006-07-01
First of all, thanks to all of you, I'm really learning a lot in this
group!
As I said, I'm trying to implement a paper mentioned in this "thread"
before,
http://www.csis.ul.ie/dafx01/proceedings/papers/marchand.pdf

their proposed procedure is to "[...] consider the magnitude spectrum of
the
Fourier transform of the magnitude spectrum � limited to positive
frequencies � of the Fourier transform of the signal."

The code I first posted was a little (to say the least) flawed, so here is
where I'm at now (in matlab):

% ************************************************************
% this returns the windowed complex spectrum of the signal
S = flipud(specgram(signal, 512, 11025, hamming(512)));

% this should then be it's magnitude spectrum
S = abs(S).^2 / 512;

temp = [];
for i=1:size(S,2)
	
    % take current frame
    curr = S(:,i);
    
    % substract its mean
    curr = curr - mean(curr);
    
    % compute fft (zero-padded to 2048 points)
    S2 = fft(curr, 2048);
    
    % compute the magnitude spectrum of that
    S2 = abs(S2).^2 / 2048;
    
    % substract its mean
    S2 = S2 - mean(S2);
    
    % take the first half
    S2 = S2(1:1025);

	% look for the position of the maximum
    temp = [temp max(find(S2 == max(S2)))];
    
end

plot(temp);

%*************************************


this seems to work, allthough I haven't quite figured out how to 
conovert the values in "temp" to a frequency measure for pitch description
...
Reply by dbd July 1, 20062006-07-01
Jerry Avins wrote:
> dbd wrote: > ... > > If you are really calculating the magnitude spectrum of the first fft, > > as you said, the DC term of the magnitude spectrum of the first fft is > > the square root of the square of the sum of the inputs to the first > > fft. ... > > Not so. Depending on scaling, the DC term is the sum of the inputs, > their arithmetic mean, or something between. There is no squaring, > rooting, or other non-linear operation involved. > > Jerry
Jerry, Mr Burnst presented code:
>> S = flipud(specgram(signal, 512, 11025, hamming(512))); >> S = abs((S .* conj(S) / 512)).^2;
There seem to be (at least) three topics in this thread: 1) MrBurnst's stated magnitude spectrum statement to which I began by responding. 2) MrBurnst's original code which Martin Eisenberg noted is not really the magnitude spectrum. 3) The hypothetical subject FFTs of FFTs into which most seem to have log between the fft's The code: S = flipud(specgram(signal, 512, 11025, hamming(512))); S = abs(S / 512)); would give a magnitude spectrum via squares and square roots. MrBurnst's code includes even more multiplies and squares. The log is nonlinear. Nonlinearities seem to abound. Magnitude spectrum implys squares and square roots. Your response to my post seems to refer to simply the complex ffts of complex ffts. What an interesting new idea for the subject "FFTs of FFTs"! If we want to start in on that subject maybe we need a new thread! But what should we call it? Dale B. Dalrymple
Reply by Jerry Avins June 30, 20062006-06-30
dbd wrote:

   ...

> If you are really calculating the magnitude spectrum of the first fft, > as you said, the DC term of the magnitude spectrum of the first fft is > the square root of the square of the sum of the inputs to the first > fft. ...
Not so. Depending on scaling, the DC term is the sum of the inputs, their arithmetic mean, or something between. There is no squaring, rooting, or other non-linear operation involved. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by dbd June 30, 20062006-06-30
earlier MrBurnst wrote:
=On each window of the spectrum, I comute the magnitude
=spectrum and apply the FFT, which in turn returns a complex spectrum,
of
=which I again compute the power spectrum, but only using the first
1024
=bins.... (??)
> >> > >> Isn't the DC term of the FFT of a magnitude spectrum proportional to > >> the RMS of the initial signal? > >> > >> Dale B. Dalrymple > >> > >No, the DC term is the mean of the initial signal, or the sum of all the > > >elements (N times the mean) depending on the details of the definition. > > > > Best wishes, > > --Phil Martel > >
MrBurnst If you are really calculating the magnitude spectrum of the first fft, as you said, the DC term of the magnitude spectrum of the first fft is the square root of the square of the sum of the inputs to the first fft. So, that would be the root-square-mean not root-mean-square (RMS) as I asked. Removing the average of the input data to the first fft should bring the DC term of the magnitude spectrum to zero. Most of the rest of the magnitude terms would be little effected. the DC output of the second fft would then still be large if the original data had significant AC content. Removing the magnitude calculation should significantly alter the results for most data inputs The problems mentioned earlier for the cepstrum calculation have been dealt with in some applications by use of the complex cepstrum in the 1980s and 1990s. The complex cepstrum added invertability to the toolkit, that is lacking with power or magnitude formulations.. Dale B. Dalrymple
Reply by Philip Martel June 29, 20062006-06-29
"MrBurnst" <ernst_schwartz@gmx.at> wrote in message 
news:VamdnXCTtp5YFD7ZnZ2dnUVZ_t2dnZ2d@giganews.com...
>>> >>> Isn't the DC term of the FFT of a magnitude spectrum proportional to >>> the RMS of the initial signal? The rest of the terms are the variation >>> in energy with frequency. Isn't that RMS usually a large term at that >>> point? >>> >>> Dale B. Dalrymple >>> >>No, the DC term is the mean of the initial signal, or the sum of all the > >>elements (N times the mean) depending on the details of the definition. >> >> Best wishes, >> --Phil Martel >> >> > > That's what I thought. > So, if I normalize my orignal signal to zero mean and compute the > spectrum, I won't have a DC offset. So far so good. But even if I > normalize the resulting spectrum (well, one frame of the spectrum at a > time), I still get strong energy around the 0 component of the "spectrum > of the spectrum" ... how can that be? >
Sorry, I don't have the original post. There might be leakage from low frequency terms or round-off problems. BTW, I assume you are treating the FTs you calculate and remove the DC term from as arrays of complex numbers and that you use a complex FFT for the second set of FTs. Best wishes, --Phil
Reply by MrBurnst June 29, 20062006-06-29
>> >> Isn't the DC term of the FFT of a magnitude spectrum proportional to >> the RMS of the initial signal? The rest of the terms are the variation >> in energy with frequency. Isn't that RMS usually a large term at that >> point? >> >> Dale B. Dalrymple >> >No, the DC term is the mean of the initial signal, or the sum of all the
>elements (N times the mean) depending on the details of the definition. > > Best wishes, > --Phil Martel > >
That's what I thought. So, if I normalize my orignal signal to zero mean and compute the spectrum, I won't have a DC offset. So far so good. But even if I normalize the resulting spectrum (well, one frame of the spectrum at a time), I still get strong energy around the 0 component of the "spectrum of the spectrum" ... how can that be?
Reply by Philip Martel June 28, 20062006-06-28
"dbd" <dbd@ieee.org> wrote in message 
news:1151388359.094915.65180@c74g2000cwc.googlegroups.com...
> > MrBurnst wrote: >> >> >> As I said, >> first, I just use matlab's specgram method, which outputs one half of the >> complex spectrum. On each window of the spectrum, I comute the magnitude >> spectrum and apply the FFT, which in turn returns a complex spectrum, of >> which I again compute the power spectrum, but only using the first 1024 >> bins.... (??) > > Isn't the DC term of the FFT of a magnitude spectrum proportional to > the RMS of the initial signal? The rest of the terms are the variation > in energy with frequency. Isn't that RMS usually a large term at that > point? > > Dale B. Dalrymple >
No, the DC term is the mean of the initial signal, or the sum of all the elements (N times the mean) depending on the details of the definition. Best wishes, --Phil Martel
Reply by Martin Eisenberg June 27, 20062006-06-27
MrBurnst wrote:

> Somehow I don't believe that differences in that order of > magnitude (e-19) are responsable for the behavior I'm observing.
My point was that the statement S = abs((S .* conj(S) / 512)).^2; in the script you posted basically gives the fourth power of the magnitude spectrum rather than the magnitude itself, which doesn't seem to appear in the paper from a cursory look. Still, it may not be the reason for your problems. Martin -- No wonder that illegitimate children are commonly the greatest minds; they are the result of an hour full of wit, marital ones often spring from boredom. --Theodor Gottlieb von Hippel