```>Vladimir Vassilevsky wrote:
>
>banton wrote:
>
>> I am working on a plugin that involves estimation of spectral
>> peaks
>
>[...]
>
>> In most cases that works sufficiently well, but when sinusoids
>> are involved that are too close together (but still a few bins
arpart),
>> the sidelobes overlap too much and the whole thing gives pretty
>
>[...]
>
>> compute the cross-correlation:
>> A[n] = sum(k = -N...N,  X[n] * W[n+k])
>>
>> Then I want to use peaks in A[n] to calculate sinusoidal parameters.
>
>The results will be much sharper if you normalize the corellation to the

>energy of the signals.

I need further explanations.
How do I normalize the correlation?
I am sure that must mean something else then just _one_ scaling
factor for the correlation results, since I can't see how this
would change anything.
I found Rune's explanation
So I guess I should interpret "the length of the signal"
as the part which is non-zero.
And then normalize the longer signal always for the part
which contributes to the inner-product?

thanks,
Bjoern

```
```
banton wrote:

> I am working on a plugin that involves estimation of spectral
> peaks

[...]

> In most cases that works sufficiently well, but when sinusoids
> are involved that are too close together (but still a few bins arpart),
> the sidelobes overlap too much and the whole thing gives pretty

[...]

> compute the cross-correlation:
> A[n] = sum(k = -N...N,  X[n] * W[n+k])
>
> Then I want to use peaks in A[n] to calculate sinusoidal parameters.

The results will be much sharper if you normalize the corellation to the
energy of the signals.

DSP and Mixed Signal Design Consultant
http://www.abvolt.com
```
```>> Rune Allnor wrote:
>>> >> But it is still the interference between them which causes
trouble.
>>>
>>> >Simple magnitude peak finding methods with FFT results will
>>> >likely encounter problems if there are less than some small
>>> >number, say 2 or 3, of beats per frame. =A0
>>>
>>> You say: "simple magnitude peak finding methods" - and I wonder
>>> what other methods I could try.
>>> Any suggestions/references?
>>
>>One could try statistical methods which analyze the
>>magnitude of the spectrum coeffcients and somehow evaluate
>>them against the genral shape of the spectrum, to try and
>>decide where peaks might exist, at the same time one discards
>>local maxima caused by noise.
>>
>>I have never seen that done, though.
>
>Exactly something like this is what crosses my mind all the time
>while working on this.
>By examining the results from the things I have tried so far, I can
>see one interesting point which might help to do this:
>
>The parabolic-interpolation-based peak estimator catches at least
>the existence of the peaks.  Just the estimated parameters are
>sometimes quite off.
>But if I additionally look at the frame-to-frame phase deltas of
>2-3 surrounding bins on each side, I can see that the correct values
>often show up in most of them.  I think some people call that
>spectral clustering (Miller Puckette?).
>Intuitively I think that this information combined with the
>right statistical method could lead to much better results.
>But .. oh well, "the right statistical method" is
>certainly not easy to come up with.  At least I can use
>this phase-information to make my system aware of its errors.

And this idea of finding a statistical method is also the root
of the idea to use cross-correlation with the transform of the window.
A single non-modulated sinusoid would correlate perfectly.
In praxis that would never happen.
Now there are different causes for the "deformation" of the peak.
Amplitude modulation, frequency modulation and near-by peaks -
all will cause deviations in the peak (deviations from the
shape of a peak that a non-modulated windowed sinusoid would result in).
The question is: Is it possible to identify the cause by the symptomes?

gr.
Bjoern
>
>
```
```On Mar 10, 9:02&#2013266080;am, "banton" <bant...@web.de> wrote:

> Intuitively I think that this information combined with the
> right statistical method could lead to much better results.
> But .. oh well, "the right statistical method" is
> certainly not easy to come up with. &#2013266080;At least I can use
> this phase-information to make my system aware of its errors.

I can't help with the details, but it seems you have a pretty
realistic view on how to proceed, what to try, as well as where
and why problems might occur.

Rune
```
```> Rune Allnor wrote:
>> >> But it is still the interference between them which causes trouble.
>>
>> >Simple magnitude peak finding methods with FFT results will
>> >likely encounter problems if there are less than some small
>> >number, say 2 or 3, of beats per frame. =A0
>>
>> You say: "simple magnitude peak finding methods" - and I wonder
>> what other methods I could try.
>> Any suggestions/references?
>
>One could try statistical methods which analyze the
>magnitude of the spectrum coeffcients and somehow evaluate
>them against the genral shape of the spectrum, to try and
>decide where peaks might exist, at the same time one discards
>local maxima caused by noise.
>
>I have never seen that done, though.

Exactly something like this is what crosses my mind all the time
while working on this.
By examining the results from the things I have tried so far, I can
see one interesting point which might help to do this:

The parabolic-interpolation-based peak estimator catches at least
the existence of the peaks.  Just the estimated parameters are
sometimes quite off.
But if I additionally look at the frame-to-frame phase deltas of
2-3 surrounding bins on each side, I can see that the correct values
often show up in most of them.  I think some people call that
spectral clustering (Miller Puckette?).
Intuitively I think that this information combined with the
right statistical method could lead to much better results.
But .. oh well, "the right statistical method" is
certainly not easy to come up with.  At least I can use
this phase-information to make my system aware of its errors.

gr.
Bjoern

```
```On Mar 10, 1:53&#2013266080;am, "banton" <bant...@web.de> wrote:
> >On Mar 9, 6:54 am, "banton" <bant...@web.de> wrote:
> >> >3) Do you want to identify two close peaks as separate?
>
> >> Yes. &#2013266080;But I am not talking about Peaks which are so close
> >> that they just cause beating. &#2013266080;I mean Peaks which can easily
> >> be identified by eye, if you look at plots of the spectrum.

Human perception can, in general, not be easily reproduced
by means of DSP. Questions of the type 'I can easily identify
whatever when I hear or see the data - how can I achieve the
same with DSP or image processing?' are very common, but
only the very simplest can be answred. Most of what is
'easily' identifyable by humans is not at all easy to
identify by use of computers.

> >> But it is still the interference between them which causes trouble.
>
> >Simple magnitude peak finding methods with FFT results will
> >likely encounter problems if there are less than some small
> >number, say 2 or 3, of beats per frame. &#2013266080;
>
> You say: "simple magnitude peak finding methods" - and I wonder
> what other methods I could try.
> Any suggestions/references?

One could try statistical methods which analyze the
magnitude of the spectrum coeffcients and somehow evaluate
them against the genral shape of the spectrum, to try and
decide where peaks might exist, at the same time one discards
local maxima caused by noise.

I have never seen that done, though.

Rune
```
```>One interesting technique applicable in high SNR situations for
>estimating two poorly separated tones involves use of a Gaussian
>window on data in an FFT and using the bins, off peak on the side away
>from the interfering signal to estimate the frequency and amplitude.
>Take a look at:
>
>http://www.edn.com/archives/1994/030394/graph/05df1fg1.htm
>
>There is a figure 1 you can click on to enlarge to see an example of
>the performance capability on the data set fred harris used to discuss
>frequency resolution. C code is provided. This is from a back issue of
>EDN magazine.
>
>The Gaussian window was chosen to:
>1) widen mainlobe response
>2) increase sidelobe rolloff
>3) simplify calculation of frequency and magnitude from the ratio of
>the amplitudes of two non-peak bins.
>

That looks interesting!
And it's simple to implement - which is great.
So I will immediately start to check if that will help my
analysis.  Now I am really curious to see how that method performs
with more narrow filters (the example in the paper uses
an fft size of 64 .. I need much higher resolution).

gr.
Bjoern

```
```On Mar 8, 10:46 pm, "banton" <bant...@web.de> wrote:

> ...
> Background noise will not be a big problem.
> The problem arises when tracked sinusoids are too close, so that
> the sidelobes of the peaks interfere with their neighbours.
> ...

One interesting technique applicable in high SNR situations for
estimating two poorly separated tones involves use of a Gaussian
window on data in an FFT and using the bins, off peak on the side away
from the interfering signal to estimate the frequency and amplitude.
Take a look at:

http://www.edn.com/archives/1994/030394/graph/05df1fg1.htm

There is a figure 1 you can click on to enlarge to see an example of
the performance capability on the data set fred harris used to discuss
frequency resolution. C code is provided. This is from a back issue of
EDN magazine.

The Gaussian window was chosen to:
1) widen mainlobe response
2) increase sidelobe rolloff
3) simplify calculation of frequency and magnitude from the ratio of
the amplitudes of two non-peak bins.

Items 1) and 2) could be provided by many good windows and serve to
improve signal to interferer ratio in the bins used for calculation.
SNR must be high enough that noise is not the limitation.

Item 3) is a characteristic of the Gaussian window and is described in
the article.

Dale B. Dalrymple
```
```>On Mar 9, 6:54 am, "banton" <bant...@web.de> wrote:
>> >3) Do you want to identify two close peaks as separate?
>>
>> Yes.  But I am not talking about Peaks which are so close
>> that they just cause beating.  I mean Peaks which can easily
>> be identified by eye, if you look at plots of the spectrum.
>> But it is still the interference between them which causes trouble.
>
>Simple magnitude peak finding methods with FFT results will
>likely encounter problems if there are less than some small
>number, say 2 or 3, of beats per frame.

You say: "simple magnitude peak finding methods" - and I wonder
what other methods I could try.
Any suggestions/references?

>Cross-correlation
>with the window transform, compared to parabolic
>interpolation, may improve estimation for those frequency
>offsets where the shape of the transform of your window is
>very different from parabolic.  Cross-correlation using
>the complex FFT results instead of the magnitudes may help
>for certain combinations of phase relationships between the
>two frequencies and the window center.

I played around with the cross-correlation idea and didn't get
any improvements.  Sometimes I got better estimates sometimes worse.
So for now I went back to the parabolic interpolation.
Of course what you say about the shape of the transform of the
window makes sense.  But I was hoping that the cross-correlation
would bring an advantage because it would use a little bit more
of the information in the spectrum around the peak, since
the parabolic interpolation just looks at 3 samples.
In other words I hoped that the information from the sidelobes
surrounding the peak could somehow be turned into something usefull.

An idea that came through my mind is to use FFTs and peak-detection
just to get a rough estimate of where to look for partials and
then try to use some kind of "adaptive heterodyning" with bandpass
Maybe this way I could get more details about the sinusoids I want
to track.

So if anybody here has some experience or ideas to share, about
the implementation of phase vocoders or sinusoidal modells,
I am happy to hear about it.

>If you use a non-rectangular window, it may reduce side
>lobe interference of more distant peaks, but also increase
>the span over which the main lobes of nearby peaks can
>interfere with each other.

Yes, that is clear to me.

Thanks for the replies,
Bjoern

>
>
>IMHO. YMMV.
>--
>rhn A.T nicholson d.0.t C-o-M
> http://www.nicholson.com/rhn/dsp.html
>
```
```On Mar 9, 6:54 am, "banton" <bant...@web.de> wrote:
> >2) Do you want to locate the frequency with top magnitude
> >   of one peak with high precision?
>
> Almost.  I want to locate multiple peaks in a given frequency
> region.
>
> >3) Do you want to identify two close peaks as separate?
>
> Yes.  But I am not talking about Peaks which are so close
> that they just cause beating.  I mean Peaks which can easily
> be identified by eye, if you look at plots of the spectrum.
> But it is still the interference between them which causes trouble.

Simple magnitude peak finding methods with FFT results will
likely encounter problems if there are less than some small
number, say 2 or 3, of beats per frame.  Cross-correlation
with the window transform, compared to parabolic
interpolation, may improve estimation for those frequency
offsets where the shape of the transform of your window is
very different from parabolic.  Cross-correlation using
the complex FFT results instead of the magnitudes may help
for certain combinations of phase relationships between the
two frequencies and the window center.

If you use a non-rectangular window, it may reduce side
lobe interference of more distant peaks, but also increase
the span over which the main lobes of nearby peaks can
interfere with each other.

IMHO. YMMV.
--
rhn A.T nicholson d.0.t C-o-M
http://www.nicholson.com/rhn/dsp.html
```