I’m just cutting and pasting the content of my pull request on Github…
This is my work in progress PR to add a Euclidean rhythms operator to the teletype.
ER f l i
i= index (0-based)
The output is a
The index is modulo’d against the length.
The data is precomputed using a Haskell script, it only includes lengths up to 32. As far as I can tell, most algorithms to compute a Euclidean rhythm are at best O(n), whereas this is O(1). The code+data adds ~2kb to the ROM size.
ERthe best name for the operator? Initially I was using
EUCLIDbut it’s a bit too long.
- Should the index be modulo’d by length?
- What to do about out of bound values (fill > length, length > 32)?