Skip to content

Instantly share code, notes, and snippets.

@rjwebb
Created December 28, 2014 23:43
Show Gist options
  • Save rjwebb/79befd5f935f97fddb21 to your computer and use it in GitHub Desktop.
Save rjwebb/79befd5f935f97fddb21 to your computer and use it in GitHub Desktop.
betweenTimes :: Integral b => b -> Time -> Time -> Time -> Bool
betweenTimes n s e t = and [normT >= s, normT < e] where normT = fromIntegral (mod (floor t) n)
playForLoop :: Integral b => b -> Time -> Time -> Pattern a -> Pattern a
playForLoop n s e = playWhen (betweenTimes n s e)
seqPLoop :: Integral b => b -> [(Time, Time, Pattern a)] -> Pattern a
seqPLoop n = stack . (map (\(s, e, p) -> playForLoop n s e ((sam s) ~> p)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment