linear crossfade between lists

weuoimi 's icon

Hello, don't be mad at me if i what i am looking for is stupid or pointless, i am new to this and not quite familiar with max terminology. So, i am looking for a way to use line object to perform linear crossfade between x y z float coordinates, packed in some kind of multichannel signal, to express the transition delta from one point placed in 3d space to another point placed in 3d space. I just want to make it flexible enough to not to process each coordinate separately. I want to have a dynamically changing list of three coordinates in output. In other words, i am looking for a decent way to perform any operations with each member from a list as if i were using map() function in programming

HowToMakeTheCrossfade.maxpat
Max Patch

Roman Thilenius's icon

there are various ways how to perform operations on lists of floats, but for only three values i would most likely not even do it.

the best way to find a list-processing method is always to build the process for a single value first:

interpolation between a and b: map normalized range (0-1) to range (a to b)

if you now want to avoid making three copies of that, you could calculate the mapping from normalized to (a to b) yourself:

because, while expr is an alien to some people, once you get it to work it is often a good basis to easily transform stuff to work with lists by simply changing it to vexpr:



TFL's icon

Somehow answering your question:
I can suggest using a combination of [ease.xfade] (requires the ease package, available in the package manager) and [line], which comes with a handful of easing fonctions to play with, if linear isn't your cup of tea.

Not answering your question but maybe interesting to consider:
Another interesting approach is using [slide] or [jit.slide], although you can just control the speed of the crossfade in rise and fall directions independantly.

Max Patch
Copy patch and select New From Clipboard in Max.

Actual answer to your question: as Roman illustrated, [vexpr] is the way to "perform any operations with each member from a list as if i were using map() function in programming".

If you find [vexpr] too limiting (although it is absolutely fine for linear interpolation between 3D coordinates), you can play with the more versatile option [array.map] existing since Max 8.6 (or create your for loop manually with [iter 1], [zl.group] and any process in-between).

Pedro Santos's icon

Just another approach: sometimes I use jitter matrices as an alternative way to process lists.

Here's an example.

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

vexpr would be my choice, but when adding different options,

one could also consider pattrstorage - interpolation between presets.