# Instantaneous magnitude

I was reading this thread: How to get Instantaneous Magnitude for a Instantaneous Frequency From FFT?

I have basically the same question, but I'm curious about more detail about the Hann window kernel. ederwander said that once you know the frequency offset from the nearest bin then the instantaneous magnitude is a the Hann kernel of your offset times FFT length, times magnitude of the bin you're offset for.

Where the Hann window kernel $W(k) = 0.5 (\operatorname{sinc}(k(M/N)) / (1 - (k(M/N))^2)$

I'm just not sure why that kernel evaluated at offset*N gives the proper scaling factor for adjusting the magnitude. I couldn't even find any other information on the Hann kernel or how it is derived.

Thanks!!

@Andy to extract the instantaneous Frequency I'm computing the phase difference ∆φ[i] of successive phase spectra using Flanagan and Golden[1]:

Where q[i] is:

$$q[i] = \frac{N}{2πH} princarg \left[φ_l[i] − φ_{l−1}[i] − \frac {2πH}{N}i \right]$$

Princarg maps the phase in a range of ±pi and the bin offset q denotes the deviation of the partial’s Instantaneous Frequency from the bin.

The Instantaneous Frequency can be determined as:

$$InstFreqs[i] = (i + q[i]) \left(\frac{Fs}{N}\right)$$

Now if you observe:

abs(InstFreqs(i) / (Fs/N) - i) == abs(q[i])


For the hann window kernel definition you can read the paper from A. Kivinukk and G. Tamberg [2] and the page 76 from book New Perspectives on Approximation and Sampling Theory.

$$cos^2\frac{ πu}{2} == \frac12(1 + cosπu)$$

Hann Kernel defined by:

$$\frac{1}{2}\frac{sinc (t)}{1-t^2}$$

For no zero padd the correction does not arrive 3dB.

[1] J. L. Flanagan and R. M. Golden, “Phase vocoder,” Bell Systems Technical Journal, vol. 45, pp. 1493–1509, 1966.

2 A. Kivinukk and G. Tamberg, On sampling operators defined by the Hann window and some of their extensions Sampling Theory in Signal and Image Processing, 2, 235–258, 2003

The Hann Window Kernel is the FFT of the Hann Window.

Offset is defined strangely, and unnecessarily. calculating InstFreqs and then dividing it by Sampling Frequency Fs is just throwing away the work of attaining it.

Bin Resolution = Fs / N
//InstFreqs will start at 0Hz and peak at Fs Hz (or half that??)
InstFreqs(i) = i * Fs / N


So in the referenced answer:

Offset = abs(InstFreqs(i) / (Fs/N) - i)


but if I'm correct that: InstFreqs(i) = i * Fs / N then:

Offset = abs(InstFreqs(i) / (Fs/N) - i) = abs( i - i ) = 0


So that line didn't make sense. Too bad there was no comment hinting at what it was supposed to mean.

index is put into Wk it must span the length of the Window, and not the length of the FFT. So let's start by changing that. N * Offset will (likely) exceed the length of M (window size)

index = floor(abs(Offset) * N) + 1
InstMag = Mag(i) * Wk(index)


Unless of course I misinterpreted what InstFreqs(i) is, which it seems I have.

• No need to use strike. History of edits is kept. Also you might missed some code formatting block.
– jojek
Feb 17 '15 at 16:26