tmhglnd / total-serialism

Toolbox full of Algorithmic Composition methods
MIT License
154 stars 11 forks source link

Interpolation between Arrays #8

Open tmhglnd opened 4 years ago

tmhglnd commented 4 years ago

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

ToledOmer commented 4 years ago

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

tmhglnd commented 4 years ago

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!

tmhglnd commented 1 year ago

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