Skip to content

Instantly share code, notes, and snippets.

@tuchella
Created September 20, 2019 16:53
Show Gist options
  • Save tuchella/c6973c780f275eba0c2ccb4165ed6b46 to your computer and use it in GitHub Desktop.
Save tuchella/c6973c780f275eba0c2ccb4165ed6b46 to your computer and use it in GitHub Desktop.
let leg a = withEvent (\e -> Event (legArc $ whole e) (legArc $ part e) (value e))
where legArc (Arc s e) = Arc s (s + ((e - s) * a))
scale' r s p = (|+ r) $ scale s p
lock n p = fast (pure (n % len)) p
where len = fromIntegral $ length $ queryArc p (Arc 0 1)
zoomL :: (Integer, Integer) -> Pattern a -> Pattern a
zoomL (s, e) p | s <= e = fast (pure (len % (e' - s))) $ zoom (s % len, e' % len) p
| otherwise = rev $ zoomL (e, s) p
where len = fromIntegral $ length $ queryArc p (Arc 0 1)
e' = e + 1
putPatr p = putStr $ filter isAscii $ unlines $ map show $ sortOn (wholeStart) $ queryArc p (Arc 0 1)
oct i = (|+ n (i * 12))
do
let inKey :: Pattern Int -> Pattern Double
inKey = scale' "c" "minor"
putPatr $ mono $ leg 0.25
$ almostNever (superimpose ((1/16) ~>))
$ n (inKey (every "3" (|+ "0 0 -1 2") "2*4"))
putStrLn "------------------"
putPatr $ fast 6 $ every "2" (oct (-1))
$ lock 4 $ zoomL (1, 3)
$ n (inKey "1 2 3 4 5 6 7 8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment