Forums > MaxMSP

quadratic or cubic interpolator

December 13, 2006 | 4:52 am

Hi, I’m implementing a continuously variable delay line. Unfortunately I am currently using linear interpolation between samples, and it’s prety awful. Does anybody know of a good object for quadratic or cubic interpolation of signals?
Thanks


December 13, 2006 | 12:51 pm

On Dec 12, 2006, at 11:52 PM, Tim wrote:
> Hi, I’m implementing a continuously variable delay line.
> Unfortunately I am currently using linear interpolation between
> samples, and it’s prety awful. Does anybody know of a good object
> for quadratic or cubic interpolation of signals?

I don’t have an object for this, but I have some C code for an
allpass interpolation. Would that help? Or do you know how to code
externals?

—–
Nathan Wolek
nw@nathanwolek.com

http://www.nathanwolek.com


December 13, 2006 | 6:16 pm

I don’t know if I’ll have time to make an external, but the code may be helpful. How can I get it from you?
thx
tim.m


December 13, 2006 | 6:38 pm

On Dec 13, 2006, at 1:16 PM, Tim wrote:
> I don’t know if I’ll have time to make an external, but the code
> may be helpful. How can I get it from you?

Here you go. Complete with reference on where I found the technique.

/
************************************************************************
********
float rbb_allpassInterp(float *in_array, float index, long bufferLength,
float last_out, float *out_ptr)

inputs: in_array — name of array of input values
index — floating point index value to interpolate
bufferLength — length of in_array
last_out — value of last output from buffer
out_ptr — pointer to output location
description: performs allpass interpolation on an input array and
returns the
results to a location specified by a pointer; implements filter as
specified
in Dattorro 2: J. Audio Eng. Soc., Vol 45, No 10, 1997 October
returns: interpolated output
************************************************************************
********/
void rbb_allpassInterp(float *in_array, float index, long bufferLength,
float last_out, float *out_ptr)
{
// index = i.frac
long index_i = (long)index; // i
long index_iP1 = index_i + 1; // i + 1
float index_frac = index – (float)index_i; // frac

// make sure that index_iP1 is not out of range
while (index_iP1 >= bufferLength) index_iP1 -= bufferLength;

// formula as on bottom of page 765 of above Dattorro article
*out_ptr = in_array[index_i] + index_frac * (in_array[index_iP1] –
last_out);
}

—–
Nathan Wolek
nw@nathanwolek.com

http://www.nathanwolek.com


December 14, 2006 | 1:49 pm

thanks for the code. It looks quite simple. Obviously a piece of cake in C (once you know) but the feedback aspect of the algorithm would make it pretty much impossible in MAX/MSP directly, I believe. Is that correct? From other posts I have seen it seems that a minimum feedback delay of 1 signal vector is required?
Thanks.


December 14, 2006 | 3:00 pm

On Dec 14, 2006, at 8:49 AM, Tim wrote:
> Obviously a piece of cake in C (once you know) but the feedback
> aspect of the algorithm would make it pretty much impossible in MAX/
> MSP directly, I believe. Is that correct? From other posts I have
> seen it seems that a minimum feedback delay of 1 signal vector is
> required?

Yes. On both counts.

——————-
Nathan Wolek, PhD — nwolek@stetson.edu
Assistant Professor of Music Technology
Stetson University – DeLand, FL

http://www.nathanwolek.com


Viewing 6 posts - 1 through 6 (of 6 total)