By Georg-Johann own work, CC BY-SA 3.0.
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?