New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Euclidean rhythms #68

merged 1 commit into from Jan 23, 2016


None yet
2 participants

samdoshi commented Jan 23, 2016

This is my work in progress PR to add a Euclidean rhythms operator to the teletype.

ER f l i


  • f = fill
  • l = length
  • i = index

The output is a 1 or 0.

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.

Open questions:

  • Is ER the best name for the operator? Initially I was using EUCLID but 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)?

Video of it in action

tehn added a commit that referenced this pull request Jan 23, 2016

@tehn tehn merged commit 75e1518 into tehn:master Jan 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment