DSPRelated.com
Forums

Window function and spectral estimation advice (long)

Started by Erik de Castro Lopo January 25, 2007
Hi all,

I'm currently writing some software to generate a spectrogram from
a given sound file. In particular I would like to be able to display
signals with very large dynamic ranges (it 150 dB or more).

Here's an example of what I have so far:

    http://www.mega-nerd.com/tmp/spectrogram.png

The input audio file was an 8 second sweep from 100Hz to 22.05kHz
and sampled at 44.1kHz (x-axis is time, y-axis if frequency).

I'm reasonably happy with what I have, but I would like to remove the
purple and blue fringing which I am almost positive is an artifact of
the window I am using. The window is the Nuttall window as described
on the wikipedia page:

    http://en.wikipedia.org/wiki/Window_function#Nuttall_window.2C_continuous_first_derivative

I chose this window because of the amplitude of the side lobes continues
to decrease as distance from the main lobe increases. By way of contrast,
I avoided the Blackman-Nuttall window because of its flat side lobe 
behavior which is only 100dB down and I'm aiming for dynamic ranges of
150 dB and more.

So, the questions I have are:

  -  Can anyone suggest a better window function, one with smaller first
     side lobe than the Nuttall *and* decreasing side lobe amplitude as
     distance form the main lobe decreases. Obviously, I'm willing to 
     accept a wider main lobe for increased side lobe suppression.

  - Is this a good application for multitaper spectral estimation and
    if so, any advice on pursuing this technique?

Thanks in advance,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"Slavery is a part of Islam. Slavery is part of jihad, and jihad will 
remain as long there is Islam." -- Sheikh Saleh Al-Fawzan, Saudi cleric
http://www.arabianews.org/english/article.cfm?qid=132&sid=2
Erik,

what about BlackmanOptimal ?

Defined as:

            alpha + 1               2*Pi*n       alpha          4*Pi*n
    w[n] = ----------  -   0.5*cos --------  -    ------   *
cos(-------)
                 2                       n - 1           2
 n - 1

                 sin(Pi/(n-1))
    alpha = - (---------------)^2
                sin(2*Pi/(n-1))


I prefer this compared to the other Blackman filters.

Uli



On 25 Jan., 11:22, Erik de Castro Lopo <e...@mega-nerd.com> wrote:
> Hi all, > > I'm currently writing some software to generate a spectrogram from > a given sound file. In particular I would like to be able to display > signals with very large dynamic ranges (it 150 dB or more). > > Here's an example of what I have so far: > > http://www.mega-nerd.com/tmp/spectrogram.png > > The input audio file was an 8 second sweep from 100Hz to 22.05kHz > and sampled at 44.1kHz (x-axis is time, y-axis if frequency). > > I'm reasonably happy with what I have, but I would like to remove the > purple and blue fringing which I am almost positive is an artifact of > the window I am using. The window is the Nuttall window as described > on the wikipedia page: > > http://en.wikipedia.org/wiki/Window_function#Nuttall_window.2C_contin... > > I chose this window because of the amplitude of the side lobes continues > to decrease as distance from the main lobe increases. By way of contrast, > I avoided the Blackman-Nuttall window because of its flat side lobe > behavior which is only 100dB down and I'm aiming for dynamic ranges of > 150 dB and more. > > So, the questions I have are: > > - Can anyone suggest a better window function, one with smaller first > side lobe than the Nuttall *and* decreasing side lobe amplitude as > distance form the main lobe decreases. Obviously, I'm willing to > accept a wider main lobe for increased side lobe suppression. > > - Is this a good application for multitaper spectral estimation and > if so, any advice on pursuing this technique? > > Thanks in advance, > Erik > -- > +-----------------------------------------------------------+ > Erik de Castro Lopo > +-----------------------------------------------------------+ > "Slavery is a part of Islam. Slavery is part of jihad, and jihad will > remain as long there is Islam." -- Sheikh Saleh Al-Fawzan, Saudi clerichttp://www.arabianews.org/english/article.cfm?qid=132&sid=2
Erik,

