[PD] tabread4~ "broken" interpolation algorithm - was Re:, Max Smoother Audio than Pd?
Matteo Sisti Sette
matteosistisette at gmail.com
Sat Apr 3 11:40:07 CEST 2010
Charles Henry escribió:
> The hardest class I ever had was stochastic analysis (as recent as 4
> years ago), where we solved problems like this. Fundamentally, it's
> not too hard, but the details of the calculus are tricky. I'd prefer
> to stay away unless there's a real good reason to do so :)
>
Well if you want to stay away from stochastic processes and consider the
signal as a deterministic function, then you'll have to make assumptions
that make sense for functions.
And a flat spectrum isn't. As you said at the very beginning (almost),
assuming it has a flat spectrum implies it is a dirac delta.
Finding the interpolator that best interpolates a dirac delta is finding
the interpolator that best matches the ideal interpolator (the sync),
hence your result.
Ok, we cannot find an interpolator that is optimum for all classes of
functions, so we have to choose some class of functions.
Even provided your reasoning about phase was right (so allowing to
extend the result not only to the delta function but to all function
with a flat spectrum with whatever phase), I don't think the resulting
class of function is much more general and much more interesting.
I think people often use a sinusoid to measure the quality of an
interpolator (e.g. in Miller's book you find tables with the
signal-to-noise ratio of the interpolator measured on a sinusoid, if i
remember correctly).
Maybe you could solve the problem of finding the best interpolator for a
sinusoid.
That would make a lot more sense than the best interpolator for a dirac
delta. (note that I don't know if the result turns out to be the same)
If you try to solve the problem for a whole "class" of functions of some
interest, I'm afraid you'll find out it is much (much much much) more
complicated than dealing with stochastic processes.
Note that I'm not saying that
>> E=|f(x)-sinc(x)|^2 is minimized when
>>
>> f(x)={sinc(x) -2<x<2 , 0 elsewhere
is a bad choice.
I'm just arguing that your reasoning doesn't prove it is the best choice.
Indeed I think some software use
>> E=|f(x)-sinc(x)|^2 is minimized when
>>
>> f(x)={sinc(x) -N<x<N , 0 elsewhere
for some value of N. For infinite N, this would be the perfect
interpolator, so obviously for large N it is good enough.
The problem is that for N as little as 2, the truncation has
non-negligible effects on the stop band, so the problem arises, whether
another signal can reduce the effects of the truncation on the stop
band, at the cost of some added ripple within the passband.
Now that I think about it, your truncated sync should have perfect-flat
passband response, and big stopband "ripples" (how do you call the
stopband ripples? cannot remember the word), so any improvement at
stopband will have to be traded off with some increased passband ripple.
So here's what the truncated sync is best at: it's the one with the best
(meaning flattest) bandpass response. Is this correct???
Note however that the highest part of the high frequency noise (due to
the non-zero stopband part of the interpolator) will cause aliasing when
resampling. The analysis of passband ripple and stopband "ripple" and
whatever measure of their trade off doesn't take this into account: it
just considers the passband ripple as passband distortion, and the
stopband "ripple" as high-frequency noise. But after resampling part of
that high frequency noise will be brought back to low frequency in form
of aliasing. Note that the new Nyquist frequency depends on the
resampling frequency and is not the same as the original Nyquist
frequency, so how relevant aliasing is depends on the resampling rate.
If yoy resample at 1:1 then _all_ high freq noise will become aliasing.
Aliasing is often considered somewhat worse than anything else (correct
me if I am wrong), I guess because it is specially audible, being
perceived as something completely unconnected to the original signal.
This last digression is nothing specific to the truncated sync, it is
just to say that while trading off between passband distortion and
stopband noise, we have to consider that stopband noise may alias back
to low frequency and hence it is especially important to avoid it.
Hence an interpolator with strong stopband ripple is likely to need to
be used in conjunction with oversampling and filtering before
resampling. By the way when we resample at an unpredictable and varying
rate (such as using a tabreadWhatever~ with an input signal that is not
a ramp), oversampling and filtering is not feasible (or is it???)
--
Matteo Sisti Sette
matteosistisette at gmail.com
http://www.matteosistisette.com
More information about the Pd-list
mailing list