Plugin with internal samplerate, is it a good solution?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

It was just a suggestion, but if your algorithm is that sensitive to sample rate change then it doesn't apply.

One thing to keep in mind with fractional vs integer resampling is that with integer rates you can easily predict the quality of the resampling by looking at the resampling filter frequency response. In the case of a fractional resampling you also need to look at the interpolation noise which will vary depending on the ratio.

Post

matt42 wrote: Thu Mar 11, 2021 10:26 am It was just a suggestion, but if your algorithm is that sensitive to sample rate change then it doesn't apply.

One thing to keep in mind with fractional vs integer resampling is that with integer rates you can easily predict the quality of the resampling by looking at the resampling filter frequency response. In the case of a fractional resampling you also need to look at the interpolation noise which will vary depending on the ratio.
Are you talking about aliasing?

It's still possible to predict from the frequency response, but depends on the played material.

Here are some plots to give an idea:
Image

https://vru.vibrationresearch.com/lesso ... cy-domain/

Post

Oden wrote: Thu Mar 11, 2021 12:31 pm Are you talking about aliasing?

It's still possible to predict from the frequency response, but depends on the played material.
The issue is that for a low-order interpolator (and really even high-order interpolators if this is not considered during the design), the frequency response can vary a lot depending on the fractional offset. For example, the linear-interpolation (=triangular kernel) has unity response when the interpolator is exactly centered at a single sample (ie. the effective kernel is just an impulse), where as it has a zero at Nyquist when you're sampling exactly half-way between two samples (ie. the effective kernel is [.5,.5]).

With fractional rates, the exact response used to interpolate different samples then varies on per-sample basis which results in "noise" (well, sort of.. if the resampling rate is fixed then this "noise" is regular and the interpolator just performs worse than expected). In order to reduce this noise, you basically want an interpolator kernel where the respones (both amplitude and phase) is more or less constant from one fractional offset to another. This is essentially why you typically get better interpolators by designing a single long filter and then doing poly-phase decomposition, rather than optimizing each branch of the poly-phase filter independently, even though the latter approach might give you seemingly better filters for each individual branch.

Post

mystran wrote: Thu Mar 11, 2021 1:00 pm
Oden wrote: Thu Mar 11, 2021 12:31 pm Are you talking about aliasing?

It's still possible to predict from the frequency response, but depends on the played material.
The issue is that for a low-order interpolator (and really even high-order interpolators if this is not considered during the design), the frequency response can vary a lot depending on the fractional offset. For example, the linear-interpolation (=triangular kernel) has unity response when the interpolator is exactly centered at a single sample (ie. the effective kernel is just an impulse), where as it has a zero at Nyquist when you're sampling exactly half-way between two samples (ie. the effective kernel is [.5,.5]).

With fractional rates, the exact response used to interpolate different samples then varies on per-sample basis which results in "noise" (well, sort of.. if the resampling rate is fixed then this "noise" is regular and the interpolator just performs worse than expected). In order to reduce this noise, you basically want an interpolator kernel where the respones (both amplitude and phase) is more or less constant from one fractional offset to another. This is essentially why you typically get better interpolators by designing a single long filter and then doing poly-phase decomposition, rather than optimizing each branch of the poly-phase filter independently, even though the latter approach might give you seemingly better filters for each individual branch.
That is the aliasing introduced by the sampling of the kernel.

