Original Post
Hi,
I need to resample a signal sampled at an arbitrary sampling rate to another signal with an arbitrary sampling rate. I know how this is done, but for some reason the outcome is not exactly what I expected. There are two ways to do the resampling - through the frequency domain which is not an option because I need to resample data (potentailly so much that it will slow down other processes or swamp the cpu) in real-time, and by decimation/duplication (sychronized resampling). I''m using the latter so that for:
output signal OS @ x Hz and
inpit signal IS @ y Hz
OS[n] = IS[(int)(x / y) * n];
where x/y is the relative offset factor.
The above solution is the easiest one around - the only problem being some the samples being duplicated if the output signal is at a lower sampling rate and some of the samples being decimated if the other way around. The result is a hissy sound. Just to leave space for error, is the above code correct or is there some better algorithm around (suitable for real-time use!)?
Thanks in advance,
Crispy