1
$\begingroup$

to start I am a newbie in signal processing, I just started a month ago so please be as detailed as possible.

From what I understood to resample a signal by a non integer factor you can do an upsample followed by a downsample. So, imagining a sample set of size 10 and if you want to upsample it to 15, you can upsample it by 3 and downsample it by 2, correct?

If that is true, does one can create a kernel by merging the two kernels the upsampling and downsampling ones?

To upsample by 3 we can use the kernel [1/3, 2/3, 1, 2/3, 1/3] and to downsample by 2 we can use the kernel [1, 0]. Can I create just a kernel to do both operations?

If instead I use interpolation, can I do it using a kernel as the above?

$\endgroup$
3
  • $\begingroup$ You can by multiplying "convolving" the two sequences to create the combined one. Be aware of tail effects due to length of "filters" and possible aliasing. $\endgroup$
    – Moti
    May 5, 2018 at 1:09
  • $\begingroup$ @Moti How can I multiply the convolution then? Can you point me in the right direction please? $\endgroup$ May 5, 2018 at 13:52
  • $\begingroup$ Implement to sequential processes, starting with the upsampling. You may also "calculate" each sample to its location (given the value) but the coefficients will be different from sample to sample. $\endgroup$
    – Moti
    May 7, 2018 at 0:42

3 Answers 3

1
$\begingroup$

So, imagining a sample set of size 10 and if you want to upsample it to 15, you can upsample it by 3 and downsample it by 2, correct?

Sort of. You need to upsample, low-pass filter in the up-sampled domain and then down sample.

If that is true, does one can create a kernel by merging the two kernels the upsampling and downsampling ones?

That's an odd question. Up-sampling and down-sampling don't have a "kernel" per se. Up-sampling is done by inserting zeros between the existing samples and down-sampling is done by simply throwing away the samples you don't want.

What you CAN do is to execute the lowpass filter in the down-sampled domain, at least if it's an FIR. That typically leads to a poly-phase filter implementation.

To upsample by 3 we can use the kernel [1/3, 2/3, 1, 2/3, 1/3] and to downsample by 2 we can use the kernel [1, 0]. Can I create just a kernel to do both operations?

Upsampling and downsampling are NOT done by convolving with a kernel. It's done by inserting zeros or throwing away samples.

If instead I use interpolation, can I do it using a kernel as the above?

Interpolation and low-pass filtering in the up-sampled domain are basically the same thing. The poly-phase implementation can be interpreted as "time variant interpolation".

$\endgroup$
0
$\begingroup$

You might be describing something similar to a canonical polyphase resampling filter. If you can compute your filter+interpolation kernel on the fly (certain windowed Sinc’s and others) you can even do this for irrational sample rate ratios or factors.

$\endgroup$
6
  • $\begingroup$ how would you increment the sample pointer, which has an integer and fractional portion (the former points to the samples to be combined to be the interpolated output sample and the latter points to the set of coefficients that define how those samples will be combined) and a step size or increment to that continuous-valued sample pointer, how is that step size to be represented as an irrational number? even if the step size is successfully represented as an irrational number, how does it effectively increment that sample pointer by a increment (or step size) that is an rational value? $\endgroup$ May 5, 2018 at 6:41
  • $\begingroup$ On computers, one normally just quantizes (the step or fraction) to something that fits in memory, same as one does when computing using Pi or e or sin(x) during DSP math. $\endgroup$
    – hotpaw2
    May 5, 2018 at 15:42
  • $\begingroup$ so then, hot, i don't think that it's accurate to say, "... you can even do this for irrational sample rate ratios or factors." at least i cannot see how one can do that. $\endgroup$ May 5, 2018 at 23:03
  • $\begingroup$ The idea is that you create two "filters" - one for up sampling and than apply the down sampling filter. I am not sure if you can implement accurately irrational but you could come as close as desired. $\endgroup$
    – Moti
    May 6, 2018 at 16:49
  • $\begingroup$ No need for upsampling plus downsampljng. Instead you can interpolated each output sample directly, and create each phase as needed instead of caching/precomputing. $\endgroup$
    – hotpaw2
    May 6, 2018 at 19:15
0
$\begingroup$

You can think of convolution as a matrix multiplication:

y = h * x

y = H • x

Where H is a rectangular matrix consisting of the convolution kernel repeated along its diagonal. This would usually not be an efficient way to do convolution, but it can be instructive.

In the same vein, (linear) resampling could be expressed as:

z = M • x

Where M is a non-rectangular matrix of variable kernels along its diagonal. It is evident that each sample of z can be any linear combination of all samples of x.

$\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.