Interpolating extremes of lists

Jul 13, 2013 at 9:29am

Interpolating extremes of lists

So I’m revising all of my mapping stuff for my monome Arc controllers, and I primarily use lists to set the values. It can take a list of 64 numbers (between 0-15).

The general idea is to have the very end of the list not be binary, but rather fade in/out, to allow for finer visual feedback of parameters.

I’ve managed to figure this out when using a block of rolling numbers (see first example), but when using a static image that ‘wipes’, it glitches when going up.
I’m using zl nth’s replace function to tell what the index of the highest value is and then replace that, but no matter what I try, it always bangs out an extra 0 in there when I get to the next ‘tick’. I’ve tried zl reg-ing the list going to zl nth, and all sorts of order of operations stuff, and still no joy.

This is not apparent on a monitor, but on the controller it produces a visible hiccup. You can see it if you print the output.

So question #1. How can I get rid of that hiccup?

Question #2. Is there a better way to do this than using zl rot/zl slice, or listfunnel etc… There’s been some talk of bringing jitter into the mix on the monome forum, but I wouldn’t know where to begin.

Lastly, I haven’t been able to figure out how to interpolate two sides of a rotating image (the 3rd example). Basically having an arbitrary length ‘block’ of stuff, that the ends of do the interpolation.
My plan was to figure out problem two, then do an inversion of it to figure out problem three.

Here’s an example of what I mean:

<code>

– Pasted Max Patch, click to expand. –

</code>

#255902
Jul 13, 2013 at 3:46pm

There’s this version from a standard monome app that almost does what I want.
This does sine interpolation across the whole length of the list. What I’d want is to just do the extremes of the list (bottom, top, or both).

inlets = 1;
outlets = 3;

var i;
var offset = 0.0;
var index = 0.0;
var width = 1.0;
var point = new Array(2);

var them = new Array(64);

var b = 0;

function bcolor(x) {
b = x;
}

function p(x, w) {
index = Math.floor(x)+1;
offset = (x+1) % index;
width = w;

outlet(1,0);

for(i=0;i<64;i++) them[i] = b;

for(i=0;i<w;i++) {
point[0] = (64+i+index-Math.floor(w/2))%64+1; //+1 is for multislider
point[1] = Math.floor((-Math.cos(((1+i-offset)/width)*Math.PI*2.0) +1)/2*(15.5-b)+b);
outlet(0,point);

them[point[0]-1] = point[1];
}

outlet(2,them);
}

#255945
Jul 13, 2013 at 6:13pm

This is not exactly there but i wanted to make sure i understand what you want to achieve and wanted to propose a kind of windowing method here. This should work right?
<code>

– Pasted Max Patch, click to expand. –

</code>

#255952
Jul 13, 2013 at 6:19pm

fir lowpass for the second problem, just to propose a method again. Of course you can use any filter.
<code>

– Pasted Max Patch, click to expand. –

</code>

edit: i don’t think that’s what you wanted. have to sleep

#255953
Jul 14, 2013 at 6:27am

That first one is awesome. I can’t believe I didn’t think of using vexpr/scalar!

The second one, as you mention in your edit, isn’t right. Basically it would be to do the interpolating thing the other examples are doing, just on each side of the window thing.

Here’s a stripped down version of the ‘working’ patch.

<code>

– Pasted Max Patch, click to expand. –

</code>

#255971
Jul 19, 2013 at 8:34am

Ok, it occurred to me that I can just interpolate between two lists to solve all my problems. Just have two adjacent lists, and interpolate from one rotation value to the next.

The problem is I don’t know how to interpolate a whole list of numbers. I can unpack and interpolate each bit, but that seems hugely inefficient.

Here’s what I mean, and some simple interpolation value math.

<code>

– Pasted Max Patch, click to expand. –

</code>

#256480
Jul 19, 2013 at 10:34am

Ok, here’s the solution.

Basically adapted the vexpr code from this thread:

http://cycling74.com/forums/topic/interpolating-between-two-function-tables/

And put together this:

<code>

– Pasted Max Patch, click to expand. –

</code>

#256499

You must be logged in to reply to this topic.