DSPRelated.com
Forums

Empirical Determination of Frequencies in "Nice" Signals

Started by Unknown July 25, 2005
Hello everyone,

I am a DSP hobbyist of sorts and I have discovered a technique for
frequency determination (and magnitude and phase) for the
constituent wave components of "nice" signals that I have not seen
anywhere in my web searches.

(Engineers should page down to the numbers now.  Read this later.)

By "nice", I mean signals that are composed of linear combinations 
of pure tones that are reasonably well spaced in frequency compared 
to the FFT resolution.  My goal is add a digital frequency display
of the dominant frequencies to a audio recording program I have
written.  Thus the program could be used as a tuner for tuning 
instruments to nonchromatic scales.  I have no idea how it is 
going to work with real world data, but I am hopeful.

The technique is quite straightforward and can probably rightly
be called "quick and dirty":

        Step 1. Do a straight up FFT (No Hanning Window)
        Step 2. Do a "Peak Deframing Transform" (PDT) on the FFT output
        Step 3. For each Magnitude Peak in the PDT: 
                   Empirically Calculate Constituent Wave Parameters

All the magic seems to occur in Step 2.  The transform consists simply
of subtracting from each FFT coefficient the average of its neighbors.
This is a linear transform so it preserves the magnitude.  It also
seems to make the output magnitude spectrum invariant on the input
phase or "FFT bin", as well as introducing symmetry.  The phase angles 
are much better behaved as well.  I called it "Peak Deframing" because
it makes the exact frequency spikes a little smeared out and the smeared
out fractional frequencies a lot more localized.  In other words, it
doesn't matter as much how you frame your signal with FFT windows, you
are going to get visually perceptively similar results.  I think
you can call it much better behaved for my purposes.

Because of the invariances and the symmetries, I found it much easier
than I thought to derive empirical approximation equations to apply
to the peaks.  I also found much simpler and more accurate equations 
than I expected.  All the empirical equations were derived by "playing 
with the numbers" and reducing the equations to their simplest form.

My attempts at a theoretical proof quickly ran into a algebraic thicket
I didn't want to mess with.  If anyone is sporting, or this has already 
been done, I would love to see it.

The nature of the phase approximation equation, and the nature of the
data, lead me to believe there are better equations based on the underlying
DFT coefficients (as complex numbers or vectors).  These equations would save
many square root and arctangent calculations.  These are what I will be 
searching for next, as well as ways to resolve nearby frequencies.

Since more people tend to be interested in results, I have listed them first.
I then show the code for the PDT and the empirical approximating equations.
Finally, I have run the equations on a wide range of single wave input tones
to give a baseline accuracy assessment.

Again, I am not an expert in the field, so if this is a well known technique,
please forgive my renaming of things.

Warm regards,
Anders

