Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-04-03 Thread Matteo Sisti Sette

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) -2x2  ,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) -NxN  ,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
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-04-02 Thread Charles Henry
 You're trying to restrict the analysis to a convenient (but reasonable)
 class of signals, and to assume that the signal to be interpolated, x,
 belongs to that class. Right?

Well, sort of.  What works well as an interpolator for one signal may
not work well for another.  The point I started from was asking the
question, what would make a good measure of the error when we use a
given interpolator?

So, if I just wanted to average across all frequencies the squared
error, I thought the problem would be equivaled to this one:

 E=|f(x)-sinc(x)|^2 is minimized when

 f(x)={sinc(x) -2x2  ,0 elsewhere

And then it's the same as having an operator acting on a flat spectrum signal.

 It doesn't make any sense, as far as I can see, to assume that the signal
 being interpolated belongs to the class of function whose spectrum has a
 flat modulus (and any phase).
 Why not assuming then, for example, that x(t) is a constant?
 (please don't take my tone as sarchastic)

 What does make some sense (it is a strong hypothesis but discussing its
 plausibility would bring the discussion to a much higher level) is to treat
 the signal x as a stochastic process with a given power spectrum - such as
 flat, or pink.

So, I assumed the signal spectrum flat so that I could average over
all the frequencies.  True it doesn't fit the actual use cases and
give us the error in a signal we'd actually like to see--it's just
sort of a toy problem, but it goes back to the reason why we're
looking at it in the first place, to consider what happens when we
just choose one measure (L2 normed error in signal reconstruction
averaged across all frequencies) and then find the best result.

This class of functions to consider is useful if we're going for
rigourous math here... but maybe we've strayed too far outside the
topic and should just stick to calculus?

Suppose we choose our metric and work it out.  If the correct result
doesn't behave well or doesn't fit our criteria, then how should we
create a better measure?

 But that means that the quantity you're minimizing is no longer an integral
 of the signal minus some other signal all squared: it is the expectation of
 something.

 The power spectrum of a stochastic process x(t) is not the fourier transform
 of x(t), it is the fourier transform of tha autocorrelation function of x
 (or something like that).

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 :)

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-04-01 Thread Charles Henry
On Wed, Mar 31, 2010 at 5:12 PM, Matteo Sisti Sette
matteosistise...@gmail.com wrote:
 It occurs to me that there exists one very obvious function for which
 the squared error is minimized for a 4-point interpolator.  4-point
 interpolator impulse functions have to be 0 outside the interval
 [-2,2].

 So,
 E=|f(x)-sinc(x)|^2 is minimized when

 f(x)={sinc(x) -2x2  ,    0 elsewhere

 I may be missing something but I'm afraid the E in your formula is not the
 error that is supposed to be minimized.

Sorry, I often go kind of fast-and-loose with the math, but I think
you'll see it's true within a certain context, which you may or may
not accept.

 The ideally interpolated signal (which is the one in reference to which the
 error has to be minimized) is not just a sinc: it is the sum of an infinite
 series of sinc's centered at the sampled points and scaled with the sampled
 values.

Let x be the series of samples, each multiplied by Dirac-delta
functions at the sample times.  Let S be the convolution operator
which convolves a function by sinc(t) and let F be our arbitrary
convolution operator which convolves by an interpolation function
f(t).

Then, the quantities we need to compare are Sx and Fx where we want to
minimize the L2 norm, the integral of the squared error (Sx - Fx)^2

|Sx-Fx|^2 = |(S-F)x|^2

The error depends on x the signal.  Here, I want to make the
*convenient* assumption that the spectrum of x is flat, since we want
some kind of generality and we want to minimize average error across
frequencies.  This would make the problem equivalent to using just
*one* dirac-delta in place of x and we would get the problem to reduce
back to just the difference of the impulse responses

|sinc(t)-f(t)|^2

For a little while, I was going in circles on how to minimize operator
norms, but it's not quite the right problem for that and I'd probably
spend all day on it, that way :)

 (I won't try to write it in a latex-like fashon, I would certainly get it
 wrong - not because of latex syntax, I mean I would get it wrong even if I
 tried to write it down manually)

I'm reluctant to try latex because it looks like too much work, but I
think lyx (a wysiwyg latex editor) is more my speed.

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-04-01 Thread Matteo Sisti Sette

Charles Henry escribió:


The error depends on x the signal.  Here, I want to make the
*convenient* assumption that the spectrum of x is flat, since we want
some kind of generality and we want to minimize average error across
frequencies.  This would make the problem equivalent to using just
*one* dirac-delta in place of x and we would get the problem to reduce
back to just the difference of the impulse responses

|sinc(t)-f(t)|^2


Ah ok.

This *convenient* assumption is equivalent to (or at least implies) 
assuming that the only sample that matters for interpolating the signal 
between -2 and 2 is the one semple at 0.

This seems to me a too much strong assumption.

I'm not saying that your conclusion is wrong (though I suspect it is).

Let's take a step back:

 Here, I want to make the
 *convenient* assumption that the spectrum of x is flat

Stated this way, it sounds reasonable, doesn't it. If it does, then it 
means that by flat spectrum you mean the _power spectrum_ of x 
considered as a _stochastic process_ rather than a deterministic signal.


Brought to the domain of time, assuming x has a flat power spectrum 
means assuming x is white noise. (btw a closer-to-reality assumption 
would be that it is pink noise - but that's not the point here) Not a 
dirac delta.


So minimizing the error would be to minimize the power, or probably 
energy, of the error meant as a stochastic process.


Though I should have the notions to go a bit further in at least 
_formulating_ (not solving) the problem, those notions are a bit 
oxidated, if not completely gone from my head :(


But I'm sure it is not equivalent to minimizing the integral of the 
difference between the operators applied to a delta function.





--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-04-01 Thread Charles Henry
I get what you're saying too, and I'm at least a little skeptical
myself.  But as I think about it generally, my entire approach to
looking at these problems has been very similar.

I basically thought that when comparing interpolators, I could
disregard the signals involved and just look at the properties of the
impulse responses (or convolution kernels or spectra, etc...).  So, if
I can't do that, I really have to rethink what I know.

On Thu, Apr 1, 2010 at 10:44 AM, Matteo Sisti Sette
matteosistise...@gmail.com wrote:

 Here, I want to make the
 *convenient* assumption that the spectrum of x is flat

 Stated this way, it sounds reasonable, doesn't it. If it does, then it means
 that by flat spectrum you mean the _power spectrum_ of x considered as a
 _stochastic process_ rather than a deterministic signal.

When it comes to the general class of functions with flat spectra, the
only difference is in phase, right?
But the error is the same in time domain as in frequency domain thanks
to the isometric property of the Fourier transform.  Our interpolation
is the same as a convolution, so we're still just multiplying our
spectra and the phase comes out differently in each frequency.

So, when we integrate the error^2 in the frequency domain, the phase
makes no contribution, and then, it's really just the same thing as
the error in the time domain.  Then, all flat spectra are equivalent
for this problem.  I really am enjoying this math discussion, and I do
want to be corrected or shown something I don't see yet.  Please let
me know if there's something wrong with what I'm saying.


 Brought to the domain of time, assuming x has a flat power spectrum means
 assuming x is white noise. (btw a closer-to-reality assumption would be that
 it is pink noise - but that's not the point here) Not a dirac delta.

 So minimizing the error would be to minimize the power, or probably energy,
 of the error meant as a stochastic process.

 Though I should have the notions to go a bit further in at least
 _formulating_ (not solving) the problem, those notions are a bit oxidated,
 if not completely gone from my head :(

 But I'm sure it is not equivalent to minimizing the integral of the
 difference between the operators applied to a delta function.




 --
 Matteo Sisti Sette
 matteosistise...@gmail.com
 http://www.matteosistisette.com


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-04-01 Thread Matteo Sisti Sette

Charles Henry escribió:


When it comes to the general class of functions with flat spectra, the
only difference is in phase, right?
But the error is the same in time domain as in frequency domain thanks
to the isometric property of the Fourier transform.  Our interpolation
is the same as a convolution, so we're still just multiplying our
spectra and the phase comes out differently in each frequency.


I'm not sure I understand what you're saying here about the phase, buy I 
think the misleading part of youre reasoning is that you take a concept 
that makes sense in the context of stochastic processes, namely assuming 
a flat spectrum, and acritically apply it in the context of 
deterministic signals where it has a completely different meaning.


You're trying to restrict the analysis to a convenient (but reasonable) 
class of signals, and to assume that the signal to be interpolated, x, 
belongs to that class. Right?


It doesn't make any sense, as far as I can see, to assume that the 
signal being interpolated belongs to the class of function whose 
spectrum has a flat modulus (and any phase).

Why not assuming then, for example, that x(t) is a constant?
(please don't take my tone as sarchastic)

What does make some sense (it is a strong hypothesis but discussing its 
plausibility would bring the discussion to a much higher level) is to 
treat the signal x as a stochastic process with a given power spectrum - 
such as flat, or pink.


But that means that the quantity you're minimizing is no longer an 
integral of the signal minus some other signal all squared: it is the 
expectation of something.


The power spectrum of a stochastic process x(t) is not the fourier 
transform of x(t), it is the fourier transform of tha autocorrelation 
function of x (or something like that).


--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-31 Thread Charles Henry
 I don't know either.  We have the formulas for each, so we can
 calculate squared error vs. sinc(x), but there also appears to be
 differences in which frequencies the distortion occurs and some could
 be more audible.

It occurs to me that there exists one very obvious function for which
the squared error is minimized for a 4-point interpolator.  4-point
interpolator impulse functions have to be 0 outside the interval
[-2,2].

So,
E=|f(x)-sinc(x)|^2 is minimized when

f(x)={sinc(x) -2x2  ,0 elsewhere

Note that since the Fourier transform is isometric and linear, we know
that a function which minimizes the error in the time domain also
minimizes error in the frequency domain.  This spectrum ought to have
a lot of ringing in the upper frequency range, and in the stopband.

So, if we only considered the squared error in the reconstruction and
not the smoothness of the result, this would be the clear choice.  How
would we factor in the smoothness as well?

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-31 Thread Matteo Sisti Sette

 It occurs to me that there exists one very obvious function for which
 the squared error is minimized for a 4-point interpolator.  4-point
 interpolator impulse functions have to be 0 outside the interval
 [-2,2].

 So,
 E=|f(x)-sinc(x)|^2 is minimized when

 f(x)={sinc(x) -2x2  ,0 elsewhere

I may be missing something but I'm afraid the E in your formula is not 
the error that is supposed to be minimized.


The ideally interpolated signal (which is the one in reference to which 
the error has to be minimized) is not just a sinc: it is the sum of an 
infinite series of sinc's centered at the sampled points and scaled with 
the sampled values.


(I won't try to write it in a latex-like fashon, I would certainly get 
it wrong - not because of latex syntax, I mean I would get it wrong even 
if I tried to write it down manually)


Please correct me if I am wrong


--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-31 Thread Mathieu Bouchard


A workaround is to up-sample everybody by a factor of 2 - this 
dramatically reduces error, usually by 24 dB.


Every upsampling is some kind of interpolation. So what you mean, is to 
reduce the error of your interpolator by getting much of the job done by a 
different interpolator instead ?


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-30 Thread Roman Haefeli
On Mon, 2010-03-29 at 21:06 -0400, Matt Barber wrote:
 LONG, sorry.

Thanks again for your time and patience.

 One really good way to think, then, is in terms of the continuous
 frequency response of the interpolator.  In that long, long discussion
 a couple years ago, Chuck Henry made the following post where he
 showed the impulse response of [tabread4~] vs. the [tabread4c~]
 
 http://lists.puredata.info/pipermail/pd-list/2008-06/063408.html
 
 (look at the graph)

Assuming, that the goal is to avoid anything above Nyquist, it seems
that [tabread4c~] does its job better (blue graph). The area below the
graph line and right of the nyquist vertical line seems smaller for the
blue graph than for the red graph. Or am I tricked by the logarithmic
view of those graphs?

 I haven't studied them in school either which is why I worry about the
 above explanation.  I think [tabread4~] is good for what it is for a
 couple of reasons, neither of them particularly compelling:
 
 1)  It's better than linear interpolation, and has wide use in other
 computer-music applications like csound -- people are very used to how
 it behaves.

This would apply to both, [tabread4~] and [tabread4c~], wouldn't it?

 2)  It's similar to the alternative being discussed, but with a
 different sound; not necessarily worse for all sounds.

It seems intuitively logical to me that discontinuities in the first
derivative (which are basically edges in the curve) create high-frequent
noises. When listening to both (back then), I had the feeling that there
are more noises audible with [tabread~] than with [tabread4c~]. So to me
it still remains unclear in what aspect [tabread4~] is superior to
[tabread4c~], from both a theoretical and from an empirical
perspective.  

Roman





___ 
Der fr�he Vogel f�ngt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: 
http://mail.yahoo.de

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Matteo Sisti Sette
Is it really possible to express a cubic interpolator (such as Lagrange 
or Hermite, i.e. such as tabread4 or tabread4c) in terms of impulse 
response? Is it equivalent to a convolution? That is to ask: is it linear???

Or is that an approximation?

--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Matteo Sisti Sette

 So to me
 it still remains unclear in what aspect [tabread4~] is superior
 to [tabread4c~], from both a theoretical and from an empirical
 perspective.

The answer may be here:

http://www.aes.org/e-lib/browse.cfm?elib=8151

Btw does anybody have access to that article?

The analysis reveals an interesting performance trade-off between 
signal-to-noise ratio and passband flatness.


So since it seems quite obvious that discontinuities (tabread4) generate 
more high-frequency noise (and assuming that is the most relevant source 
of noise), the only aspect where tabread4 can be superior may be 
passband flatness. Indeed, intuitively it seems plausible: passband 
flatness means that the low-frequency part of the signal is more close 
to the original (the ideal perfectly interpolated signal); and I do 
expect that an interpolator that doesn't try to match first derivatives 
is less likely to do crazy oscillations.


It would be interesting to see a zoom-in of the low frequency part of 
Charles Henry's graph (the ripples in the flat zone).


However, even in presence of a tradeoff that makes some sense (i.e. each 
of the two choices has advantages and disadvantages), it seems to me 
that for audio applications the generated high-frequency noise due to 
discontinuities should be _hugely_ worse than the passband-non-flatness.


I'd really like to see and hear an example of a case where this isn't 
true, that is, where tabread4 gives better results than tabread4c.


This other article seems to contain an answer:

http://www.akademiai.com/content/r0192mk0908k31k3/
http://www.akademiai.com/content/r0192mk0908k31k3/fulltext.pdf?page=1

The aim of this paper is to give a positive answer for a
problem [...]:
Do there exist a system of nodes and function class for which the 
Lagrange process is better than the Hermite-Fej6r one?


If anybody has access and can share it that would be great.

Now regarding Matt's words:

 I have read that the Lagrange interpolators have better stopband
 attenuation and Hermites have flatter passband response, but I'm not
 sure this is true

Is it possible that it is exactly viceversa?

By the way thanks again Matt (and everybody else who contributed to this 
thread) for the didactic effort and the links.


--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Matt Barber
 Now regarding Matt's words:

 I have read that the Lagrange interpolators have better stopband
 attenuation and Hermites have flatter passband response, but I'm not
 sure this is true

 Is it possible that it is exactly viceversa?


I think it probably is exactly vice-versa -- I was quoting people in
other forums who said so, so, you know -- who knows if it's true.

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Matt Barber
Yes, as far as I know it's identical -- when you do one of these
interpolations with four points, you can either think of it in terms
of a cubic polynomial formula involving those four points, or in terms
of the sum of four scaled basis functions - the latter seems to me
intuitively equivalent to direct convolution of an impulse response
centered on the four points, and scaled to each.  It will be limited
by the quantization of the index, so in that sense it might not be
linear..

MB

On Tue, Mar 30, 2010 at 6:45 AM, Matteo Sisti Sette
matteosistise...@gmail.com wrote:
 Is it really possible to express a cubic interpolator (such as Lagrange or
 Hermite, i.e. such as tabread4 or tabread4c) in terms of impulse response?
 Is it equivalent to a convolution? That is to ask: is it linear???
 Or is that an approximation?

 --
 Matteo Sisti Sette
 matteosistise...@gmail.com
 http://www.matteosistisette.com


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Roman Haefeli
On Tue, 2010-03-30 at 14:15 +0200, Matteo Sisti Sette wrote:

 However, even in presence of a tradeoff that makes some sense (i.e. each 
 of the two choices has advantages and disadvantages), it seems to me 
 that for audio applications the generated high-frequency noise due to 
 discontinuities should be _hugely_ worse than the passband-non-flatness.

Judging from the graph, it seems that the differences in the
passband-non-flatness are  much smaller than the differences in the stop
band. But then again, maybe I am tricked by the logarithmic view. 

 By the way thanks again Matt (and everybody else who contributed to this 
 thread) for the didactic effort and the links.

Yeah, very enlightning. Thanks

Roman



___ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Matteo Sisti Sette

Roman Haefeli escribió:

On Tue, 2010-03-30 at 14:15 +0200, Matteo Sisti Sette wrote:

However, even in presence of a tradeoff that makes some sense (i.e. each 
of the two choices has advantages and disadvantages), it seems to me 
that for audio applications the generated high-frequency noise due to 
discontinuities should be _hugely_ worse than the passband-non-flatness.


Judging from the graph, it seems that the differences in the
passband-non-flatness are  much smaller than the differences in the stop
band. But then again, maybe I am tricked by the logarithmic view. 


Hmm, I don't think they can be compared at the same scale - though I 
don't know with what scaling factor thay can be compared - or if it 
makes sense at all to compare them quantitatively.


However, when one has to evaluate the ripple of the flat part, one 
usually zooms in quite a bit...



--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread cyrille henry

i think this pdf can add lot's of useful information to this thread :
http://www.student.oulu.fi/~oniemita/dsp/deip.pdf

cyrille


Matteo Sisti Sette a écrit :

Roman Haefeli escribió:

On Tue, 2010-03-30 at 14:15 +0200, Matteo Sisti Sette wrote:

However, even in presence of a tradeoff that makes some sense (i.e. 
each of the two choices has advantages and disadvantages), it seems 
to me that for audio applications the generated high-frequency noise 
due to discontinuities should be _hugely_ worse than the 
passband-non-flatness.


Judging from the graph, it seems that the differences in the
passband-non-flatness are  much smaller than the differences in the stop
band. But then again, maybe I am tricked by the logarithmic view. 


Hmm, I don't think they can be compared at the same scale - though I 
don't know with what scaling factor thay can be compared - or if it 
makes sense at all to compare them quantitatively.


However, when one has to evaluate the ripple of the flat part, one 
usually zooms in quite a bit...





___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Matteo Sisti Sette

Matt Barber escribió:

Yes, as far as I know it's identical -- when you do one of these
interpolations with four points, you can either think of it in terms
of a cubic polynomial formula involving those four points, or in terms
of the sum of four scaled basis functions - the latter seems to me
intuitively equivalent to direct convolution of an impulse response
centered on the four points, and scaled to each.  It will be limited
by the quantization of the index, so in that sense it might not be
linear..


Hmm, by linear I mean that the interpolated version of the sum of any 
two discrete signals is equal to the sum of the interpotated versions of 
each one. It shouldn't be difficult to tell whether this is true or not 
by looking at the formulas but I'm too lazy right now :P


If the transformation is not linear, then there is no impulse response 
at all nor any frequency response strictly speaking, thought that 
doesn't mean that it doesn't make sense to do some reasoning in terms of 
impulse or frequency response under certain simplifications or 
assumptions - i.e. to speak less strictly




--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-30 Thread Mathieu Bouchard

On Mon, 29 Mar 2010, Matteo Sisti Sette wrote:


Mathieu Bouchard escribió:

both are truly cubic interpolations.
IIRC, one kind of cubic interpolation is designed to go through all four 
points, and the other kind is designed to be pieced with other cubic 
interpolations, and Miller confused the two and left the bug there.

According to his last message, he intentionally implemented the first one.
However I still don't understand why; I can't see in which way the first can 
be preferrable to the second.


Well, then, let's say that he *intentionally* *confused* the two !!

I think that when he says « most measures of distorsion », when he doesn't 
tell which, it's because he can't tell.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re:, Max Smoother Audio than Pd?

2010-03-30 Thread Matt Barber
On Tue, Mar 30, 2010 at 9:52 AM, Matteo Sisti Sette
matteosistise...@gmail.com wrote:
 Matt Barber escribió:

 Yes, as far as I know it's identical -- when you do one of these
 interpolations with four points, you can either think of it in terms
 of a cubic polynomial formula involving those four points, or in terms
 of the sum of four scaled basis functions - the latter seems to me
 intuitively equivalent to direct convolution of an impulse response
 centered on the four points, and scaled to each.  It will be limited
 by the quantization of the index, so in that sense it might not be
 linear..

 Hmm, by linear I mean that the interpolated version of the sum of any two
 discrete signals is equal to the sum of the interpotated versions of each
 one. It shouldn't be difficult to tell whether this is true or not by
 looking at the formulas but I'm too lazy right now :P


Right, I think it should absolutely be linear in that sense, provided
you used exactly the same index for both processes and ignored any
rounding errors from adding samples.  In math it should be linear,
but I'm not 100% sure about what quantization of index or sample does
to it (we often don't worry so much about it anyway).

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matteo Sisti Sette

Hi,

 Well, if you use [tabread4~] or any of the many other Pd objects
 that use the same broken interpolation algorithm
 (copy/paste programming),

Broken? What's wrong in the tabread4~ interpolation? (note this is not a 
sarchastical question implying there's nothing wrong in it, it's a 
genuine question in order to learn what's wrong in it)

Is it a bug?

Claude wrote:
 If you use [tabread4] to interpolate graphical
 parameters for animations, the discontinuities in the derivatives are
 really obvious.
[]
 But IMHO if you're doing piecewise cubic interpolation, it's a bit
 of a nonsense to have a cubic that goes through all 4 points when
 it's only being used between the inner-most 2 points

Well using 4 points to interpolate the curve that goes between the two 
inner points should guarantee the absence of discontinuities in the 
first (and second?) derivative; that should be the purpose. Now if there 
actually are discontinuities then there must be some trivial error in 
the equation,  no




Or am I missing something???

--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Roman Haefeli

On Mon, 2010-03-29 at 13:49 +0200, Matteo Sisti Sette wrote:

 Claude wrote:
   If you use [tabread4] to interpolate graphical
   parameters for animations, the discontinuities in the derivatives are
   really obvious.
 []
   But IMHO if you're doing piecewise cubic interpolation, it's a bit
   of a nonsense to have a cubic that goes through all 4 points when
   it's only being used between the inner-most 2 points
 
 Well using 4 points to interpolate the curve that goes between the two 
 inner points should guarantee the absence of discontinuities in the 
 first (and second?) derivative; that should be the purpose. Now if there 
 actually are discontinuities then there must be some trivial error in 
 the equation,  no

 Or am I missing something???

Check this thread:
http://lists.puredata.info/pipermail/pd-list/2008-06/062878.html

Roman


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matteo Sisti Sette

Roman Haefeli escribió:


Check this thread:
http://lists.puredata.info/pipermail/pd-list/2008-06/062878.html


I checked it out (not read the _whole_ thread to the end) but,
In what way can the current tabread4~ interpolation, which is 
discontinuous even in its 1st derivative, be superior to true cubic 
interpolation? Even at transpositions near to zero, I can't see what's 
the advantage, nor what it is supposed to minimize.


--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matteo Sisti Sette

By the way tabread4c~ is not in Pd Extended, is it?

Roman Haefeli escribió:

On Mon, 2010-03-29 at 13:49 +0200, Matteo Sisti Sette wrote:


Claude wrote:
  If you use [tabread4] to interpolate graphical
  parameters for animations, the discontinuities in the derivatives are
  really obvious.
[]
  But IMHO if you're doing piecewise cubic interpolation, it's a bit
  of a nonsense to have a cubic that goes through all 4 points when
  it's only being used between the inner-most 2 points

Well using 4 points to interpolate the curve that goes between the two 
inner points should guarantee the absence of discontinuities in the 
first (and second?) derivative; that should be the purpose. Now if there 
actually are discontinuities then there must be some trivial error in 
the equation,  no


Or am I missing something???


Check this thread:
http://lists.puredata.info/pipermail/pd-list/2008-06/062878.html

Roman





--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Miller Puckette
Hi all-

I haven't looked at Cyrille's interpolator but... tabread4~ uses true cubic
interpolation (which perhaps Cyrille's object also does in some other way).
The tabread4~ algorithm is to put a cubic through the 4 points surrounding
the input point.  However, this cubic curve does not necessarily match the
next curve over in first derivative.

A workaround is to up-sample everybody by a factor of 2 - this dramatically
reduces error, usually by 24 dB.

All described in chapter 2 of my book,
http://crca.ucsd.edu/~msp/techniques.htm

cheers
Miller

On Mon, Mar 29, 2010 at 02:29:30PM +0200, Matteo Sisti Sette wrote:
 Roman Haefeli escribi??:
 
 Check this thread:
 http://lists.puredata.info/pipermail/pd-list/2008-06/062878.html
 
 I checked it out (not read the _whole_ thread to the end) but,
 In what way can the current tabread4~ interpolation, which is 
 discontinuous even in its 1st derivative, be superior to true cubic 
 interpolation? Even at transpositions near to zero, I can't see what's 
 the advantage, nor what it is supposed to minimize.
 
 -- 
 Matteo Sisti Sette
 matteosistise...@gmail.com
 http://www.matteosistisette.com
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread cyrille henry



Matteo Sisti Sette a écrit :

By the way tabread4c~ is not in Pd Extended, is it?
no. 
it is there : 
http://www.chnry.net/ch/?083-Nusmuk-audio


c



Roman Haefeli escribió:

On Mon, 2010-03-29 at 13:49 +0200, Matteo Sisti Sette wrote:


Claude wrote:
  If you use [tabread4] to interpolate graphical
  parameters for animations, the discontinuities in the derivatives are
  really obvious.
[]
  But IMHO if you're doing piecewise cubic interpolation, it's a bit
  of a nonsense to have a cubic that goes through all 4 points when
  it's only being used between the inner-most 2 points

Well using 4 points to interpolate the curve that goes between the 
two inner points should guarantee the absence of discontinuities in 
the first (and second?) derivative; that should be the purpose. Now 
if there actually are discontinuities then there must be some trivial 
error in the equation,  no


Or am I missing something???


Check this thread:
http://lists.puredata.info/pipermail/pd-list/2008-06/062878.html

Roman







___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matteo Sisti Sette

cyrille henry escribió:



Matteo Sisti Sette a écrit :

By the way tabread4c~ is not in Pd Extended, is it?

no. it is there : http://www.chnry.net/ch/?083-Nusmuk-audio


Hi,
I downloaded the zip file but Windows tells me he can't open it.
Is it something different than a normal .zip file?

(it says linux but I thought it may include the source code...)

The downloaded file size is about 54k (not 57.5 as stated in the page), 
so I tried re-downloading it (after clearing the browser cahce) but no 
luck...


--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matteo Sisti Sette

Miller Puckette escribió:


The tabread4~ algorithm is to put a cubic through the 4 points surrounding
the input point.  However, this cubic curve does not necessarily match the
next curve over in first derivative.


Oh I see! I thought it did. I confuded that technique with natural cubic 
splines :$


Now I remember that in order to compute the coefficients for a cspline
you have to know in advance all the points of the table (iirc). But the
general formula for csplines doesn't assume equally spaced points...

So now i dubt is it possible at all to find the piecewise cubic that 
ensures continuity of the 1st and 2nd derivatives by using 4 points at a 
time? (at least in the case of equally spaced points)



thanks
m.


--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread John Harrison
The link works and extracts fine here in WinXP SP3. I used the built-in
compressed (zipped) folders tool in the explorer shell.

On Mon, Mar 29, 2010 at 11:38 AM, Matteo Sisti Sette 
matteosistise...@gmail.com wrote:

 cyrille henry escribió:



 Matteo Sisti Sette a écrit :

 By the way tabread4c~ is not in Pd Extended, is it?

 no. it is there : http://www.chnry.net/ch/?083-Nusmuk-audio


 Hi,
 I downloaded the zip file but Windows tells me he can't open it.
 Is it something different than a normal .zip file?

 (it says linux but I thought it may include the source code...)

 The downloaded file size is about 54k (not 57.5 as stated in the page), so
 I tried re-downloading it (after clearing the browser cahce) but no luck...


 --
 Matteo Sisti Sette
 matteosistise...@gmail.com
 http://www.matteosistisette.com

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list




-- 
John
http://alumni.media.mit.edu/~harrison/
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Mathieu Bouchard


I checked it out (not read the _whole_ thread to the end) but, In what 
way can the current tabread4~ interpolation, which is discontinuous even 
in its 1st derivative, be superior to true cubic interpolation? Even at 
transpositions near to zero, I can't see what's the advantage, nor what 
it is supposed to minimize.


both are truly cubic interpolations.

IIRC, one kind of cubic interpolation is designed to go through all four 
points, and the other kind is designed to be pieced with other cubic 
interpolations, and Miller confused the two and left the bug there.


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matteo Sisti Sette

John Harrison escribió:
The link works and extracts fine here in WinXP SP3. I used the built-in 
compressed (zipped) folders tool in the explorer shell.


Crazy.

Internet Explorer breaks downloaded files whenever it takes you more 
than a few seconds to select the folder to download in. I cleared the 
browser cache and downloaded the file again, which usually fixes the 
problem (only if I clear the browser cache), but this time even if it 
actually and fully redownloaded it it was corrupted again and again so I 
thought it was actually the file.



How such bugs in a browser can stay unfixed for years is beyond my 
understanding... (doesn't Bill Gates use his own broser??)


Thanks cyrille for sending the file.

Sorry I don't actually plan to compile it (never compiled a Pd external 
before), I thought I would just have a look at the source code...

But if I do I will certainly send you the binaries

--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matteo Sisti Sette

Mathieu Bouchard escribió:


both are truly cubic interpolations.

IIRC, one kind of cubic interpolation is designed to go through all four 
points, and the other kind is designed to be pieced with other cubic 
interpolations, and Miller confused the two and left the bug there.


According to his last message, he intentionally implemented the first one.

However I still don't understand why; I can't see in which way the first 
can be preferrable to the second.



--
Matteo Sisti Sette
matteosistise...@gmail.com
http://www.matteosistisette.com

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matt Barber

 I checked it out (not read the _whole_ thread to the end) but, In what
 way can the current tabread4~ interpolation, which is discontinuous even
 in its 1st derivative, be superior to true cubic interpolation? Even at
 transpositions near to zero, I can't see what's the advantage, nor what
 it is supposed to minimize.

 both are truly cubic interpolations.

 IIRC, one kind of cubic interpolation is designed to go through all four
 points, and the other kind is designed to be pieced with other cubic
 interpolations, and Miller confused the two and left the bug there.



Miller's is a true implementation of the former -- his is a Lagrange
interpolator which goes through all points -- it's algebraically
identical to the cubic interpolator in csound, and so it should have a
similar sound as any of the table-reading opcodes in csound that
also employ cubic interpolation.

The latter is an Hermite interpolator which uses the outside points to
approximate the first derivative -- the resulting curve only passes
through the middle two points, but doesn't go through the outside two;
this ensures that as it's pieced together the first derivative will be
continuous at the junctions.  It's algebraically identical to the
cubic interpolator in supercollider.

They're two different approaches -- each has its own frequency
response, but both are true cubics.  If you want to match all four
points AND the first derivatives, you have to use a 5th-order
polynomial.  The formulas are easily derivable using the Gaussian
method, and it's easy to implement all these as a library of functions
that can be accessed by the relevant objects, where the user can
choose which type of interpolation he/she wants to use.

Matt

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Roman Haefeli
Hi Matt

Thanks for the detailed explanation.  I still have troubles getting the
idea of the Lagrange interpolator in the context of [tabread4~]. You
say, that it finds the cubic polynomial which hits all four points. But
what is the advantage of that? As I understand [tabread4~], if the index
is between 5 and 6, it will use the cubic hitting the points at indizes
4, 5, 6 and 7. If the index is between 6 and 7, it will use the cubic
going through the points at 5, 6, 7 and 8. So for the former the fact,
that the curve hits also the points 4 and 7 seems irrelevant and so does
it for the latter for the points 5 and 8, since always only the segment
between floor(n) and ceiling(n) appears in the result. Or is it my
misunderstanding and this is completely wrong?
It seems logical to me, that discontinuities in the first derivative are
avoided in order not to add any partials to the signal. What I don't get
is why it is good to hit all four points, if the segments outside the
middle segment are ignored/not used for the result.

I haven't studied those things in school, so please forgive, if I am
asking things with completely wrong assumptions. I am just trying to
understand why [tabread4~] is good for what it is.

Roman
 


On Mon, 2010-03-29 at 16:33 -0400, Matt Barber wrote:

 Miller's is a true implementation of the former -- his is a Lagrange
 interpolator which goes through all points -- it's algebraically
 identical to the cubic interpolator in csound, and so it should have a
 similar sound as any of the table-reading opcodes in csound that
 also employ cubic interpolation.
 
 The latter is an Hermite interpolator which uses the outside points to
 approximate the first derivative -- the resulting curve only passes
 through the middle two points, but doesn't go through the outside two;
 this ensures that as it's pieced together the first derivative will be
 continuous at the junctions.  It's algebraically identical to the
 cubic interpolator in supercollider.
 
 They're two different approaches -- each has its own frequency
 response, but both are true cubics.  If you want to match all four
 points AND the first derivatives, you have to use a 5th-order
 polynomial.  The formulas are easily derivable using the Gaussian
 method, and it's easy to implement all these as a library of functions
 that can be accessed by the relevant objects, where the user can
 choose which type of interpolation he/she wants to use.
 
 Matt




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] tabread4~ broken interpolation algorithm - was Re: Max Smoother Audio than Pd?

2010-03-29 Thread Matt Barber
LONG, sorry.

On Mon, Mar 29, 2010 at 7:03 PM, Roman Haefeli reduzie...@yahoo.de wrote:
 Hi Matt

 Thanks for the detailed explanation.  I still have troubles getting the
 idea of the Lagrange interpolator in the context of [tabread4~]. You
 say, that it finds the cubic polynomial which hits all four points. But
 what is the advantage of that? As I understand [tabread4~], if the index
 is between 5 and 6, it will use the cubic hitting the points at indizes
 4, 5, 6 and 7. If the index is between 6 and 7, it will use the cubic
 going through the points at 5, 6, 7 and 8. So for the former the fact,
 that the curve hits also the points 4 and 7 seems irrelevant and so does
 it for the latter for the points 5 and 8, since always only the segment
 between floor(n) and ceiling(n) appears in the result. Or is it my
 misunderstanding and this is completely wrong?

That's right -- they're used in the sense that a cubic interpolator
makes use of more of the information of the surrounding samples than,
say, a linear interpolator -- but the segments themselves aren't used
literally in the output.  This would be true, though, of a 6-point
Lagrange polynomial interpolator, or a 32-point windowed sinc
interpolator -- you don't use the other segments, but just the segment
between the two points in question generated by the information
granted to you by the other samples.

 It seems logical to me, that discontinuities in the first derivative are
 avoided in order not to add any partials to the signal. What I don't get
 is why it is good to hit all four points, if the segments outside the
 middle segment are ignored/not used for the result.

Here's how I understand it -- the following is as much for me as it is
anyone else, and please please correct me if I'm wrong:

Both kinds of interpolation add partials via aliasing -- you can think
of it as a kind of resampling rather than interpolation per se:

By the Shannon-Nyquist theorem, you can regain a continuous signal
from a sampled signal EXACTLY by convolving the sampled signal with a
normalized sinc function:

http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem#Reconstruction

provided that the original continuous signal was bandlimited and that
the sample rate was higher than twice the highest frequency in the
original (and to within distortions introduced by quantization).  This
is to say that if you centered a sinc function over every sample and
scaled it to that sample (i.e. multiplied the entire function by the
sample constant), and added all of those functions up from negative
infinity in time to positive infinity in time, you'd have the original
continuous signal that was sampled.  Another way of thinking of this
is that the you've perfectly filtered out all of the aliased images
above and below positve and negative nyquist -- convolving with such a
sinc function is the same as implementing a perfect brickwall filter
whose cutoffs are right at the nyquist.  You're then free to sample
this continuous signal at a higher sample rate -- this is exactly the
same as implementing a perfect interpolator for upsampling;
interpolation does all of this in one step (for downsampling you have
to do some extra filtering to get rid of partials above the new target
Nyquist).

Unfortunately, the sinc function extends forever in both directions,
so you have to approximate it, and libraries like libsamplerate do.
However, you can think of each of these interpolators as impulse
responses with convolution as well.  Imagine that you had a bunch of
samples that you were going to interpolate over, with the following
condition -- one of the samples was max amp (an impulse), and all were
zero.  The impulse response of an interpolator is the continuous
domain result of running that interpolator on the impulse in the
discrete domain -- you can easily visualize it in Pd by running the
attached patch.

The impulse response of an interpolator usually approximates something
that looks like part of a sinc function.  But since none of them are
sinc functions, they all filter out the aliased images less than
perfectly.  This means that if you made a continuous signal using
these interpolators, it would leave a little of the aliased copies of
the digital signal's frequency domain -- these would be generally
pretty high, but still present.  Now, if you resample this (up or
down), those high frequencies will necessarily be higher than the new
Nyquist (since they run to infinity), so they can foldover and cause
audible wrong partials.  Each also has a non-flat frequency response
in the band under the original Nyquist as well.  If you're reading
over the table periodically, the error will also be periodic and so
will exist as harmonics of the fundamental.

One really good way to think, then, is in terms of the continuous
frequency response of the interpolator.  In that long, long discussion
a couple years ago, Chuck Henry made the following post where he
showed the impulse response of