# Various size arrays interpolation

Hello,
sorry it’s probably stupid math question but it’s third day that I try to figure it out how to do that. And just can’t find the solution.

Let’s say I have `std::vector A` size 4, and `B` size 8. And I need to put/spread evenly all 8 values
from `B` to 4 places in `A`. In that case it’s quite easy to imagine the solution, but let’s say I have `A` size 44100, and `B` size 48000. How to express 48000 values `B` by 44100 values of `A`.
I know there are a lot of free and ready to use resampling algorithms, by I don’t need to use them. I need to understand mathematical basis of those algorithms. And not only for audio. But for other purposes also. I need it for my study. Could anyone help me?
Best regards.

That‘s called resampling. JUCE has a ResamplingAudioSource: https://docs.juce.com/master/classResamplingAudioSource.html#details

There you‘ll find two other keywords: Lagrange Interpolation and CatmullRom interpolation. You can look at the code or just google the keywords and look at the Wikipedia articles. Other keyword which might be useful to get an idea of what’s happening: interplation, linear Interpolation, nearest neighbor (don‘t use the last one )

1 Like

Thanks