# Highest quality realtime sample interpolation methods?

DSP, Plug-in and Host development discussion.
KVRian
1244 posts since 9 Jan, 2006
The FIR kernel doesn't have to be small. The number of multiplications per sample equals kernel length / resampling ratio.

But, really the thread is about non integer ratios. So this is getting a bit off topic.

KVRAF
2538 posts since 4 Sep, 2006 from 127.0.0.1
in my post above, i meant "causal IIR filter", sorry for the typo
i know that i can take the IR of an IIR and truncate/window it and use it as a FIR, i'd do that, except i don't think i know how to design a "very steep" lowpass IIR so i can sample it
that's why i thought to try and window the actual sinc() assymetrically, but i couldn't find a way to make it look "smooth" in the beginning
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.freenode.net >>> #kvr

KVRAF
6312 posts since 12 Feb, 2006 from Helsinki, Finland
antto wrote:in my post above, i meant "causal IIR filter", sorry for the typo
i know that i can take the IR of an IIR and truncate/window it and use it as a FIR, i'd do that, except i don't think i know how to design a "very steep" lowpass IIR so i can sample it
that's why i thought to try and window the actual sinc() assymetrically, but i couldn't find a way to make it look "smooth" in the beginning
Cepstrum approach (from memory):

1. take the linear-phase kernel and FFT it
2. calculate the absolute magnitudes and take the logarithm (you can add a tiny offset like -200dB or something to keep the logarithm from going infinite at zeroes)
3. take IFFT of the "log-spectrum"
4. add the first half reversed into the second half, then zero out the first half
5. take FFT of the result
6. take the (complex) exponent of each bin
7. take IFFT of the result

This approach is somewhat imperfect as there is necessarily some aliasing and numerical errors, but it works well enough for stuff like windowed sincs that don't have too much going on in the spectrum.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRian
1244 posts since 9 Jan, 2006
antto wrote:in my post above, i meant "causal IIR filter", sorry for the typo
i know that i can take the IR of an IIR and truncate/window it and use it as a FIR, i'd do that, except i don't think i know how to design a "very steep" lowpass IIR so i can sample it
that's why i thought to try and window the actual sinc() assymetrically, but i couldn't find a way to make it look "smooth" in the beginning
Hi Antto, well truncated IIR was just my third suggestion. First of all I mentioned cepstrum, which mystran has outlined nicely.

As for steep IIR filters for truncation have you seen this IIR designer? It can do elliptical up to 20th order, so should be good enough.

Here's the page with a code example of the cepstrum method.

Regarding a smooth start of the impulse response. I believe the steeper the filter the further the main peak of the transformed sinc will be from the beginning of the kernel. I imagine it should still be smooth though. Although presumably the frequency and phase response should be a better indicator than the shape of the kernel?

KVRer
12 posts since 13 Apr, 2021 from Paris, France
Hello all,
Considering the subject of this thread is quite expert and focused on realtime, we hope it is a good place to ask if any of you would be interested in bringing their C++ realtime audio expertise, on a consulting mission, to assist our existing team with specific realtime / buffer / latency aspects of our upcoming audio plugin. Let us know!