{
  "$type": "site.standard.document",
  "content": "---\ntitle: \"Euclidean rhythms in Extempore\"\ndescription: \"A recursive Scheme implementation of Euclidean rhythms in Extempore, plus\n  some unexpectedly cool visual patterns.\"\ntags:\n  - extempore\n---\n\nAs part of the new Extempore pattern language stuff I added a helper for\ngenerating [euclidean rhythms](https://en.wikipedia.org/wiki/Euclidean_rhythm).\nI wrote it (in a recursive style) in Scheme using the algorithm described in\n[Godfried Toussaint's](https://cgm.cs.mcgill.ca/~godfried/publications/banff-extended.pdf)\npaper (although it's credited to _Bjorklund_).\n\nAs well as the obvious musical possibilities, one of the things I noticed when I\nwas playing around that if one loops through euclidean rhythms of increasing\n\"density\" the _visual representation_ exhibits some cool patterns as well.\nHere's an example of the 17 different rhythms of length 16 (from 0 to 16\ninclusive). We can print out the patterns using this loop (using `'X` for the\n\"hit\" marker so that it looks more prominent in a log view).\n\n```xtlang\n(dotimes (i 17)\n  (println (euclid i 16 'X)))\n```\n\nWhat gets printed to the log is:\n\n```text\n(_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _)\n(X _ _ _ _ _ _ _ _ _ _ _ _ _ _ _)\n(X _ _ _ _ _ _ _ X _ _ _ _ _ _ _)\n(X _ _ _ _ _ X _ _ _ _ X _ _ _ _)\n(X _ _ _ X _ _ _ X _ _ _ X _ _ _)\n(X _ _ _ X _ _ X _ _ X _ _ X _ _)\n(X _ _ X _ X _ _ X _ _ X _ X _ _)\n(X _ _ X _ X _ X _ X _ _ X _ X _)\n(X _ X _ X _ X _ X _ X _ X _ X _)\n(X _ X X _ X _ X _ X _ X X _ X _)\n(X _ X X _ X _ X X _ X X _ X _ X)\n(X _ X X X _ X X _ X X _ X X _ X)\n(X _ X X X _ X X X _ X X X _ X X)\n(X _ X X X X X _ X X X X _ X X X)\n(X _ X X X X X X X _ X X X X X X)\n(X _ X X X X X X X X X X X X X X)\n(X X X X X X X X X X X X X X X X)\n```\n\nLook, there's probably some super-cool mathematical explanation for why this\nlooks like that. Stephen Wolfram, if you're reading, drop me a line and tell me\nwhat it is. But I just thought it looked cool---I'm sure there are generative\nart possibilities here as well (they may have already been explored).\n",
  "createdAt": "2026-05-13T23:14:55.771Z",
  "description": "A recursive Scheme implementation of Euclidean rhythms in Extempore, plus some unexpectedly cool visual patterns.",
  "path": "/blog/2020/01/27/euclidean-rhythms-in-extempore",
  "publishedAt": "2020-01-27T00:00:00.000Z",
  "site": "at://did:plc:tevykrhi4kibtsipzci76d76/site.standard.publication/self",
  "tags": [
    "extempore"
  ],
  "textContent": "A recursive Scheme implementation of Euclidean rhythms in Extempore, plus some unexpectedly cool visual patterns.",
  "title": "Euclidean rhythms in Extempore"
}