tmhglnd / total-serialism

Toolbox full of Algorithmic Composition methods
MIT License
150 stars 10 forks source link

Add Per Nørgård's infinity series #26

Closed tmhglnd closed 2 years ago

tmhglnd commented 2 years ago

New generative method for infinity series of Per Nørgård:

Some background: https://oeis.org/A004718 https://en.wikipedia.org/wiki/Per_N%C3%B8rg%C3%A5rd https://www.lawtonhall.com/blog/2019/9/9/per-nrgrds-infinity-series#:~:text=Coding%20the%20Infinity%20Series

Typescript implementation: https://github.com/tablesandwaves/tblswvs.js/blob/main/src/melody.ts#L194

What should the function be called? infinitySeries(), perNorgard(), norgard(), infSeries()

Is argument number of iterations? infinitySeries(<num-iterations>, [<germinal-interval>])

Method and expected output:

Generative.norgard(0, [0, 1]);
// => [ 0 ]

Generative.norgard(5, [0, 1]);
// => [ 0, 1, -1, 2, 1, 0, -2, 3, -1, 2, 0, 1, 2, -1, -3, 4, 1, 0, -2, 3, 0, 1, -1, 2, -2, 3, 1, 0, 3, -2, -4, 5 ]
tmhglnd commented 2 years ago

Added in 7ad430957abfac7b1526aa198726b01a565ed000