packages feed

tidal 1.0.6 → 1.0.7

raw patch · 8 files changed

+81/−35 lines, 8 filesdep +transformersdep ~network

Dependencies added: transformers

Dependency ranges changed: network

Files

README.md view
@@ -7,9 +7,10 @@ For documentation, mailing list and more info see here:   https://tidalcycles.org/ -<a href='https://ko-fi.com/G2G6LHVU' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>+You can help speed up Tidal development by sending coffee here:+  https://ko-fi.com/yaxulive# -(c) Alex McLean and contributors, 2018+(c) Alex McLean and contributors, 2019  Distributed under the terms of the GNU Public license version 3 (or later).
src/Sound/Tidal/Context.hs view
@@ -15,4 +15,5 @@ import Sound.Tidal.Stream as C import Sound.Tidal.Transition as C import Sound.Tidal.UI as C+import Sound.Tidal.Version as C import Sound.Tidal.EspGrid as C
src/Sound/Tidal/Simple.hs view
@@ -1,10 +1,17 @@+{-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleInstances #-}+ module Sound.Tidal.Simple where  import Sound.Tidal.Control (chop, hurry) import Sound.Tidal.Core ((#), (|*), (<~), silence, rev)-import Sound.Tidal.Params (crush, gain, pan, speed)+import Sound.Tidal.Params (crush, gain, pan, speed, s)+import Sound.Tidal.ParseBP (parseBP_E) import Sound.Tidal.Pattern (ControlPattern)+import GHC.Exts ( IsString(..) ) +instance {-# OVERLAPPING #-} IsString (ControlPattern) where+  fromString = s . parseBP_E+   crunch :: ControlPattern -> ControlPattern crunch = (# crush 3) 
src/Sound/Tidal/Tempo.hs view
@@ -22,7 +22,8 @@                     paused  :: Bool,                     nudged  :: Double,                     localUDP   :: O.UDP,-                    remoteAddr :: N.SockAddr+                    remoteAddr :: N.SockAddr,+                    synched :: Bool                    }            -- deriving Show @@ -32,7 +33,8 @@ data State = State {ticks   :: Int,                     start   :: O.Time,                     nowTime :: O.Time,-                    nowArc  :: P.Arc+                    nowArc  :: P.Arc,+                    starting :: Bool                    }  resetCycles :: MVar Tempo -> IO (Tempo)@@ -66,7 +68,8 @@                                      paused   = False,                                      nudged   = 0,                                      localUDP   = local,-                                     remoteAddr = remote+                                     remoteAddr = remote,+                                     synched = False                                     }  -- | Returns the given time in terms of@@ -91,20 +94,26 @@        let st = State {ticks = 0,                        start = s,                        nowTime = s,-                       nowArc = (P.Arc 0 0)+                       nowArc = (P.Arc 0 0),+                       starting = True                       }        clockTid <- forkIO $ loop tempoMV st        return (tempoMV, [listenTid, clockTid])   where loop tempoMV st =           do -- putStrLn $ show $ nowArc ts-             tempo <- readMVar tempoMV+             tempo <- readMVar tempoMV                             let frameTimespan = cFrameTimespan config-             let -- 'now' comes from clock ticks, nothing to do with cycles-                 logicalNow = start st + (fromIntegral $ (ticks st)+1) * frameTimespan+                 -- 'now' comes from clock ticks, nothing to do with cycles+                 logicalT ticks' = start st + (fromIntegral ticks') * frameTimespan+                 logicalNow = logicalT $ (ticks st) + 1                  -- the tempo is just used to convert logical time to cycles-                 s = P.stop $ nowArc st                  e = timeToCycles tempo logicalNow-                 st' = st {ticks = (ticks st) + 1, nowArc = P.Arc s e}+                 s = if (starting st) && (synched tempo)+                     then (timeToCycles tempo (logicalT $ ticks st))+                     else (P.stop $ nowArc st)+                 st' = st {ticks = (ticks st) + 1, nowArc = P.Arc s e,+                           starting = not (synched tempo)+                          }              t <- O.time              when (t < logicalNow) $ threadDelay (floor $ (logicalNow - t) * 1000000)              callback tempoMV st'@@ -135,7 +144,7 @@                                              O.Float $ realToFrac $ cps tempo,                                              O.Int32 $ if (paused tempo) then 1 else 0                                             ]- + listenTempo :: O.UDP -> (MVar Tempo) -> IO () listenTempo udp tempoMV = forever $ do pkt <- O.recvPacket udp                                        act Nothing pkt@@ -151,7 +160,8 @@              putMVar tempoMV $ tempo {atTime = ts,                                       atCycle = realToFrac atCycle',                                       cps = realToFrac cps',-                                      paused = (paused' == 1)+                                      paused = (paused' == 1),+                                      synched = True                                      }         act _ pkt = putStrLn $ "Unknown packet: " ++ show pkt @@ -181,3 +191,5 @@                               return cs         catchAny :: IO a -> (E.SomeException -> IO a) -> IO a         catchAny = E.catch++
src/Sound/Tidal/UI.hs view
@@ -6,12 +6,13 @@  import           Data.Ord (comparing) import           Data.Char (digitToInt, isDigit)+-- import           System.Random (randoms, mkStdGen) import           System.Random.MWC import           Control.Monad.ST import qualified Data.Vector as V import           Data.Word (Word32) import           Data.Ratio ((%),numerator,denominator)-import           Data.List (sort, sortBy, findIndices, elemIndex, groupBy, transpose)+import           Data.List (sort, sortBy, sortOn, findIndices, elemIndex, groupBy, transpose) import           Data.Maybe (isJust, fromJust, fromMaybe, mapMaybe, catMaybes) import qualified Data.Text as T import           Control.Applicative (liftA2)@@ -36,6 +37,14 @@   seed <- initialize (V.fromList [n',d'] :: V.Vector Word32)   uniform seed +timeToRands :: RealFrac a => a -> Int -> [Double]+timeToRands x n = V.toList $ runST $ do+  let x' = toRational (x*x) / 1000000+  let n' = fromIntegral $ numerator x'+  let d' = fromIntegral $ denominator x'+  seed <- initialize (V.fromList [n',d'] :: V.Vector Word32)+  uniformVector seed n+ {-|  `rand` generates a continuous pattern of (pseudo-)random numbers between `0` and `1`.@@ -1208,24 +1217,38 @@ `"c a b"`, or `"c b a"`.  But it will **never** return `"a a a"`, because that is not a permutation of the parts. -}-shuffle::Int -> Pattern a -> Pattern a-shuffle n = fit' 1 n (_run n) randpat-  where randpat = Pattern {nature = Digital,-                           query = \(State {arc = Arc s e}) -> queryArc (p $ sam s) (Arc s e)-                          }-        p c = fastFromList $ map snd $ sort $ zip-              [timeToRand (c+i/n') | i <- [0..n'-1]] [0..n-1]-        n' :: Time-        n' = fromIntegral n+shuffle :: Int -> Pattern a -> Pattern a+shuffle n pat = innerJoin $ (\i -> _fast nT $ repeatCycles n $ pats !! i) <$> randrun n+  where+    pats = map (\i -> zoom ((fromIntegral i)/nT, (fromIntegral (i+1))/nT) pat) [0 .. (n-1)]+    nT :: Time+    nT = fromIntegral n  {- | `scramble n p` is like `shuffle` but randomly selects from the parts of `p` instead of making permutations. For example, `scramble 3 "a b c"` will randomly select 3 parts from `"a"` `"b"` and `"c"`, possibly repeating a single part. -}-scramble::Int -> Pattern a -> Pattern a-scramble n = fit' 1 n (_run n) (_fast (fromIntegral n) $-  liftA2 (+) (pure 0) $ irand n)+scramble :: Int -> Pattern a -> Pattern a+scramble n pat = innerJoin $ (\i -> _fast nT $ repeatCycles n $ pats !! i) <$> randn+  where+    randn = _segment nT $ irand n+    pats = map (\i -> zoom ((fromIntegral i)/nT, (fromIntegral (i+1))/nT) pat) [0 .. (n-1)]+    nT :: Time+    nT = fromIntegral n+++randrun :: Int -> Pattern Int+randrun 0 = silence+randrun n' =+  splitQueries $ Pattern Digital (\(State a@(Arc s _) _) -> events a $ sam s)+  where events a seed = catMaybes $ map toEvent $ zip arcs shuffled+          where shuffled = map snd $ sortOn fst $ zip rs [0 .. (n'-1)]+                rs = timeToRands seed n'+                arcs = map (\(s,e) -> Arc s e) $ zip fractions (tail fractions)+                fractions = map (+ (sam $ start a)) $ [0, 1/(fromIntegral n') .. 1]+                toEvent (a',v) = do a'' <- subArc a a'+                                    return $ Event a' a'' v  ur :: Time -> Pattern String -> [(String, Pattern a)] -> [(String, Pattern a -> Pattern a)] -> Pattern a ur t outer_p ps fs = _slow t $ unwrap $ adjust <$> (timedValues $ (getPat . split) <$> outer_p)
+ src/Sound/Tidal/Version.hs view
@@ -0,0 +1,4 @@++module Sound.Tidal.Version where++tidal_version = "1.0.7"
test/Sound/Tidal/ControlTest.hs view
@@ -7,14 +7,10 @@  import Prelude hiding ((<*), (*>)) -import qualified Data.Map.Strict as Map---- import Sound.Tidal.Pattern import Sound.Tidal.Control import Sound.Tidal.Core import Sound.Tidal.Params import Sound.Tidal.Pattern-import Sound.Tidal.UI  run :: Microspec () run =
tidal.cabal view
@@ -1,5 +1,5 @@ name:                tidal-version:             1.0.6+version:             1.0.7 synopsis:            Pattern language for improvised music -- description: homepage:            http://tidalcycles.org/@@ -8,7 +8,7 @@ author:              Alex McLean maintainer:          Alex McLean <alex@slab.org>, Mike Hodnick <mike.hodnick@gmail.com> Stability:           Experimental-Copyright:           (c) Tidal contributors, 2018+Copyright:           (c) Tidal contributors, 2019 category:            Sound build-type:          Simple cabal-version:       >=1.10@@ -45,6 +45,7 @@                        Sound.Tidal.Transition                        Sound.Tidal.UI                        Sound.Tidal.Utils+                       Sound.Tidal.Version                        Sound.Tidal.EspGrid    Build-depends:@@ -54,11 +55,12 @@     , hosc < 0.18     , text < 1.3     , parsec < 3.2-    , network < 2.9+    , network < 3.1     , mwc-random < 0.15     , vector < 0.13     , bifunctors < 5.6-+    , transformers < 0.5.6+       if !impl(ghc >= 8.4.1)     build-depends: semigroups == 0.18.*