1
$\begingroup$

Currently, we need to handle a piece of an audio signal. We want to resample it with different factor rate (p/q) starting with 1.0002 to 0.9998 with a decrement of 0.000005. But Matlab function cannot handle this because of the Integer Limit. Are there any ways to solve it?

$\endgroup$
  • 1
    $\begingroup$ big deal. MATLAB y = resample(x,p,q); works fine. so for whatever ratio $r=\tfrac{p}{q}$ that you want set $$p=\left\lfloor \tfrac{r}{0.000005} \right\rfloor =\left\lfloor 200000 \cdot r \right\rfloor $$ and $$q=\left\lfloor \tfrac{1}{0.000005} \right\rfloor = 200000 $$ and you have your integers for p and q. $\endgroup$ – robert bristow-johnson Jul 9 '18 at 8:40
  • $\begingroup$ The general field of study you're looking for is "sample rate conversion". "Secret Rabbit Code" used to be a nice open-source implementation, but it's been so long since I've had to reference it that I have no clue if it's still a thing. $\endgroup$ – TimWescott Jan 3 at 0:07
0
$\begingroup$

if your resampling can be done batch, interp1 using ‘spline’ as the type works well.

A good article that argues in favor of splines over sinc interpolation is

Unser, Michael. "Splines: A perfect fit for signal and image processing." IEEE Signal processing magazine 16.6 (1999): 22-38.

| improve this answer | |
$\endgroup$
0
$\begingroup$

Please see my answer to this question : Various size arrays interpolation - resampling

The best method really depends on your application and your requirements. Matlab's resample() is perfectly fine, if you don't care about efficiency, have enough memory, no real time requirement, and reasonably short signals. If's unsuitable for real time sample rate adaption of two different master clocks.

Both sinc kenrnel and splines are different ways to create an interpolation filter, but it's not easy to adapt them to numerical requirements. If you have a requirement like "aliasing, THD and intermod need to be lower than -80dB below 20 kHz" it's better to directly design a low pass filter in a suitably upsampled domain. You an certainly do this by using a sinc kernel but you'll need a lot more filter taps than using a custom low pass filter

| improve this answer | |
$\endgroup$
0
$\begingroup$

You can resample to any, including floating point approximations of irrational rates, using reconstruction by Sinc kernel interpolation (realistically, by using a windowed Sinc interpolator).

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.