-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Pattern language for improvised music
--
@package tidal
@version 0.4
module Sound.Tidal.Utils
enumerate :: [a] -> [(Int, a)]
mapFst :: (a -> b) -> (a, c) -> (b, c)
mapFsts :: (a -> b) -> [(a, c)] -> [(b, c)]
mapSnd :: (a -> b) -> (c, a) -> (c, b)
mapSnds :: (a -> b) -> [(c, a)] -> [(c, b)]
wordsBy :: (a -> Bool) -> [a] -> [[a]]
maybeRead :: String -> Maybe Double
fst' :: (t, t1, t2) -> t
snd' :: (t, t1, t2) -> t1
thd' :: (t, t1, t2) -> t2
mapFst' :: (a -> x) -> (a, b, c) -> (x, b, c)
mapSnd' :: (b -> x) -> (a, b, c) -> (a, x, c)
mapThd' :: (c -> x) -> (a, b, c) -> (a, b, x)
mapFsts' :: (a -> x) -> [(a, b, c)] -> [(x, b, c)]
mapSnds' :: (b -> x) -> [(a, b, c)] -> [(a, x, c)]
mapThds' :: (c -> x) -> [(a, b, c)] -> [(a, b, x)]
mapArcs :: (a -> a) -> [(a, a, x)] -> [(a, a, x)]
getEnvDefault :: String -> String -> IO String
module Sound.Tidal.Tempo
data Tempo
Tempo :: UTCTime -> Double -> Double -> Tempo
at :: Tempo -> UTCTime
beat :: Tempo -> Double
bps :: Tempo -> Double
type ClientState = [Connection]
getClockIp :: IO String
getServerPort :: IO Int
readTempo :: String -> Tempo
logicalTime :: Tempo -> Double -> Double
tempoMVar :: IO (MVar (Tempo))
beatNow :: Tempo -> IO (Double)
clientApp :: MVar Tempo -> MVar Double -> ClientApp ()
sendBps :: Connection -> MVar Double -> IO ()
connectClient :: Bool -> String -> MVar Tempo -> MVar Double -> IO ()
runClient :: IO ((MVar Tempo, MVar Double))
bpsSetter :: IO (Double -> IO ())
clocked :: (Tempo -> Int -> IO ()) -> IO ()
clockedTick :: Int -> (Tempo -> Int -> IO ()) -> IO ()
updateTempo :: MVar Tempo -> Maybe Double -> IO ()
addClient :: Connection -> ClientState -> ClientState
removeClient :: Connection -> ClientState -> ClientState
broadcast :: Text -> ClientState -> IO ()
startServer :: IO (ThreadId)
serverApp :: MVar Tempo -> MVar ClientState -> ServerApp
serverLoop :: Connection -> MVar Tempo -> MVar ClientState -> IO ()
instance Show Tempo
instance Eq Connection
module Sound.Tidal.Time
-- | Time is represented by a rational number. Each natural number
-- represents both the start of the next rhythmic cycle, and the end of
-- the previous one. Rational numbers are used so that subdivisions of
-- each cycle can be accurately represented.
type Time = Rational
-- | (s,e) :: Arc represents a time interval with a start and end
-- value. { t : s <= t && t < e }
type Arc = (Time, Time)
-- | An Event is a value that occurs during the period given by the first
-- Arc. The second one indicates the event's "domain of
-- influence". These will often be the same, but many temporal
-- transformations, such as rotation and scaling time, may resuqlt in
-- arcs being split or truncated. In such cases, the first arc is
-- preserved, but the second arc reflects the portion of the event which
-- is relevant.
type Event a = (Arc, Arc, a)
-- | The starting point of the current cycle. A cycle occurs from each
-- natural number to the next, so this is equivalent to floor.
sam :: Time -> Time
-- | The end point of the current cycle (and starting point of the next
-- cycle)
nextSam :: Time -> Time
-- | The position of a time value relative to the start of its cycle.
cyclePos :: Time -> Time
-- | isIn a t is True iff t is inside the arc
-- represented by a.
isIn :: Arc -> Time -> Bool
-- | Splits the given Arc into a list of Arcs, at cycle
-- boundaries.
arcCycles :: Arc -> [Arc]
-- | subArc i j is the arc that is the intersection of i
-- and j.
subArc :: Arc -> Arc -> Maybe Arc
-- | Map the given function over both the start and end Time
-- values of the given Arc.
mapArc :: (Time -> Time) -> Arc -> Arc
-- | Returns the `mirror image' of an Arc, used by
-- Sound.Tidal.Pattern.rev.
mirrorArc :: Arc -> Arc
-- | The start time of the given Event
eventStart :: Event a -> Time
-- | The start time of the given Event
eventOnset :: Event a -> Time
-- | The midpoint of an Arc
midPoint :: Arc -> Time
hasOnset :: Event a -> Bool
module Sound.Tidal.Pattern
-- | The pattern datatype, a function from a time Arc to
-- Event values. For discrete patterns, this returns the events
-- which are active during that time. For continuous patterns, events
-- with values for the midpoint of the given Arc is returned.
data Pattern a
Pattern :: (Arc -> [Event a]) -> Pattern a
arc :: Pattern a -> Arc -> [Event a]
-- | show (p :: Pattern) returns a text string representing the
-- event values active during the first cycle of the given pattern.
-- | pure a returns a pattern with an event with value a,
-- which has a duration of one cycle, and repeats every cycle.
-- | mempty is a synonym for silence. | mappend
-- is a synonym for overlay.
-- | atom is a synonym for pure.
atom :: a -> Pattern a
-- | silence returns a pattern with no events.
silence :: Pattern a
-- | mapQueryArc f p returns a new Pattern with function
-- f applied to the Arc values passed to the original
-- Pattern p.
mapQueryArc :: (Arc -> Arc) -> Pattern a -> Pattern a
-- | mapQueryTime f p returns a new Pattern with function
-- f applied to the both the start and end Time of the
-- Arc passed to Pattern p.
mapQueryTime :: (Time -> Time) -> Pattern a -> Pattern a
-- | mapResultArc f p returns a new Pattern with function
-- f applied to the Arc values in the events returned
-- from the original Pattern p.
mapResultArc :: (Arc -> Arc) -> Pattern a -> Pattern a
-- | mapResultTime f p returns a new Pattern with
-- function f applied to the both the start and end
-- Time of the Arc values in the events returned from
-- the original Pattern p.
mapResultTime :: (Time -> Time) -> Pattern a -> Pattern a
-- | overlay combines two Patterns into a new pattern, so
-- that their events are combined over time.
overlay :: Pattern a -> Pattern a -> Pattern a
(>+<) :: Pattern a -> Pattern a -> Pattern a
-- | stack combines a list of Patterns into a new
-- pattern, so that their events are combined over time.
stack :: [Pattern a] -> Pattern a
-- | append combines two patterns Patterns into a new
-- pattern, so that the events of the second pattern are appended to
-- those of the first pattern, within a single cycle
append :: Pattern a -> Pattern a -> Pattern a
-- | append' does the same as append, but over two
-- cycles, so that the cycles alternate between the two patterns.
append' :: Pattern a -> Pattern a -> Pattern a
-- | cat returns a new pattern which interlaces the cycles of the
-- given patterns, within a single cycle. It's the equivalent of
-- append, but with a list of patterns.
cat :: [Pattern a] -> Pattern a
splitAtSam :: Pattern a -> Pattern a
-- | slowcat does the same as cat, but maintaining the
-- duration of the original patterns. It is the equivalent of
-- append', but with a list of patterns.
slowcat :: [Pattern a] -> Pattern a
-- | listToPat turns the given list of values to a Pattern, which
-- cycles through the list.
listToPat :: [a] -> Pattern a
-- | maybeListToPat is similar to listToPat, but allows
-- values to be optional using the Maybe type, so that
-- Nothing results in gaps in the pattern.
maybeListToPat :: [Maybe a] -> Pattern a
-- | run n returns a pattern representing a cycle of
-- numbers from 0 to n-1.
run :: (Num a, Enum a) => a -> Pattern a
-- | density returns the given pattern with density increased by
-- the given Time factor. Therefore density 2 p will
-- return a pattern that is twice as fast, and density (1%3) p
-- will return one three times as slow.
density :: Time -> Pattern a -> Pattern a
-- | densityGap is similar to density but maintains its
-- cyclic alignment. For example, densityGap 2 p would squash
-- the events in pattern p into the first half of each cycle
-- (and the second halves would be empty).
densityGap :: Time -> Pattern a -> Pattern a
-- | slow does the opposite of density, i.e. slow 2
-- p will return a pattern that is half the speed.
slow :: Time -> Pattern a -> Pattern a
-- | The <~ operator shifts (or rotates) a pattern to the left
-- (or counter-clockwise) by the given Time value. For example
-- (1%16) <~ p will return a pattern with all the events
-- moved one 16th of a cycle to the left.
(<~) :: Time -> Pattern a -> Pattern a
-- | The ~> operator does the same as ~> but shifts
-- events to the right (or clockwise) rather than to the left.
(~>) :: Time -> Pattern a -> Pattern a
brak :: Pattern a -> Pattern a
iter :: Int -> Pattern a -> Pattern a
-- | rev p returns p with the event positions in each
-- cycle reversed (or mirrored).
rev :: Pattern a -> Pattern a
-- | palindrome p applies rev to p every other
-- cycle, so that the pattern alternates between forwards and backwards.
palindrome :: Pattern a -> Pattern a
-- | when test f p applies the function f to p,
-- but in a way which only affects cycles where the test
-- function applied to the cycle number returns True.
when :: (Int -> Bool) -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
-- | every n f p applies the function f to p,
-- but only affects every n cycles.
every :: Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
-- | sig f takes a function from time to values, and turns it into
-- a Pattern.
sig :: (Time -> a) -> Pattern a
-- | sinewave returns a Pattern of continuous
-- Double values following a sinewave with frequency of one
-- cycle, and amplitude from -1 to 1.
sinewave :: Pattern Double
-- | sine is a synonym for @sinewave.
sine :: Pattern Double
-- | sinerat is equivalent to sinewave for
-- Rational values, suitable for use as Time offsets.
sinerat :: Pattern Rational
ratsine :: Pattern Rational
-- | sinewave1 is equivalent to sinewave, but with
-- amplitude from 0 to 1.
sinewave1 :: Pattern Double
-- | sine1 is a synonym for sinewave1.
sine1 :: Pattern Double
-- | sinerat1 is equivalent to sinerat, but with
-- amplitude from 0 to 1.
sinerat1 :: Pattern Rational
-- | sineAmp1 d returns sinewave1 with its amplitude
-- offset by d.
sineAmp1 :: Double -> Pattern Double
-- | sawwave is the equivalent of sinewave for sawtooth
-- waves.
sawwave :: Pattern Double
-- | saw is a synonym for sawwave.
saw :: Pattern Double
-- | sawrat is the same as sawwave but returns
-- Rational values suitable for use as Time offsets.
sawrat :: Pattern Rational
sawwave1 :: Pattern Double
saw1 :: Pattern Double
sawrat1 :: Pattern Rational
-- | triwave is the equivalent of sinewave for triangular
-- waves.
triwave :: Pattern Double
-- | tri is a synonym for triwave.
tri :: Pattern Double
-- | trirat is the same as triwave but returns
-- Rational values suitable for use as Time offsets.
trirat :: Pattern Rational
triwave1 :: Pattern Double
tri1 :: Pattern Double
trirat1 :: Pattern Rational
squarewave1 :: Pattern Double
square1 :: Pattern Double
squarewave :: Pattern Double
square :: Pattern Double
filterOnsets :: Pattern a -> Pattern a
filterStartInRange :: Pattern a -> Pattern a
filterOnsetsInRange :: Pattern a -> Pattern a
seqToRelOnsets :: Arc -> Pattern a -> [(Double, a)]
segment :: Pattern a -> Pattern [a]
segment' :: [Event a] -> [Event a]
split :: Time -> [Event a] -> [Event a]
points :: [Event a] -> [Time]
groupByTime :: [Event a] -> [Event [a]]
ifp :: (Int -> Bool) -> (Pattern a -> Pattern a) -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
rand :: Pattern Double
irand :: Double -> Pattern Int
-- | wedge t p p' combines patterns p and p' by
-- squashing the p into the portion of each cycle given by
-- t, and p' into the remainer of each cycle.
wedge :: Time -> Pattern a -> Pattern a -> Pattern a
instance Monad Pattern
instance Monoid (Pattern a)
instance Applicative Pattern
instance Functor Pattern
instance Show a => Show (Pattern a)
module Sound.Tidal.Parse
class Parseable a
p :: Parseable a => String -> Pattern a
type ColourD = Colour Double
lexer :: GenTokenParser String u Identity
braces :: ParsecT String u Identity a -> ParsecT String u Identity a
brackets :: ParsecT String u Identity a -> ParsecT String u Identity a
parens :: ParsecT String u Identity a -> ParsecT String u Identity a
angles :: ParsecT String u Identity a -> ParsecT String u Identity a
symbol :: String -> ParsecT String u Identity String
natural :: ParsecT String u Identity Integer
integer :: ParsecT String u Identity Integer
float :: ParsecT String u Identity Double
naturalOrFloat :: ParsecT String u Identity (Either Integer Double)
data Sign
Positive :: Sign
Negative :: Sign
applySign :: Num a => Sign -> a -> a
sign :: Parser Sign
intOrFloat :: Parser (Either Integer Double)
r :: Parseable a => String -> Pattern a -> IO (Pattern a)
parseRhythm :: Parser (Pattern a) -> String -> (Pattern a)
pSequenceN :: Parser (Pattern a) -> GenParser Char () (Int, Pattern a)
pSequence :: Parser (Pattern a) -> GenParser Char () (Pattern a)
pSingle :: Parser (Pattern a) -> Parser (Pattern a)
pPart :: Parser (Pattern a) -> Parser ([Pattern a])
pPolyIn :: Parser (Pattern a) -> Parser (Pattern a)
pPolyOut :: Parser (Pattern a) -> Parser (Pattern a)
pString :: Parser (String)
pVocable :: Parser (Pattern String)
pDouble :: Parser (Pattern Double)
pBool :: Parser (Pattern Bool)
pInt :: Parser (Pattern Int)
pColour :: Parser (Pattern ColourD)
pMult :: Pattern a -> Parser (Pattern a)
pReplicate :: Pattern a -> Parser ([Pattern a])
pRatio :: Parser (Rational)
pRational :: Parser (Pattern Rational)
pDensity :: Parser (Rational)
instance [incoherent] Parseable a => IsString (Pattern a)
instance [incoherent] Parseable ColourD
instance [incoherent] Parseable Rational
instance [incoherent] Parseable Int
instance [incoherent] Parseable Bool
instance [incoherent] Parseable String
instance [incoherent] Parseable Double
module Sound.Tidal.Stream
data Param
S :: String -> Maybe String -> Param
name :: Param -> String
sDefault :: Param -> Maybe String
F :: String -> Maybe Double -> Param
name :: Param -> String
fDefault :: Param -> Maybe Double
I :: String -> Maybe Int -> Param
name :: Param -> String
iDefault :: Param -> Maybe Int
data OscShape
OscShape :: String -> [Param] -> Bool -> OscShape
path :: OscShape -> String
params :: OscShape -> [Param]
timestamp :: OscShape -> Bool
type OscMap = Map Param (Maybe Datum)
type OscPattern = Pattern OscMap
latency :: Fractional a => a
defaultDatum :: Param -> Maybe Datum
hasDefault :: Param -> Bool
defaulted :: OscShape -> [Param]
defaultMap :: OscShape -> OscMap
required :: OscShape -> [Param]
hasRequired :: OscShape -> OscMap -> Bool
isSubset :: Eq a => [a] -> [a] -> Bool
tpb :: Num a => a
bpb :: Num a => a
toMessage :: UDP -> OscShape -> Tempo -> Int -> (Double, OscMap) -> Maybe (IO ())
doAt :: RealFrac s => s -> IO () -> IO ()
applyShape' :: OscShape -> OscMap -> Maybe OscMap
start :: String -> Int -> OscShape -> IO (MVar (OscPattern))
stream :: String -> Int -> OscShape -> IO (OscPattern -> IO ())
streamcallback :: (OscPattern -> IO ()) -> String -> Int -> OscShape -> IO (OscPattern -> IO ())
onTick :: UDP -> OscShape -> MVar (OscPattern) -> Tempo -> Int -> IO ()
make :: (a -> Datum) -> OscShape -> String -> Pattern a -> OscPattern
makeS :: OscShape -> String -> Pattern String -> OscPattern
makeF :: OscShape -> String -> Pattern Double -> OscPattern
makeI :: Integral a => OscShape -> String -> Pattern a -> OscPattern
param :: OscShape -> String -> Param
merge :: OscPattern -> OscPattern -> OscPattern
(|+|) :: OscPattern -> OscPattern -> OscPattern
weave :: Rational -> OscPattern -> [OscPattern] -> OscPattern
instance Show Param
instance Ord Param
instance Eq Param
module Sound.Tidal.Dirt
dirt :: OscShape
kriole :: OscShape
dirtstart :: t -> IO (MVar OscPattern)
dirtStream :: IO (OscPattern -> IO ())
dirtstream :: t -> IO (OscPattern -> IO ())
kstream :: t -> IO (OscPattern -> IO ())
doubledirt :: IO (OscPattern -> IO ())
dirtToColour :: OscPattern -> Pattern ColourD
datumToColour :: Datum -> ColourD
stringToColour :: String -> ColourD
sound :: Pattern String -> OscPattern
offset :: Pattern Double -> OscPattern
begin :: Pattern Double -> OscPattern
end :: Pattern Double -> OscPattern
speed :: Pattern Double -> OscPattern
pan :: Pattern Double -> OscPattern
velocity :: Pattern Double -> OscPattern
vowel :: Pattern String -> OscPattern
cutoff :: Pattern Double -> OscPattern
resonance :: Pattern Double -> OscPattern
accelerate :: Pattern Double -> OscPattern
shape :: Pattern Double -> OscPattern
gain :: Pattern Double -> OscPattern
delay :: Pattern Double -> OscPattern
delaytime :: Pattern Double -> OscPattern
delayfeedback :: Pattern Double -> OscPattern
cut :: Pattern Int -> OscPattern
ksymbol :: Pattern Double -> OscPattern
kpitch :: Pattern Double -> OscPattern
pick :: String -> Int -> String
striate :: Int -> OscPattern -> OscPattern
striate' :: Int -> Double -> OscPattern -> OscPattern
striateO :: OscPattern -> Int -> Double -> OscPattern
metronome :: Pattern OscMap
interlace :: OscPattern -> OscPattern -> OscPattern
module Sound.Tidal.Strategies
stutter :: Integral a1 => a1 -> Time -> Pattern a -> Pattern a
echo :: Time -> Pattern a -> Pattern a
triple :: Time -> Pattern a -> Pattern a
quad :: Time -> Pattern a -> Pattern a
double :: Time -> Pattern a -> Pattern a
jux :: (OscPattern -> Pattern OscMap) -> OscPattern -> Pattern OscMap
juxcut :: (OscPattern -> Pattern OscMap) -> OscPattern -> Pattern OscMap
jux4 :: (OscPattern -> Pattern OscMap) -> OscPattern -> Pattern OscMap
superimpose :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
smash :: Int -> [Time] -> OscPattern -> Pattern OscMap
samples :: Applicative f => f String -> f Int -> f String
spread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b
slowspread :: (a -> t -> Pattern b) -> [a] -> t -> Pattern b
spread' :: (a -> Pattern b -> Pattern c) -> Pattern a -> Pattern b -> Pattern c
whenmod :: Int -> Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
trunc :: Time -> Pattern a -> Pattern a
spreadf :: t -> t1 -> [t2 -> Pattern b] -> t2 -> Pattern b
spin :: Int -> OscPattern -> OscPattern
spin4 :: Double -> Pattern OscMap -> Pattern OscMap
spin16 :: Double -> Pattern OscMap -> Pattern OscMap
sawwave4 :: Pattern Double
sinewave4 :: Pattern Double
rand4 :: Pattern Double
stackwith :: Pattern OscMap -> [OscPattern] -> Pattern OscMap
inside :: Time -> (Pattern a1 -> Pattern a) -> Pattern a1 -> Pattern a
stut :: Integer -> Double -> Rational -> OscPattern -> OscPattern
module Sound.Tidal.Context