Various size arrays interpolation - resampling
Re-sampling is annoyingly messy &amp; complicated. 

The math is straight forward enough. Let's start with "rational" sampling rate conversion. Rational means the ratio of the two sample rates can be expressed as a fraction of two (preferably small) integers. Example: going from 48 kHz to 40 kHz has a ratio of 5/6 (output/rate over input rate) and the frequency that both divide is 240 kHz

The steps are the following


Up-sample by the numerator to the common divisor frequency. This is done by inserting zeros between the samples of the input signal. 
Up-sampling results in periodic repetition of the spectrum in the frequency domain. It creates so-called mirror spectra. In our example we have up sampled from 48 kHz to 240 kHz. 
In order to get rid of the mirror spectra you need to lowpass filter the signal.  That lowpass filter needs to be chosen so there is no aliasing, i.e. below the smaller of the two Nyquist frequencies.
Downsample the low passed signal. This is simply done by throwing away the samples you don't need. In our example, you would only keep every sixth sample. 


So the basic operations are: up-sampling, low-pass filtering, down-sampling. 

This process tends to be expensive: you are running a very steep low-pass filter at a very high sampling rate. There are a few ways to make it a lot more efficient, especially if the lowpass filter is an FIR filter. There are two properties you can exploit:


You don't need to calculate the samples that you are going to throw away anyway
After up-sampling, most of your input samples into the low-pass filter are zero, so you can eliminate these from the convolution calculation


When you do both of these things, you end up with a so-called poly-phase filter. See for example http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE521_files/IV-05%20Polyphase%20FIlters%20Revised.pdf 

In essence you calculate each output sample by filtering the appropriate input samples with an FIR filter. The FIR filter is time-varying, i.e. it's different from one sample to the next. You can also interpret the whole process as filtering with a time-variant fractional delay: the filter you need is a function of how much time offset there is between a specific output sample and the input sequence. In our example you would need to sample at the times $0,1.2,2.4,3.6,4.8,6.0,7.2 $ etc

The number of different filters you need is the numerator in the ratio fraction. That's okay for 48 kHz to 40 kHz but less convenient for 48 kHz to 44.1 kHz where the integer ratio can only be reduced to 137/160. In many cases the ratio cannot be reasonably expressed as an integer ratio and often it's also time variant (different master clocks). In this case we need to do irrational sample rate conversion. 

Irrational sample rate conversion typically also uses a poly phase filter with some reasonable number of phases (say 32 or thereabouts). For each output sample you then calculate the exact phase (or fractional delay) and then linearly interpolate between the two closest phases that you have.

Now comes the tricky part: The design and choice of the low-pass filter needs to be carefully matched to your specific application requirements. We can't use an ideal low-pass filter since it's infinitely long and non-causal. So when designing this filter you need to know things like


What signal to noise ratio are you shooting for?
What overall delay can you tolerate ?
What is the highest "good" frequency you want?
Are you sensitive to phase distortion, phase modulation ?
How much aliasing can you tolerate?
How much pre-ringing is acceptable?
How much CPU and memory can spent on this?


Then you need to feed all of this into the filter design process, which is a non-trivial problem.