I like to add Kaiser windows to the discussion. E.g. Audition offers a
Kaiser -180 dB window in its spectral display function.

See also http://en.wikipedia.org/wiki/Kaiser_window

Uli


On 25 Jan., 11:22, Erik de Castro Lopo <e...@mega-nerd.com> wrote:
> Hi all, > > I'm currently writing some software to generate a spectrogram from > a given sound file. In particular I would like to be able to display > signals with very large dynamic ranges (it 150 dB or more). > > Here's an example of what I have so far: > > http://www.mega-nerd.com/tmp/spectrogram.png > > The input audio file was an 8 second sweep from 100Hz to 22.05kHz > and sampled at 44.1kHz (x-axis is time, y-axis if frequency). > > I'm reasonably happy with what I have, but I would like to remove the > purple and blue fringing which I am almost positive is an artifact of > the window I am using. The window is the Nuttall window as described > on the wikipedia page: > > http://en.wikipedia.org/wiki/Window_function#Nuttall_window.2C_contin... > > I chose this window because of the amplitude of the side lobes continues > to decrease as distance from the main lobe increases. By way of contrast, > I avoided the Blackman-Nuttall window because of its flat side lobe > behavior which is only 100dB down and I'm aiming for dynamic ranges of > 150 dB and more. > > So, the questions I have are: > > - Can anyone suggest a better window function, one with smaller first > side lobe than the Nuttall *and* decreasing side lobe amplitude as > distance form the main lobe decreases. Obviously, I'm willing to > accept a wider main lobe for increased side lobe suppression. > > - Is this a good application for multitaper spectral estimation and > if so, any advice on pursuing this technique? > > Thanks in advance, > Erik > -- > +-----------------------------------------------------------+ > Erik de Castro Lopo > +-----------------------------------------------------------+ > "Slavery is a part of Islam. Slavery is part of jihad, and jihad will > remain as long there is Islam." -- Sheikh Saleh Al-Fawzan, Saudi clerichttp://www.arabianews.org/english/article.cfm?qid=132&sid=2
Erik de Castro Lopo wrote:
> Hi all, > > I'm currently writing some software to generate a spectrogram from > a given sound file. In particular I would like to be able to display > signals with very large dynamic ranges (it 150 dB or more). > > Here's an example of what I have so far: > > http://www.mega-nerd.com/tmp/spectrogram.png
It's really beautiful in itself. Too bad it doesn't fit your need.
> The input audio file was an 8 second sweep from 100Hz to 22.05kHz > and sampled at 44.1kHz (x-axis is time, y-axis if frequency). > > I'm reasonably happy with what I have, but I would like to remove the > purple and blue fringing which I am almost positive is an artifact of > the window I am using. ...
I see it as an artifact that includes the effect of the plotting software. Might you not address the problem from that end? (I can see that that might fail with more complex inputs, but maybe not.) ... Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Erik de Castro Lopo wrote:
> I'm currently writing some software to generate a spectrogram from > a given sound file. In particular I would like to be able to display > signals with very large dynamic ranges (it 150 dB or more).
Choose a appropriate Kaiser window as mentioned by Uli. But you should think about some other issues too: First of all think about the calculation precision. Double precision theoretically fits for your needs, but the cascading errors of the FFT algorithm may decrease the accouracy. Furthermore the cos and sin implementations of the FPUs do not always reach the maximum accouracy. The next question is: where does the sample come from? Does your analog path and the ADC/DAC device really provide more than 150dB dynamics. Or are you going to analyze digital filters? This leads to the next Question: what is your goal? If yo want to characterize a two port you should better operate without a window function. If the reference source of your sweep is synchonized with the recorded response then you do not need a window function at all. It is not required to know the absolute phase relation. It is sufficient if the phase relation is linear and constant during the measurement. This is true for almost any full duplex AD device. And it should be true for any digital path. Marcel

