tmhglnd/total-serialism

Interpolation between Arrays

tmhglnd opened this issue · 3 comments

Include various forms of interpolation between arrays inspired by methods from the AC Toolkit.

Hi,
Are you talking about the "Interpolating between two note structures" on page 93 ?
I can help you with that :)

That would be one way indeed, which might be fitting for the Stochastic methods (since it uses randomness). Another more mathematical option I had in mind is actually more straightforward and just linearly interpolating between numbers from an array. So for example:

let arr1 = [0, 1, 2, 3, 4];
let arr2 = [0, 2, 4, 8, 16];

let arr3 = Mod.interpolate(arr1, arr2, 0.5);
console.log(arr3);
//=> [0, 1.5, 3, 5.5, 10]

I already started working on that in the utility.js section. The method is called mix(). Feel free to expand upon that, or start working on the interpolate method as described in the paper on p.93!

For now a simple array linear interpolation method is added in a6f731a named lerp()/ mix().