tidal 0.4.15 → 0.4.16
raw patch · 4 files changed
+36/−6 lines, 4 filesdep +hmt
Dependencies added: hmt
Files
- Sound/Tidal/Parse.hs +17/−3
- Sound/Tidal/Pattern.hs +4/−1
- Sound/Tidal/Strategies.hs +13/−0
- tidal.cabal +2/−2
Sound/Tidal/Parse.hs view
@@ -105,10 +105,12 @@ pSingle f = f >>= pRand >>= pMult pPart :: Parser (Pattern a) -> Parser ([Pattern a])-pPart f = do part <- parens (pSequence f) <|> pSingle f <|> pPolyIn f <|> pPolyOut f- part' <- pRand part+pPart f = do -- part <- parens (pSequence f) <|> pSingle f <|> pPolyIn f <|> pPolyOut f+ part <- pSingle f <|> pPolyIn f <|> pPolyOut f+ part <- pE part+ part <- pRand part spaces- parts <- pReplicate part'+ parts <- pReplicate part spaces return $ parts @@ -178,6 +180,18 @@ spaces return $ degrade thing <|> return thing++pE :: Pattern a -> Parser (Pattern a)+pE thing = do (n,k) <- parens (pair)+ return $ e n k thing+ <|> return thing+ where pair = do a <- integer+ spaces+ symbol ","+ spaces+ b <- integer+ return (fromIntegral a, fromIntegral b)+ pReplicate :: Pattern a -> Parser ([Pattern a]) pReplicate thing = do extras <- many $ do char '!'
Sound/Tidal/Pattern.hs view
@@ -13,6 +13,8 @@ import Data.Function import System.Random.Mersenne.Pure64 +import Music.Theory.Bjorklund+ import Sound.Tidal.Time import Sound.Tidal.Utils @@ -55,7 +57,6 @@ mempty = silence mappend = overlay - instance Monad Pattern where return = pure p >>= f = @@ -470,3 +471,5 @@ revArc a = within a rev +e :: Int -> Int -> Pattern b -> Pattern b+e n k p = (flip const) <$> (filterValues (== True) $ listToPat $ bjorklund (n,k)) <*> p
Sound/Tidal/Strategies.hs view
@@ -42,6 +42,7 @@ samples :: Applicative f => f String -> f Int -> f String samples p p' = pick <$> p <*> p' + {- scrumple :: Time -> Pattern a -> Pattern a -> Pattern a scrumple o p p' = p'' -- overlay p (o ~> p'')@@ -108,6 +109,15 @@ newEvent :: OscMap -> (Int, Arc) -> Event OscMap newEvent v (i, a) = (a,a,Map.insert (param dirt "end") (Just $ OSC.FD.float ((fromIntegral $ i+1)/(fromIntegral n))) $ Map.insert (param dirt "begin") (Just $ OSC.FD.float ((fromIntegral i)/(fromIntegral n))) v) +gap :: Int -> OscPattern -> OscPattern+gap n p = Pattern $ \queryA -> concatMap (f queryA) $ arcCycles queryA+ where f queryA a = concatMap (chopEvent queryA) (arc p a)+ chopEvent (queryS, queryE) (a,a',v) = map (newEvent v) $ filter (\(_, (s,e)) -> not $ or [e < queryS, s >= queryE]) (enumerate $ everyOther $ chopArc a n)+ newEvent :: OscMap -> (Int, Arc) -> Event OscMap+ newEvent v (i, a) = (a,a,Map.insert (param dirt "end") (Just $ OSC.FD.float ((fromIntegral $ i+1)/(fromIntegral n))) $ Map.insert (param dirt "begin") (Just $ OSC.FD.float ((fromIntegral i)/(fromIntegral n))) v)+ everyOther (x:(y:xs)) = x:(everyOther xs)+ everyOther xs = xs+ chopArc :: Arc -> Int -> [Arc] chopArc (s, e) n = map (\i -> ((s + (e-s)*(fromIntegral i/fromIntegral n)), s + (e-s)*((fromIntegral $ i+1)/fromIntegral n))) [0 .. n-1] {-@@ -129,3 +139,6 @@ -- where wrapAtCycle f t' = sam t' + cyclePos (f t') -- wrappedPlus = wrapAtCycle (+t) ++en :: [(Int, Int)] -> Pattern String -> Pattern String+en ns p = stack $ map (\(i, (k, n)) -> e k n (samples p (pure i))) $ enumerate ns
tidal.cabal view
@@ -1,5 +1,5 @@ name: tidal-version: 0.4.15+version: 0.4.16 synopsis: Pattern language for improvised music -- description: homepage: http://yaxu.org/tidal/@@ -28,4 +28,4 @@ Sound.Tidal.Context Sound.Tidal.Utils - Build-depends: base < 5, process, parsec, hosc > 0.13, hashable, colour, containers, time, websockets > 0.8, text, mtl >=2.1, transformers, mersenne-random-pure64,binary, bytestring+ Build-depends: base < 5, process, parsec, hosc > 0.13, hashable, colour, containers, time, websockets > 0.8, text, mtl >=2.1, transformers, mersenne-random-pure64,binary, bytestring, hmt