On Jan 25, 5:22 am, Erik de Castro Lopo <e...@mega-nerd.com> wrote:
> Hi all, > > I'm currently writing some software to generate a spectrogram from > a given sound file. In particular I would like to be able to display > signals with very large dynamic ranges (it 150 dB or more). >
> So, the questions I have are: > > - Can anyone suggest a better window function, one with smaller first > side lobe than the Nuttall *and* decreasing side lobe amplitude as > distance form the main lobe decreases. Obviously, I'm willing to > accept a wider main lobe for increased side lobe suppression. >
Hello Erik, What you have so far looks really cool. For an equiriple type window (which you said you realy don't want) is the Dolph-Chebyshev. And the one that others suggest and I'll second (third, fourth whatever) the Kaiser window - for one its adjustable. It is nearly optimal. The optimal (concentrated around the main lobe) turns out to be made up of prolate spheroidal wave functions. See Slepian's work[1] for details. Kaiser found a solution that is almost as good but it is much better in that it is easy to calculate. If you need code to generate the modified Bessel function of zeroth order, just let me know. If you want to go for the best, check out Slepian's paper. Clay [1] Slepian, D., Landau, H.T., and Pollack, H.O., "Prolate Spheroidal Wave Functions, Fourier Analysis, and Uncertainty Principle (I and II)," Bell System Technical Journal, Vol 40, No. 1, pp 43-80, Jan. 1961
Marcel M&#4294967295;ller wrote:

> The next question is: where does the sample come from? Does your analog > path and the ADC/DAC device really provide more than 150dB dynamics.
The sweep is generated arithmetically using double precision floating point.
> Or > are you going to analyze digital filters?
I actually intend to pass the sweep through my sample rate converter http://www.mega-nerd.com/SRC/ and then generate a spectrogram of the converter output to look at the artifacts of the conversion process. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "Those who know nothing of Islam pretend that Islam counsels against war. Those who say this are witless. Islam says: Kill all the unbelievers just as they would kill you all! Kill them, put them to the sword and scatter their armies." -- Ayatollah Khomeini, "Islam is Not a Religion of Pacifists", 1942
uli.brueggemann@gmail.com wrote:

> Erik, > > I like to add Kaiser windows to the discussion. E.g. Audition offers a > Kaiser -180 dB window in its spectral display function. > > See also http://en.wikipedia.org/wiki/Kaiser_window
Thanks Uli, I will take a look at the Kaiser window. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "...In the UNIX world, people tend to interpret `non-technical user' as meaning someone who's only ever written one device driver." -- Daniel Pead
Clay wrote:

> Hello Erik, > > What you have so far looks really cool.
Thanks :-)
> For an equiriple type window > (which you said you realy don't want) is the Dolph-Chebyshev. And the > one that others suggest and I'll second (third, fourth whatever) the > Kaiser window - for one its adjustable. It is nearly optimal.
I'm really not sure why I didn't consider the Kaiser window earlier.
> If you need code to generate the modified > Bessel function of zeroth order, just let me know.
We if its public domain or under a GNU GPL compatible license, then yes please. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ I have now spent two days debugging C# on dotnot and all I can say is OMFG!!!! The MS tools are completely fucking abysmal. Its the most developer hostile environment I've ever worked on. The fact that people are actually able to release software that sort of works using these tools completely boggles my mind.
Erik de Castro Lopo wrote:

> Clay wrote: >> If you need code to generate the modified >> Bessel function of zeroth order, just let me know. > > We if its public domain or under a GNU GPL compatible license, > then yes please.
Actually, found one thats under the GPL, but thanks any way. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "Visual SourceSafe? It would be safer to print out all your code, run it through a shredder, and set it on fire." http://www.wadhome.org/svn_vs_vss.txt