Quantcast
Channel: KVR Audio
Viewing all articles
Browse latest Browse all 5828

DSP and Plugin Development • Fastest way to interpolate phase & magnitude between two complex spectra

$
0
0
I'm interpolating between to fourier bin arrays which represent wavetables in my synth. Doing linear interpolation on the complex bins works fine, unless the angle/phase of the complex numbers is far apart, making them in the worst case cross zero (for example interpolating from {1, 0} to {-1, 0}). A bin of complex zero of course results in no sinusoid output for this bin, which is undesirable.

I've come to the realization that retrieving the angle and amplitude, then interpolating these two and reconstructing a new complex number would circumvent this. However, my wavetables are 1024 bins long, and iFFT happens rather often parameters are being modulated. The "trivial" solution would go like this:

Code:

get phases (2x arctan)get magnitudes (2x sqrt)interpolatereconstruct complex number (sin + cos)
so in summary that's six expensive functions per bin.

I'm trying to wrap my head around if there's a faster way to achieve the above.

I've thought about faking the result above, to make it at least better than linear interpolation. For example one could just do linear interpolation and then scale the number to have a desired frequency, "pushing it outward" in the process.
This could also further be improved by approximating the magnitude (L2 norm) with L1 or L_infinity norms.

However, these introduce rather big discrepancies to the original formula. I've made a super messy desmos graph showing the different approaches in action in case anybody's interested:

https://www.desmos.com/calculator/ftcxe6drqu
Purple: Linear interpolation
Blue: Phase & angle interpolation
Green: "Push out" L2
Red: "Push out" L1
Orange: "Push out" L_infty

Happy to hear if there's any other methods or resources on what I'm after :)

Statistics: Posted by TheWaveWarden — Mon Jan 22, 2024 11:05 am — Replies 1 — Views 81



Viewing all articles
Browse latest Browse all 5828

Trending Articles