Safe Haskell | None |
---|---|
Language | Haskell2010 |
Sound.Tidal.Pattern
An event is a value that's active during a timespan. If a whole is present, the part should be equal to or fit inside it.
an Arc and some named control values
Some context for an event, currently just position within sourcecode
GenericContextSource# | |||||
Instance detailsDefined inSound.Tidal.Pattern Associated Types
| |||||
ShowContextSource# | |||||
NFDataContextSource# | |||||
EqContextSource# | |||||
OrdContextSource# | |||||
typeRepContextSource# | |||||
Instance detailsDefined inSound.Tidal.Pattern |
(*>) ::Pattern (a -> b) ->Pattern a ->Pattern binfixl 4Source#
Like*
, but the "wholes" come from the right
(<*) ::Pattern (a -> b) ->Pattern a ->Pattern binfixl 4Source#
Like*
, but the "wholes" come from the left
A datatype representing events taking place over time
IsStringControlPatternSource# | |||||
ApplicativePatternSource# | |||||
FunctorPatternSource# | |||||
MonadPatternSource# | |||||
(Enumerable a,Parseable a) =>IsString (Pattern a)Source# | |||||
Monoid (Pattern a)Source# | |||||
Semigroup (Pattern a)Source# | |||||
Enum a =>Enum (Pattern a)Source# | |||||
Floating a =>Floating (Pattern a)Source# | |||||
Instance detailsDefined inSound.Tidal.Pattern | |||||
RealFloat a =>RealFloat (Pattern a)Source# | |||||
Instance detailsDefined inSound.Tidal.Pattern Methods floatRadix ::Pattern a ->Integer# floatDigits ::Pattern a ->Int# floatRange ::Pattern a -> (Int,Int)# decodeFloat ::Pattern a -> (Integer,Int)# encodeFloat ::Integer ->Int ->Pattern a# significand ::Pattern a ->Pattern a# scaleFloat ::Int ->Pattern a ->Pattern a# isInfinite ::Pattern a ->Bool# isDenormalized ::Pattern a ->Bool# isNegativeZero ::Pattern a ->Bool# | |||||
Generic (Pattern a)Source# | |||||
Instance detailsDefined inSound.Tidal.Pattern Associated Types
| |||||
Num a =>Num (Pattern a)Source# | |||||
Fractional a =>Fractional (Pattern a)Source# | |||||
Integral a =>Integral (Pattern a)Source# | |||||
Instance detailsDefined inSound.Tidal.Pattern | |||||
(Num a,Ord a) =>Real (Pattern a)Source# | |||||
RealFrac a =>RealFrac (Pattern a)Source# | |||||
Show a =>Show (Pattern a)Source# | |||||
NFData a =>NFData (Pattern a)Source# | |||||
Eq (Pattern a)Source# | |||||
Ord a =>Ord (Pattern a)Source# | |||||
Instance detailsDefined inSound.Tidal.Pattern | |||||
Stringy (Pattern a)Source# | |||||
Instance detailsDefined inSound.Tidal.Pattern | |||||
typeRep (Pattern a)Source# | |||||
Instance detailsDefined inSound.Tidal.Pattern |
rev ::Pattern a ->Pattern aSource#
rev p
returnsp
with the event positions in each cycle reversed (or mirrored).
For example rev"1 [~ 2] ~ 3"
is equivalent to rev"3 ~ [2 ~] 1"
.
Note thatrev
reverses on a cycle-by-cycle basis. This means thatrev (slow 2 "1 2 3 4")
would actually result in(slow 2 "2 1 4 3")
. This is because theslow 2
makes the repeating pattern last two cycles, each of which is reversed independently.
In practice rev is generally used with conditionals, for example with every:
d1 $ every 3 rev $ n "0 1 [~ 2] 3" # sound "arpy"
orjux
:
d1 $ jux rev $ n (iter 4 "0 1 [~ 2] 3") # sound "arpy"
(<<*) ::Pattern (a -> b) ->Pattern a ->Pattern binfixl 4Source#
Like*
, but the "wholes" come from the left
applyPatToPat :: (MaybeArc ->MaybeArc ->Maybe (MaybeArc)) ->Pattern (a -> b) ->Pattern a ->Pattern bSource#
wholeOrPart ::Event a ->ArcSource#
filterAnalog ::Pattern a ->Pattern aSource#
filterDigital ::Pattern a ->Pattern aSource#
combineContexts :: [Context] ->ContextSource#
squeezeJoin ::Pattern (Pattern a) ->Pattern aSource#
Likeunwrap
, but cycles of the inner patterns are compressed to fit the timespan of the outer whole (or the original query if it's a continuous pattern?) TODO - what if a continuous pattern contains a discrete one, or vice-versa?
unwrap ::Pattern (Pattern a) ->Pattern aSource#
Turns a pattern of patterns into a single pattern. (this is actuallyjoin
)
1/ For queryarc
, get the events from the outer patternpp
2/ Query the inner pattern using thepart
of the outer 3/ For each inner event, set the whole and part to be the intersection of the outer whole and part, respectively 4 Concatenate all the events together (discarding wholesparts that didn't intersect)
TODO - what if a continuous pattern contains a discrete one, or vice-versa?
innerJoin ::Pattern (Pattern a) ->Pattern aSource#
Turns a pattern of patterns into a single pattern. Likeunwrap
, but structure only comes from the inner pattern.
outerJoin ::Pattern (Pattern a) ->Pattern aSource#
Turns a pattern of patterns into a single pattern. Likeunwrap
, but structure only comes from the outer pattern.
rotR ::Time ->Pattern a ->Pattern aSource#
Shifts a pattern forward in time by the given amount, expressed in cycles. Opposite ofrotL
.
rotL ::Time ->Pattern a ->Pattern aSource#
Shifts a pattern back in time by the given amount, expressed in cycles.
This will skip to the fourth cycle:
do resetCycles d1 $ rotL 4 $ seqP [ (0, 12, sound "bd bd*2") , (4, 12, sound "hh*2 [sn cp] cp future*4") , (8, 12, sound (samples "arpy*8" (run 16))) ]
Useful when building and testing out longer sequences.
applyFIS :: (Double ->Double) -> (Int ->Int) -> (String ->String) ->Value ->ValueSource#
General utilities..
Apply one of three functions to a Value, depending on its type
fNum2 :: (Int ->Int ->Int) -> (Double ->Double ->Double) ->Value ->Value ->ValueSource#
Apply one of two functions to a pair of Values, depending on their types (int or float; strings and rationals are ignored)
Polymorphic values
Constructors
VS | |
VF | |
VN | |
VR | |
VI | |
VB | |
VX | |
VPattern | |
VList | |
VState | |
Fields
|
IsStringControlPatternSource# | |||||
FloatingValueMapSource# | |||||
GenericValueSource# | |||||
Instance detailsDefined inSound.Tidal.Pattern Associated Types
| |||||
NumValueMapSource# | |||||
FractionalValueMapSource# | |||||
ShowValueSource# | |||||
ShowValueMapSource# | |||||
NFDataValueSource# | |||||
EqValueSource# | |||||
OrdValueSource# | |||||
UnionableValueMapSource# | |||||
ModdableValueMapSource# | |||||
Valuable [Value]Source# | |||||
typeRepValueSource# | |||||
Instance detailsDefined inSound.Tidal.Pattern typeRepValue =D1 ('MetaData "Value" "Sound.Tidal.Pattern" "tidal-1.9.5-AigyNDgOVjgLnp8Y8sieF9" 'False) (((C1 ('MetaCons "VS" 'PrefixI 'True) (S1 ('MetaSel ('Just "svalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0String)):+:C1 ('MetaCons "VF" 'PrefixI 'True) (S1 ('MetaSel ('Just "fvalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0Double))):+: (C1 ('MetaCons "VN" 'PrefixI 'True) (S1 ('MetaSel ('Just "nvalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0Note)):+: (C1 ('MetaCons "VR" 'PrefixI 'True) (S1 ('MetaSel ('Just "rvalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0Rational)):+:C1 ('MetaCons "VI" 'PrefixI 'True) (S1 ('MetaSel ('Just "ivalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0Int))))):+: ((C1 ('MetaCons "VB" 'PrefixI 'True) (S1 ('MetaSel ('Just "bvalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0Bool)):+:C1 ('MetaCons "VX" 'PrefixI 'True) (S1 ('MetaSel ('Just "xvalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Word8]))):+: (C1 ('MetaCons "VPattern" 'PrefixI 'True) (S1 ('MetaSel ('Just "pvalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PatternValue))):+: (C1 ('MetaCons "VList" 'PrefixI 'True) (S1 ('MetaSel ('Just "lvalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Value])):+:C1 ('MetaCons "VState" 'PrefixI 'True) (S1 ('MetaSel ('Just "statevalue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ValueMap -> (ValueMap,Value)))))))) |
Note is Double, but with a different parser
DataNoteSource# | |||||
Instance detailsDefined inSound.Tidal.Pattern Methods gfoldl :: (forall d b.Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) ->Note -> cNote# gunfold :: (forall b r.Data b => c (b -> r) -> c r) -> (forall r. r -> c r) ->Constr -> cNote# dataTypeOf ::Note ->DataType# dataCast1 ::Typeable t => (forall d.Data d => c (t d)) ->Maybe (cNote)# dataCast2 ::Typeable t => (forall d e. (Data d,Data e) => c (t d e)) ->Maybe (cNote)# gmapT :: (forall b.Data b => b -> b) ->Note ->Note# gmapQl :: (r -> r' -> r) -> r -> (forall d.Data d => d -> r') ->Note -> r# gmapQr ::forall r r'. (r' -> r -> r) -> r -> (forall d.Data d => d -> r') ->Note -> r# gmapQ :: (forall d.Data d => d -> u) ->Note -> [u]# gmapQi ::Int -> (forall d.Data d => d -> u) ->Note -> u# gmapM ::Monad m => (forall d.Data d => d -> m d) ->Note -> mNote# gmapMp ::MonadPlus m => (forall d.Data d => d -> m d) ->Note -> mNote# gmapMo ::MonadPlus m => (forall d.Data d => d -> m d) ->Note -> mNote# | |||||
EnumNoteSource# | |||||
FloatingNoteSource# | |||||
GenericNoteSource# | |||||
Instance detailsDefined inSound.Tidal.Pattern Associated Types
| |||||
NumNoteSource# | |||||
FractionalNoteSource# | |||||
RealNoteSource# | |||||
RealFracNoteSource# | |||||
ShowNoteSource# | |||||
NFDataNoteSource# | |||||
EqNoteSource# | |||||
OrdNoteSource# | |||||
EnumerableNoteSource# | |||||
ParseableNoteSource# | |||||
ModdableNoteSource# | |||||
ValuableNoteSource# | |||||
typeRepNoteSource# | |||||
Instance detailsDefined inSound.Tidal.Pattern |
splitQueries ::Pattern a ->Pattern aSource#
Splits queries that span cycles. For example `query p (0.5, 1.5)` would be turned into two queries, `(0.5,1)` and `(1,1.5)`, and the results combined. Being able to assume queries don't span cycles often makes transformations easier to specify.
withResultArc :: (Arc ->Arc) ->Pattern a ->Pattern aSource#
Apply a function to the arcs/timespans (both whole and parts) of the result
withResultTime :: (Time ->Time) ->Pattern a ->Pattern aSource#
Apply a function to the time (both start and end of the timespans of both whole and parts) of the result
withQueryArc :: (Arc ->Arc) ->Pattern a ->Pattern aSource#
Apply a function to the timespan of the query
withQueryTime :: (Time ->Time) ->Pattern a ->Pattern aSource#
Apply a function to the time (both start and end) of the query
withQueryControls :: (ValueMap ->ValueMap) ->Pattern a ->Pattern aSource#
Apply a function to the control values of the query
withEvent :: (Event a ->Event b) ->Pattern a ->Pattern bSource#
withEvent f p
returns a newPattern
with each event mapped over functionf
.
withValue :: (a -> b) ->Pattern a ->Pattern bSource#
withEvent f p
returns a newPattern
with each value mapped over functionf
.
withEvents :: ([Event a] -> [Event b]) ->Pattern a ->Pattern bSource#
withEvent f p
returns a newPattern
with f applied to the resulting list of events for each query functionf
.
withPart :: (Arc ->Arc) ->Pattern a ->Pattern aSource#
withPart f p
returns a newPattern
with functionf
applied to the part.
extractI ::String ->ControlPattern ->PatternIntSource#
Extract a pattern of integer values by from a control pattern, given the name of the control
extractF ::String ->ControlPattern ->PatternDoubleSource#
Extract a pattern of floating point values by from a control pattern, given the name of the control
extractS ::String ->ControlPattern ->PatternStringSource#
Extract a pattern of string values by from a control pattern, given the name of the control
extractB ::String ->ControlPattern ->PatternBoolSource#
Extract a pattern of boolean values by from a control pattern, given the name of the control
extractR ::String ->ControlPattern ->PatternRationalSource#
Extract a pattern of rational values by from a control pattern, given the name of the control
extractN ::String ->ControlPattern ->PatternNoteSource#
Extract a pattern of note values by from a control pattern, given the name of the control
fast ::PatternTime ->Pattern a ->Pattern aSource#
Speed up a pattern by the given time pattern.
For example, the following will play the sound pattern"bd sn kurt"
twice asfast (i.e., so it repeats twice per cycle), and the vowel pattern three timesas fast:
d1 $ sound (fast 2 "bd sn kurt") # fast 3 (vowel "a e o")
The first parameter can be patterned to, for example, play the pattern at twicethe speed for the first half of each cycle and then four times the speed for thesecond half:
d1 $ fast "2 4" $ sound "bd sn kurt cp"
fastSqueeze ::PatternTime ->Pattern a ->Pattern aSource#
fastSqueeze
speeds up a pattern by a time pattern given as input, squeezing the resulting pattern inside one cycle and playing the original pattern at every repetition.
To better understand how it works, compare it withfast
:
>>>
print $ fast "1 2" $ s "bd sn"
(0>½)|s: "bd"(½>¾)|s: "bd"(¾>1)|s: "sn"
This will givebd
played in the first half cycle, andbd sn
in the second half. On the other hand, using fastSqueeze;
>>>
print $ fastSqueeze "1 2" $ s "bd sn"
(0>¼)|s: "bd"(¼>½)|s: "sn"(½>⅝)|s: "bd"(⅝>¾)|s: "sn"(¾>⅞)|s: "bd"(⅞>1)|s: "sn"
The original pattern will play in the first half, and two repetitions of the original pattern will play in the second half. That is, every repetition contains the whole pattern.
If the time pattern has a single value, it becomes equivalent tofast
:
d1 $ fastSqueeze 2 $ s "bd sn"d1 $ fast 2 $ s "bd sn"d1 $ s "[bd sn]*2"
slow ::PatternTime ->Pattern a ->Pattern aSource#
Slow down a pattern by the given time pattern.
For example, the following will play the sound pattern"bd sn kurt"
twice as slow (i.e., so it repeats once every two cycles), and the vowel pattern three times as slow:
d1 $ sound (slow 2 "bd sn kurt") # slow 3 (vowel "a e o")
matchManyToOne :: (b -> a ->Bool) ->Pattern a ->Pattern b ->Pattern (Bool, b)Source#
Mark values in the first pattern which match with at least one value in the second pattern.
filterValues :: (a ->Bool) ->Pattern a ->Pattern aSource#
Remove events from patterns that to not meet the given test
filterOnsets ::Pattern a ->Pattern aSource#
tParam3 :: (a -> b -> c ->Pattern d ->Pattern e) ->Pattern a ->Pattern b ->Pattern c ->Pattern d ->Pattern eSource#
Methods
deltaContext ::Int ->Int -> a -> aSource#
defragParts ::Eq a => [Event a] -> [Event a]Source#
Returns a list of events, with any adjacent parts of the same whole combined
isAdjacent ::Eq a =>Event a ->Event a ->BoolSource#
ReturnsTrue
if the two given events are adjacent parts of the same whole
eventValue ::Event a -> aSource#
eventHasOnset ::Event a ->BoolSource#
collectBy ::Eq a => (Event a ->Event a ->Bool) ->Pattern a ->Pattern [a]Source#
collects all events satisfying the same constraint into a list
collect ::Eq a =>Pattern a ->Pattern [a]Source#
collects all events occuring at the exact same time into a list
uncollectEvent ::Event [a] -> [Event a]Source#
uncollectEvents :: [Event [a]] -> [Event a]Source#
uncollect ::Pattern [a] ->Pattern aSource#
merges all values in a list into one pattern by stacking the values
moduleSound.Tidal.Time
Produced byHaddock version 2.30.0