==============================================================================
==============================================================================
Two Component Signal
  
         Signal_Real#(I&) = 0.97 * Sin( 6.1 * Angle#) + _
                            0.97 * Cos(16.1 * Angle#)

                   FFT                             PDT
        ----------------------------    ----------------------------
        Real   Imag   Magn    Phas      Real   Imag   Magn    Phas   
        -----  -----  ------  ------    -----  -----  ------  ------
   1    0.012  0.005  0.0134  1.1985    0.000  0.000  0.0006  3.8140  
   2    0.014  0.011  0.0172  0.9032   -0.001 -0.001  0.0013  3.5699  
   3    0.016  0.019  0.0245  0.6925   -0.001 -0.003  0.0035  3.4924  
   4    0.020  0.034  0.0392  0.5407   -0.004 -0.013  0.0133  3.4646  
   5    0.033  0.074  0.0807  0.4234   -0.128 -0.393  0.4130  3.4560  
   6    0.302  0.899  0.9481  0.3237    0.298  0.917  0.9638  0.3140  0.9701  6.1000 6.2830
   7   -0.025 -0.109  0.1120  3.3708   -0.173 -0.531  0.5579  3.4560  
   8   -0.007 -0.056  0.0563  3.2718    0.006  0.018  0.0193  0.3035  
   9   -0.001 -0.039  0.0394  3.1594    0.001  0.004  0.0045  0.2489  
  10    0.004 -0.032  0.0319  3.0250    0.000  0.002  0.0018  0.0619  
  11    0.008 -0.027  0.0286  2.8616    0.000  0.001  0.0011  5.8725  
  12    0.013 -0.025  0.0285  2.6682   -0.001  0.001  0.0016  5.3452  
  13    0.021 -0.025  0.0325  2.4546   -0.003  0.001  0.0036  5.1117  
  14    0.035 -0.028  0.0445  2.2421   -0.013  0.004  0.0133  5.0419  
  15    0.074 -0.039  0.0839  2.0527   -0.393  0.128  0.4130  5.0269  
  16    0.899 -0.306  0.9499  1.8984    0.917 -0.298  0.9638  1.8848  0.9700 16.1000 1.5707
  17   -0.109  0.023  0.1112  4.9213   -0.531  0.172  0.5580  5.0267  
  18   -0.056  0.007  0.0561  4.8333    0.018 -0.006  0.0192  1.8818  
  19   -0.039  0.002  0.0393  4.7694    0.004 -0.001  0.0044  1.8740  
  20   -0.031  0.000  0.0313  4.7240    0.002  0.000  0.0017  1.8620  
  21   -0.027 -0.001  0.0266  4.6926    0.001  0.000  0.0008  1.8466  
  22   -0.024 -0.001  0.0235  4.6719    0.000  0.000  0.0005  1.8283  
  23   -0.021 -0.001  0.0214  4.6595    0.000  0.000  0.0003  1.8078  
  24   -0.020 -0.001  0.0199  4.6533    0.000  0.000  0.0002  1.7855  
  25   -0.019 -0.001  0.0187  4.6521    0.000  0.000  0.0001  1.7617  
  26   -0.018 -0.001  0.0179  4.6548    0.000  0.000  0.0001  1.7368  
  27   -0.017 -0.001  0.0172  4.6604    0.000  0.000  0.0001  1.7108  
  28   -0.017 -0.001  0.0167  4.6683    0.000  0.000  0.0001  1.6840  
  29   -0.016 -0.001  0.0163  4.6779    0.000  0.000  0.0001  1.6564  
  30   -0.016  0.000  0.0161  4.6888    0.000  0.000  0.0001  1.6283  

Things to look for:
   The FFT coefficients have been normalized
   Uniformity in the two peaks in the PDT magnitudes
   The 180 degree flip and the persistence in the PDT phases around a peak
   Quick die off of PDT magnitudes near the peaks
   A Cosine signal is just a PI/2 phase shift of a Sine signal
   Near 2*PI = Near 0

==============================================================================
A More Complicated Mixed Signal

         Signal_Real#(I&) = 0.97  * Sin( 6.1 * Angle#      ) + _
                            1     * Sin(11   * Angle# + 0.1) + _
                            1.234 * Sin(19.5 * Angle# + 0.2) + _
                            1.234 * Sin(23.8 * Angle#      ) + _
                            0.5   * Sin(27.5 * Angle# + 2  ) + _
                            0.5   * Sin(29   * Angle# + 2  ) + _
                            0.97  * Cos(16.1 * Angle#      )

                   FFT                             PDT
        ----------------------------    ----------------------------
        Real   Imag   Magn    Phas      Real   Imag   Magn    Phas   
        -----  -----  ------  ------    -----  -----  ------  ------
   1    0.084  0.003  0.0837  1.5407    0.000  0.000  0.0006  3.9580  
   2    0.085  0.006  0.0852  1.5013   -0.001 -0.001  0.0014  3.6524  
   3    0.088  0.012  0.0885  1.4380   -0.001 -0.003  0.0035  3.5291  
   4    0.093  0.024  0.0961  1.3184   -0.004 -0.013  0.0133  3.4756  
   5    0.107  0.061  0.1234  1.0507   -0.128 -0.393  0.4130  3.4565  
   6    0.377  0.884  0.9610  0.4030    0.298  0.917  0.9638  0.3138  0.9701  6.1000 6.2828
   7    0.052 -0.127  0.1369  2.7541   -0.173 -0.530  0.5579  3.4565  
   8    0.072 -0.077  0.1052  2.3860    0.005  0.019  0.0193  0.2873  
   9    0.082 -0.063  0.1033  2.2310    0.001  0.004  0.0045  0.1607  
  10    0.090 -0.059  0.1073  2.1540   -0.050 -0.496  0.4981  3.2428  
  11    0.198  0.936  0.9569  0.2086    0.099  0.996  1.0012  0.0987  1.0012 11.0006 0.0968
  12    0.109 -0.061  0.1254  2.0805   -0.052 -0.496  0.4990  3.2463  
  13    0.125 -0.066  0.1414  2.0570   -0.005  0.002  0.0052  5.0868  
  14    0.150 -0.075  0.1678  2.0325   -0.015  0.005  0.0160  5.0362  
  15    0.206 -0.094  0.2260  1.9977   -0.397  0.129  0.4178  5.0264  
  16    1.056 -0.371  1.1191  1.9083    0.907 -0.295  0.9535  1.8856  0.9617 16.1153 1.5233
  17    0.093 -0.057  0.1092  2.1207   -0.560  0.179  0.5883  5.0219  
  18    0.251 -0.102  0.2708  1.9570   -0.188  0.037  0.1912  4.9067  
  19    0.784 -0.221  0.8143  1.8454    1.030 -0.207  1.0503  1.7695  1.2528 19.5185 0.1407
  20   -0.743  0.075  0.7463  4.8133   -1.027  0.212  1.0490  4.9156  
  21   -0.214 -0.052  0.2203  4.4731    0.199 -0.031  0.2018  1.7275  
  22   -0.084 -0.117  0.1438  3.7669   -0.003  0.041  0.0414  6.2004  
  23    0.053 -0.263  0.2687  2.9448    0.482 -0.649  0.8083  2.5026  
  24   -0.775  0.887  1.1781  5.5653   -0.700  0.976  1.2011  5.6605  1.2345 23.7943 0.0237
  25   -0.201  0.087  0.2194  5.1190    0.265 -0.343  0.4333  2.4846  
  26   -0.157 -0.028  0.1597  4.5384    0.053  0.055  0.0763  0.7669  
  27   -0.219 -0.252  0.3339  3.8573   -0.171 -0.392  0.4278  3.5527  
  28    0.061  0.308  0.3140  0.1957   -0.048  0.488  0.4899  6.1850  
  29    0.437 -0.107  0.4501  1.8108    0.421 -0.286  0.5090  2.1680  0.5288 28.7576 2.9297
  30   -0.028  0.050  0.0579  5.7717   -0.231  0.093  0.2493  5.0941  

Things to look for:
   Distortion effects of nearby components (compare to two component sample)
   Failure of algorithm to resolve the 27.5 and 29 cycle components

==============================================================================
The PDT - Peak Deframing Transform

        For I& = 1 To ClipLimit& - 1
         PDT_R# = FFT_Real#(I&) - 0.5 * (FFT_Real#(I& - 1) + FFT_Real#(I& + 1))
         PDT_I# = FFT_Imag#(I&) - 0.5 * (FFT_Imag#(I& - 1) + FFT_Imag#(I& + 1))
        
         PDT_Real#(I&) = PDT_R#
         PDT_Imag#(I&) = PDT_I#
         PDT_Magn#(I&) = Sqr(PDT_R# * PDT_R# + PDT_I# * PDT_I#)
         PDT_Phas#(I&) = FindAngle#(PDT_I#, PDT_R#)
        Next

Things to look for:
   In VB, a # suffix means "double" and & suffix means "int"

==============================================================================
Empirical Constituent Wave Parameter Calculations

        Mag# = PDT_Magn#(PeakFreq&)
        Mag1# = PDT_Magn#(PeakFreq& - 1)
        Mag2# = PDT_Magn#(PeakFreq& + 1)
        
        Ratio1# = Mag1# / Mag#
        Ratio2# = Mag2# / Mag#
        
        Frac1# = (2 * Ratio1# - 1) / (Ratio1# + 1)
        Frac2# = (2 * Ratio2# - 1) / (Ratio2# + 1)
        
        AveFrac# = 0.5 * (Frac2# - Frac1#)
        AveFrac_2# = AveFrac# * AveFrac#

        ApproxMagn# = Mag# * (1     + AveFrac_2# * ( _
                              0.646 + AveFrac_2# * ( _
                              0.265)))

        ApproxFreq# = PeakFreq& + AveFrac#

        ApproxPhas# = ProperRange(PDT_Phas#(PeakFreq&) - AveFrac# * PI)

Things to look for:
   The fraction is calculated from both sides of the peak
   The output phase formula is really a simple sum
   The magnitude calculation is base frequency and phase independent
   The magnitude calculation is an ugly curve fit

==============================================================================
Base Line Pure Tone Accuracy

         Signal_Real#(I&) = Sin(Frequency# * Angle# + Phase#)

  Input Magnitude = 1, Input Frequency = Down the Side, Input Phases = 0,2,4 

          ( Phase Input = 0 )       ( Phase Input = 2 )      ( Phase Input = 4 )
        -----------------------   -----------------------   -----------------------
  Tone  Magn    Freq     Phase    Magn    Freq     Phase    Magn    Freq     Phase    
 -----  ------  -------  ------   ------  -------  ------   ------  -------  ------
  4.50  1.0004  4.49997  0.0001   0.9997  4.50002  2.0003   0.9999  4.50000  3.9995
  4.60  1.0005  4.60001  6.2829   1.0002  4.60000  2.0004   1.0000  4.59999  3.9997
  4.70  1.0002  4.70001  6.2829   1.0003  4.70002  2.0002   0.9999  4.69997  4.0001
  4.80  1.0000  4.79999  6.2830   1.0002  4.80004  2.0000   0.9999  4.79996  4.0002
  4.90  0.9999  4.89997  0.0000   1.0001  4.90003  1.9999   1.0000  4.89998  4.0001
  5.00  1.0000  5.00000  0.0000   1.0000  5.00000  2.0000   1.0000  5.00000  4.0000
  5.10  1.0001  5.10004  6.2830   1.0000  5.10000  2.0001   0.9999  5.09996  4.0000
  5.20  1.0001  5.20004  6.2829   1.0002  5.20006  2.0000   0.9999  5.19989  4.0003
  5.30  1.0001  5.29994  6.2831   1.0005  5.30017  1.9996   0.9999  5.29983  4.0006
  5.40  0.9999  5.39979  0.0005   1.0006  5.40025  1.9992   1.0000  5.39988  4.0006
  5.50  0.9994  5.49969  0.0010   1.0003  5.50020  1.9991   1.0000  5.50005  4.0002

  9.50  1.0000  9.49999  0.0000   0.9999  9.50001  2.0000   1.0000  9.50000  3.9999
  9.60  1.0003  9.59999  6.2832   1.0002  9.60000  2.0000   1.0002  9.60000  4.0000
  9.70  1.0002  9.70000  6.2832   1.0002  9.70000  2.0000   1.0001  9.70000  4.0000
  9.80  1.0001  9.80000  6.2832   1.0001  9.80000  2.0000   1.0000  9.80000  4.0000
  9.90  1.0000  9.90000  6.2832   1.0000  9.90000  2.0000   1.0000  9.90000  4.0000
 10.00  1.0000 10.00000  0.0000   1.0000 10.00000  2.0000   1.0000 10.00000  4.0000
 10.10  1.0000 10.10000  6.2832   1.0000 10.10000  2.0000   1.0000 10.10000  4.0000
 10.20  1.0001 10.20000  6.2832   1.0001 10.20000  2.0000   1.0000 10.19999  4.0000
 10.30  1.0001 10.30000  6.2832   1.0002 10.30001  2.0000   1.0001 10.29999  4.0001
 10.40  1.0002 10.39998  0.0000   1.0003 10.40002  1.9999   1.0002 10.39999  4.0001
 10.50  0.9999 10.49997  0.0001   1.0000 10.50002  1.9999   1.0000 10.50000  4.0000

 14.50  1.0000 14.50000  6.2832   1.0000 14.50000  2.0000   1.0000 14.50000  4.0000
 14.60  1.0002 14.60000  6.2832   1.0002 14.60000  2.0000   1.0002 14.60000  4.0000
 14.70  1.0002 14.70000  6.2832   1.0002 14.70000  2.0000   1.0002 14.70000  4.0000
 14.80  1.0001 14.80000  6.2832   1.0001 14.80000  2.0000   1.0001 14.80000  4.0000
 14.90  1.0000 14.90000  0.0000   1.0000 14.90000  2.0000   1.0000 14.90000  4.0000
 15.00  1.0000 15.00000  0.0000   1.0000 15.00000  2.0000   1.0000 15.00000  4.0000
 15.10  1.0000 15.10000  6.2832   1.0000 15.10000  2.0000   1.0000 15.10000  4.0000
 15.20  1.0001 15.20000  6.2832   1.0001 15.20000  2.0000   1.0001 15.20000  4.0000
 15.30  1.0002 15.30000  6.2832   1.0002 15.30000  2.0000   1.0002 15.30000  4.0000
 15.40  1.0002 15.40000  0.0000   1.0002 15.40000  2.0000   1.0002 15.40000  4.0000
 15.50  1.0000 15.50000  0.0000   1.0000 15.50000  2.0000   1.0000 15.50000  4.0000

 19.50  0.9999 19.50001  6.2831   1.0000 19.49999  2.0000   1.0000 19.50000  4.0000
 19.60  1.0002 19.60001  6.2832   1.0002 19.60000  2.0000   1.0002 19.59999  4.0000
 19.70  1.0002 19.70000  0.0000   1.0001 19.70000  2.0000   1.0002 19.69999  4.0000
 19.80  1.0001 19.80000  0.0000   1.0001 19.80000  2.0000   1.0001 19.80000  4.0000
 19.90  1.0000 19.90000  0.0000   1.0000 19.90000  2.0000   1.0000 19.90000  4.0000
 20.00  1.0000 20.00000  0.0000   1.0000 20.00000  2.0000   1.0000 20.00000  4.0000
 20.10  1.0000 20.10000  0.0000   1.0000 20.10000  2.0000   1.0000 20.10000  4.0000
 20.20  1.0001 20.20000  0.0000   1.0001 20.20000  2.0000   1.0001 20.20000  4.0000
 20.30  1.0002 20.30000  0.0000   1.0001 20.30000  2.0000   1.0002 20.30000  4.0000
 20.40  1.0002 20.40000  0.0000   1.0002 20.40000  2.0000   1.0002 20.40000  4.0000
 20.50  1.0000 20.50001  6.2832   1.0000 20.50000  2.0000   1.0000 20.50000  4.0000

 24.50  0.9998 24.50010  6.2829   1.0001 24.49993  2.0001   1.0000 24.49999  4.0002
 24.60  1.0001 24.60006  6.2830   1.0002 24.59999  1.9999   1.0003 24.59994  4.0003
 24.70  1.0001 24.70002  0.0000   1.0001 24.70003  1.9998   1.0003 24.69994  4.0002
 24.80  1.0001 24.79999  0.0001   1.0000 24.80003  1.9999   1.0001 24.79997  4.0001
 24.90  1.0000 24.89999  0.0001   1.0000 24.90001  2.0000   1.0000 24.89999  4.0000
 25.00  1.0000 25.00000  0.0000   1.0000 25.00000  2.0000   1.0000 25.00000  4.0000
 25.10  1.0000 25.10001  0.0000   1.0000 25.10000  2.0000   1.0000 25.10000  4.0000
 25.20  1.0000 25.20000  0.0001   1.0000 25.20000  1.9999   1.0001 25.19999  4.0000
 25.30  1.0002 25.30000  0.0001   1.0001 25.30000  2.0000   1.0003 25.30000  4.0000
 25.40  1.0003 25.40001  0.0000   1.0001 25.39999  2.0001   1.0003 25.40001  3.9999
 25.50  1.0001 25.50003  6.2831   0.9999 25.49998  2.0002   0.9999 25.50000  3.9999

Things to look for:
   Pretty darn accurate if you have a signal composed of a single pure tone

==============================================================================

H=2E Ander L=F6nnemo wrote:
.=2E.
> The technique is quite straightforward and can probably rightly > be called "quick and dirty": > > Step 1. Do a straight up FFT (No Hanning Window) > Step 2. Do a "Peak Deframing Transform" (PDT) on the FFT output > Step 3. For each Magnitude Peak in the PDT: > Empirically Calculate Constituent Wave Parameters > > All the magic seems to occur in Step 2. The transform consists simply > of subtracting from each FFT coefficient the average of its neighbors.
It's odd that you explicitely mention in Step 1. that no Hanning window is applied (out of all possible windows), only to then apply a Hanning window (via frequency domain convolution) in Step 2. Is that coincidence? By the way, I know this is often called Hanning window. The correct name should however be von Hann window. Regards, Andor
In article <1122306925.601342.135410@z14g2000cwz.googlegroups.com>, 
an2or@mailcircuit.com says...
> >H=2E Ander L=F6nnemo wrote: >.=2E. >> The technique is quite straightforward and can probably rightly >> be called "quick and dirty": >> >> Step 1. Do a straight up FFT (No Hanning Window) >> Step 2. Do a "Peak Deframing Transform" (PDT) on the FFT output >> Step 3. For each Magnitude Peak in the PDT: >> Empirically Calculate Constituent Wave Parameters >> >> All the magic seems to occur in Step 2. The transform consists simply >> of subtracting from each FFT coefficient the average of its neighbors. > >It's odd that you explicitely mention in Step 1. that no Hanning window >is applied (out of all possible windows), only to then apply a Hanning >window (via frequency domain convolution) in Step 2. Is that >coincidence? > >By the way, I know this is often called Hanning window. The correct >name should however be von Hann window. > >Regards, >Andor >
Andor, Well, I knew if I posted on this group I would learn something new. But are you sure of the equivalence. If I use the wave addition formula on the two neighboring cells I get the the "beat phenomenon" with two beats across my frame. The point is, the average frequency is near, but not on, the center frequency, so I don't understand your stated equivalency. This is the discrete case. SIN(A) + SIN(B) = SIN( (A+B)/2 ) * COS( (A-B)/2 ) 1/(N-1) + 1/(N+1) = N / (N^2 - 1) != 1 / N Am I still misunderstanding? What I am more curious about is if anyone has seen the magnitude/frequency/phase approximation formulas before. Thanks, Anders
> Well, I knew if I posted on this group I would learn something new. But are you > sure of the equivalence.
It depends how you handle the start and end-point of the FFT output. If you do true circular convolution with the kernel [-1/2 1 -1/2] (as you say subtracting the average of the neighbours), then this is indeed equivalent to von Hann windowing in time domain.
> SIN(A) + SIN(B) = SIN( (A+B)/2 ) * COS( (A-B)/2 ) > > 1/(N-1) + 1/(N+1) = N / (N^2 - 1) != 1 / N > > Am I still misunderstanding?
I'm not quite sure what you mean to imply with those two equations. They are both wrong by a factor of two, by the way.
> What I am more curious about is if anyone has seen the > magnitude/frequency/phase approximation formulas before.
Sorry, I can't really comment on your approach for peak frequency detection (as it's not my field of expertise). However, if it works satisfactory for the test signals, go ahead and see how it performs using real world signals. How do you determine the number of "relevant" components (peaks) in your FFT? Regards, Andor
Andor,

Adding, not subtracting, the average of the neighbors to each FFT bin
would give the Hanning window (scaled by 2).

Just curious, what authority named the window the 'von Hann' window?

Dirk

Andor wrote:
> H. Ander L=F6nnemo wrote: > ... > > The technique is quite straightforward and can probably rightly > > be called "quick and dirty": > > > > Step 1. Do a straight up FFT (No Hanning Window) > > Step 2. Do a "Peak Deframing Transform" (PDT) on the FFT output > > Step 3. For each Magnitude Peak in the PDT: > > Empirically Calculate Constituent Wave Parameters > > > > All the magic seems to occur in Step 2. The transform consists simply > > of subtracting from each FFT coefficient the average of its neighbors. > > It's odd that you explicitely mention in Step 1. that no Hanning window > is applied (out of all possible windows), only to then apply a Hanning > window (via frequency domain convolution) in Step 2. Is that > coincidence? > > By the way, I know this is often called Hanning window. The correct > name should however be von Hann window. >=20 > Regards, > Andor
Dirk,

> Adding, not subtracting, the average of the neighbors to each FFT bin > would give the Hanning window (scaled by 2).
take the inverse FFT of [1 1/2 0 ... 0 1/2 ] and [1 -1/2 0 ... 0 -1/2 ] (where the dots represent arbitrary length zero-padding) and tell me which one do you think looks like a von Hann window (scaled by 2), and which one looks like a (1 - von Hann) "window".
> Just curious, what authority named the window the 'von Hann' window?
Blackman and Tukey (they used "hanning" as a verb denoting the action of applying a "von Hann" window, starting off the whole mix-up). Regards, Andor
Andor,

I stand corrected.  In my haste I was computing a zero phase window,
which of course you wouldn't use.

On the name topic.  Why does anyone care?

Dirk

In article <1122328208.594140.182440@f14g2000cwb.googlegroups.com>, 
an2or@mailcircuit.com says...
> >> Well, I knew if I posted on this group I would learn something new. But are
you
>> sure of the equivalence. > >It depends how you handle the start and end-point of the FFT output. If >you do true circular convolution with the kernel [-1/2 1 -1/2] (as you >say subtracting the average of the neighbours), then this is indeed >equivalent to von Hann windowing in time domain. > >> SIN(A) + SIN(B) = SIN( (A+B)/2 ) * COS( (A-B)/2 ) >> >> 1/(N-1) + 1/(N+1) = N / (N^2 - 1) != 1 / N >> >> Am I still misunderstanding? > >I'm not quite sure what you mean to imply with those two equations. >They are both wrong by a factor of two, by the way.
Yes. I sure responded in a hurry, I was also off by reciprocals too. PDT_N = FFT_N - 1/2 * ( FFT_N-1 + FFT_N+1 ) = S_N dot W - 1/2 * ( S_N-1 dot W + S_N+1 dot W ) ' Sines side only = ( S_N - 1/2 * ( S_N-1 + S_N+1 ) ) dot W = ( SIN( Nt ) - 1/2 * ( SIN( (N-1)t ) + SIN( (N+1)t ) ) dot W = ( SIN( Nt ) - 1/2 * ( 2 * SIN( Nt ) * COS( t ) ) ) dot W = ( ( 1 - COS( t ) ) * SIN( Nt ) ) dot W So a Von Hann window function of 1 - COS is equivalent to subtracting the average of the neighbors in the frequency domain. That is so cool.
>> What I am more curious about is if anyone has seen the >> magnitude/frequency/phase approximation formulas before. > >Sorry, I can't really comment on your approach for peak frequency >detection (as it's not my field of expertise). However, if it works >satisfactory for the test signals, go ahead and see how it performs >using real world signals.
That is what I plan to do. What I am aiming for is an "oscilliscope" display in my recording program that will lock on to the dominant frequency (if one is clearly found) in real time. I am very interested in studying, and modelling, how an audio waveform degrades over distance.
> >How do you determine the number of "relevant" components (peaks) in >your FFT?
I simply loop through the cells looking for the ones that are larger than their immediate neighbors. The peaks are remarkably well behaved in isolation and they should be equally well predictible in their "interference" when they get close to each other. I am very confident that I should be able to measure these interactions and come up with adjustment formulas for nearby peaks. I also think that I should be able to resolve multiple constituent peaks/slopes in the signal envelope when they occur.
> >Regards, >Andor >

Andor wrote:
> Dirk, > > > Adding, not subtracting, the average of the neighbors to each FFT bin > > would give the Hanning window (scaled by 2). > > take the inverse FFT of [1 1/2 0 ... 0 1/2 ] and [1 -1/2 0 ... 0 -1/2 ] > (where the dots represent arbitrary length zero-padding) and tell me > which one do you think looks like a von Hann window (scaled by 2), and > which one looks like a (1 - von Hann) "window". > > > Just curious, what authority named the window the 'von Hann' window? > > Blackman and Tukey (they used "hanning" as a verb denoting the action > of applying a "von Hann" window, starting off the whole mix-up).
I think whoever did the change (Blackman & Tukey?) also introduced "hanning" as a "playful refernce" to the Hamming window, which was suggested by Richard Hamming. Except for the hanning/von Hann/Hann window, the names of the windows either point to the first person to suggest them (Hamming, von Hann, Kaiser, Blackman, Bartlett,...) or the shape of the window (triangular, rectangular, raised cosine,...). Rune
"dbell" <dirkman@erols.com> wrote in message 
news:1122385286.673814.55080@g49g2000cwa.googlegroups.com...
> Andor, > > I stand corrected. In my haste I was computing a zero phase window, > which of course you wouldn't use. > > On the name topic. Why does anyone care? > > Dirk >
I think Otto von Hann would care if he were still alive. Clay