# Splitting a magnitude across multiple bins in an IFFT I’m trying to synthesise a sine wave using an IFFT at a frequency between bin centre frequencies.

Here are the details

-Samplerate : 44100
-FFT Size   : 512
-SignalFreq : 110 hz
-FreqPerBin : 86.1328125
-Bin1Freq   : 86.1328125
-Bin2Freq   : 172.265625


This desired Signal Frequency means that the signal is at midway between $\textrm{bin}_1$ and $\textrm{bin}_2$ (magnitudes) therefore I am wanting to split the synthesis magnitude across 3 bins: $\textrm{bin}_0 , \textrm{bin}_1$ and $\textrm{bin}_2$.

What am I doing wrong? Here’s how I’ve approached my calculation.

• First I calculated the synthesis frequencies percentage between the bins.
0.554195011337869  = (SignalFreq − Bin1Freq) ÷ (FreqPerBin ÷ 2)
• Then I multiplied the percentage by PI ($\pi$) to convert it to radians (note I have assumed that bin centre frequency to the bin frequency midway between $\textrm{bin}_1$ and $\textrm{bin}_2 = \pi$
1.74105497627516 = (0.554195011337869 * PI)
• Then process it through the $\mathrm{sinc}$ function

0.566059652593099 = Sin(1.74105497627516)/1.74105497627516
Which give me the scaling value of $\textrm{bin}_1$

• To calculate bin 2, I take the radian value of $\textrm{bin}_1$ and add PI to it (because this moves the location into the next bin for the $\mathrm{sinc}$ function )

4.88264762986495 =  (bin1 radian value) 1.74105497627516 + PI

• Process it through the $\mathrm{sinc}$ function

-0.201845607081636 = sin(4.88264762986495)/4.88264762986495
Which gives me the a value for $\textrm{bin}_2$. (I’m assuming this should be the absolute value)

• To calculate bin 3, I take the radian value of $\textrm{bin}_1$ and subtract PI from it

-1.40053767731463 =  (bin1 radian value) 1.74105497627516 - PI

• Process it through the sinc function
0.703687584403628 = sin(-1.40053767731463)/-1.40053767731463

My initial magnitude for $\textrm{bin}_1$ was $1.0$ so this means that splitting $\textrm{bin}_1$ across $\textrm{bin}_0,$\textrm{bin}_1 and $\textrm{bin}_2$ looks like this

bin0 = 0.703687584403628
bin1 = 0.566059652593099
bin2 = 0.201845607081636


This doesn’t seem right to me. It seems like bin0 (apart from this bin wanting to have a value of 0.0) has a value higher than the bin matching the frequency of the signal.

What am I doing wrong?

Your frequency in term of bin number is approximately:

SignalF / binDelta = 110 / 86.1 = 1.28


So, for the positive frequency image :

w0 = pi * (0 - 1.28)
w1 = pi * (1 - 1.28)
w2 = pi * (2 - 1.28) = pi * 0.72
wx = pi * (x - 1.28)
binmag(x) = sin(wx) / wx


Also, one needs more than 3 points to avoid windowing artifacts.

But the big problem with Sinc interpolation for any f near bin 0 (DC) is that the signal plus its complex conjugate mirror image at the nearby negative frequency -f both wrap across bin 0, and thus constructively or destructively interfere within all those nearby bins, depending on the phase of f measured relative to the center of the window. See http://www.nicholson.com/rhn/dsp.html#4 for a more complete Sinc (or Dirichlet) interpolation formula. A similar problem occurs for frequencies near bin N/2 for an IFFT of length N. This creates a problem with IFFT (re)synthesis of any fractional frequencies near DC or N/2.

• Thanks. and thanks for the link. It will take me a while to digest it completely. I was aware of the bin 0 consideration. What happens when the these 'interpolated' values overlap with other harmonics in the spectrum of a more complex waveform. i.e. how would they be mixed? Jun 18 '16 at 21:10
• @cixelsyd : Usually additively in any LTI system. Jun 19 '16 at 0:18
• Does the sinc function have to be applied to the phases as well? I had assumed from reading Stephen Bernsee's site that the phases would all be identical. It is of course probably that I didn't fully understand what Stephen was explaining. Jun 19 '16 at 2:54