total-serialism icon indicating copy to clipboard operation
total-serialism copied to clipboard

Interpolation between Arrays

Open tmhglnd opened this issue 4 years ago • 3 comments

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

  • https://www.actoolbox.net/data/documents/AC_Toolbox_Tutorial.pdf?fbclid=IwAR0s0azFh46GEhHvjkv8hsfwzrFD9jiF7ssQ1THG0zIYmOeTQuaM3940aVo

tmhglnd avatar May 20 '20 20:05 tmhglnd

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

ToledOmer avatar Nov 10 '20 00:11 ToledOmer

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 avatar Nov 10 '20 07:11 tmhglnd

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

tmhglnd avatar Apr 30 '23 23:04 tmhglnd