So for example, an "analog" (as SR->infinity) linear interpolator produces the frequency spectrum of the original digital signal multiplied by the plot for the linear interpolator given above. Recall that in the original sampled signal the frequency spectrum is mirrored from Nyquist and repeats after sampling frequency, so what lies above Nyquist are not zeros (unless it's a constant signal).

So now we sample at the new SR and get aliasing introduced by the folding of the frequencies above the new Nyquist.

Post

Oden wrote: Thu Mar 11, 2021 1:26 pm So now we sample at the new SR and get aliasing introduced by the folding of the frequencies above the new Nyquist.
Right, but there's two types of aliasing: the aliasing of the kernel itself (which introduces noise) and the aliasing of the signal (due to the kernel not attenuating sufficiently) which .. introduces aliasing.

What I'm trying to get at here is that you can get the first type even if the second type is not a concern.

Post

mystran wrote: Thu Mar 11, 2021 1:58 pm
Oden wrote: Thu Mar 11, 2021 1:26 pm So now we sample at the new SR and get aliasing introduced by the folding of the frequencies above the new Nyquist.
Right, but there's two types of aliasing: the aliasing of the kernel itself (which introduces noise) and the aliasing of the signal (due to the kernel not attenuating sufficiently) which .. introduces aliasing.

What I'm trying to get at here is that you can get the first type even if the second type is not a concern.
Good point, the kernel is sampled and therefore aliased too, thus affecting the frequency response. Seems that the usual aliasing reduction techniques could be employed here.

For linear interpolation, below is the sampled response when oversampled 10x compared to the "analog" response.

Image
https://ccrma.stanford.edu/~jos/pasp/Li ... ponse.html

However, the aliasing of the kernel does not generate noise. Rather, the fold back will be worse since the aliased kernel does not attenuate as well.

Post

Editing

Post

matt42 wrote: Thu Mar 11, 2021 3:07 pmEditing
Yes, it's a bit harder to work out in the fractional basis, because there is no kernel corresponding to the interpolation in the updated rate. But there is one that is equivalent at a higher rate. Then I get that the interpolation is equivalent to upsampling to the higher rate and sampling back down.

An example:

Say we want to interpoloate points 0, 2/3, 4/3, 2 (e.g. 1.5 rate) using linear interpolation from three samples S1, S2, S3. The resulting output is S1, 1/3S1+2/3S2, 2/3S2+1/3S3, S3. A problem, in our new SR the sample S2 does not exist, thus the linear interpolation can't be done by convolution and we can't use the usual theorem.

However, if we look at double that rate, now we have 0, 1/3, 2/3, 1, 4/3, 5/3, 2 at our disposal. In this rate there is a convolution kernel that satisfies the output, namely C=(1/3, 2/3, 1, 2/3, 1/3). Now all that is left is to resample by multiplying with (1,0,1,0,1,0,1), which brings in the aliasing as the frequencies above Nyquist fold as usual. The noise is the same aliasing but with slightly different parameters.

That said I haven't actually tried how noisy fractional rates are in practice. However, linear interpolation has been widely used even in modulation effects and no one seems to be complaining.
Last edited by Oden on Thu Mar 11, 2021 5:01 pm, edited 1 time in total.

Post

Well for modulation effects the dry signal is generally clean, extra noise in the modulated signal can add to the character from some perspectives. I'm not trying to say there is no use for short kernels and fractional resampling.

If I want to over sample my plugin to gain quality then fractional rate up sampling with a triangular kernel is kind of defeating the purpose IMHO

Post

matt42 wrote: Thu Mar 11, 2021 4:36 pm Well for modulation effects the dry signal is generally clean, extra noise in the modulated signal can add to the character from some perspectives. I'm not trying to say there is no use for short kernels and fractional resampling.

If I want to over sample my plugin to gain quality then fractional rate up sampling with a triangular kernel is kind of defeating the purpose IMHO
Yes, I am not endorsing linear interpolation, although the cheap cost is a benefit. Soon it may even sound "vintage".

Fabfilter plugins have an interesting oversampling. Instead of using sinc, they use some causal low pass filter that is quite brick wallish IIRC. For fractional rates interpolate the kernel at plugin start up, seems like it could work well.

Post

Oden wrote: Thu Mar 11, 2021 5:16 pm Fabfilter plugins have an interesting oversampling. Instead of using sinc, they use some causal low pass filter that is quite brick wallish IIRC. For fractional rates interpolate the kernel at plugin start up, seems like it could work well.
For integer-rate oversampling you can use pretty many any FIR or IIR low-pass that's steep enough for your purposes. In fact elliptic half-band filters at least used to be quite popular for the 2x case as they can in some cases actually compete with FIR filters in terms of efficiency. I'm quite fond of Chebychev type-2 designs for some applications, because those have no passband ripple which can help control IMD from non-linearities, but these are certainly more expensive than a FIR.

That said, for arbitrary fractional rates if you're using something other than a low-order polynomial (eg. linear, cubic) or a polyphase FIR (eg. windowed sinc) then IMHO you're pretty much just wasting your time.

Post

mystran wrote: Thu Mar 11, 2021 1:00 pm
are you xoxos? need to double check, it's been a while

See my thread: viewtopic.php?p=8473476#p8473476

Post

Architeuthis wrote: Fri Jul 15, 2022 2:52 am
mystran wrote: Thu Mar 11, 2021 1:00 pm
are you xoxos? need to double check, it's been a while

See my thread: viewtopic.php?p=8473476#p8473476
No, I'm not xoxos.

Post Reply

Return to “DSP and Plugin Development”