Like *, but the "wholes" come from the right
Moduletidal-core-1.10.2Haskell2010
Sound.Tidal.Pattern
- 9 types
- 3 classes
- 122 values
- Packagetidal-core-1.10.2
- Exports134
- LanguageHaskell2010
- LicenceGPL-3.0-only
- SourcePattern.hs
Like *, but the "wholes" come from the left
Like *, but the "wholes" come from the left
General utilities..
Apply one of three functions to a Value, depending on its type
collects all events occuring at the exact same time into a list
collects all events satisfying the same constraint into a list
Returns a list of events, with any adjacent parts of the same whole combined
An alias for fast
Get the timespan of an event's part
Get the onset of an event's whole
Get the offset of an event's part
Extract a pattern of boolean values by from a control pattern, given the name of the control
Extract a pattern of floating point values by from a control pattern, given the name of the control
Extract a pattern of integer values by from a control pattern, given the name of the control
Extract a pattern of note values by from a control pattern, given the name of the control
Extract a pattern of rational values by from a control pattern, given the name of the control
Extract a pattern of string values by from a control pattern, given the name of the control
Apply one of two functions to a pair of Values, depending on their types (int or float; strings and rationals are ignored)
Speed up a pattern by the given time pattern.
For example, the following will play the sound pattern "bd sn kurt" twice as
fast (i.e., so it repeats twice per cycle), and the vowel pattern three times
as 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 twice the speed for the first half of each cycle and then four times the speed for the second half:
d1 $ fast "2 4" $ sound "bd sn kurt cp"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 with fast:
fast "1 2" $ s "bd sn"(0>½)|s: "bd"(½>¾)|s: "bd"(¾>1)|s: "sn"
This will give bd played in the first half cycle, and bd 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 to fast:
d1 $ fastSqueeze 2 $ s "bd sn"
d1 $ fast 2 $ s "bd sn"
d1 $ s "[bd sn]*2"Remove events from patterns that to not meet the given test
Turns a pattern of patterns into a single pattern. Like unwrap,
but structure only comes from the inner pattern.
Returns True if the two given events are adjacent parts of the same whole
Mark values in the first pattern which match with at least one value in the second pattern.
Patterns as numbers
Turns a pattern of patterns into a single pattern. Like unwrap,
but structure only comes from the outer pattern.
rev p returns p with the event positions in each cycle reversed (or
mirrored).
For example rev "1 [~ 2] ~ 3" is equivalent to rev "3 ~ [2 ~] 1".
Note that rev reverses on a cycle-by-cycle basis. This means that rev (slow
2 "1 2 3 4") would actually result in (slow 2 "2 1 4 3"). This is because the
slow 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"or jux:
d1 $ jux rev $ n (iter 4 "0 1 [~ 2] 3") # sound "arpy"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.
Shifts a pattern forward in time by the given amount, expressed in cycles. Opposite of rotL.
Splits a pattern into a list containing the given n number of
patterns. Each one plays every nth cycle, successfully offset by
a cycle.
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")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.
Like unwrap, 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?
TODO - steps
merges all values in a list into one pattern by stacking the values
Turns a pattern of patterns into a single pattern.
(this is actually join)
1/ For query arc, get the events from the outer pattern pp
2/ Query the inner pattern using the part 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?
Get the onset of an event's whole
Get the offset of an event's whole
withEvent f p returns a new Pattern with each event mapped over
function f.
withEvent f p returns a new Pattern with f applied to the resulting list of events for each query
function f.
withPart f p returns a new Pattern with function f applied
to the part.
Apply a function to the timespan of the query
Apply a function to the control values of the query
Apply a function to the time (both start and end) of the query
Apply a function to the arcs/timespans (both whole and parts) of the result
Apply a function to the time (both start and end of the timespans of both whole and parts) of the result
withEvent f p returns a new Pattern with each value mapped over
function f.
Some context for an event, currently just position within sourcecode
Instances6Eq, Ord, Show, Generic, NFData, Rep
Eq ContextDefined in tidal-core-1.10.2 · Sound.Tidal.PatternOrd ContextDefined in tidal-core-1.10.2 · Sound.Tidal.PatternShow ContextDefined in tidal-core-1.10.2 · Sound.Tidal.Show · orphanGeneric ContextDefined in tidal-core-1.10.2 · Sound.Tidal.PatternNFData ContextDefined in tidal-core-1.10.2 · Sound.Tidal.Patterntype Rep Context = D1 ('MetaDataDefined in tidal-core-1.10.2 · Sound.Tidal.Pattern"Context"
"Sound.Tidal.Pattern"
"tidal-core-1.10.2-55VXwrckvBEB569cP16xXM"
'False) (C1 ('MetaCons"Context"
'PrefixI 'True) (S1 ('MetaSel ('Just"contextPosition"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [((Int, Int), (Int, Int))])))
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.
Instances7Functor, Show, Eq, Ord, Generic, NFData, …
Functor (EventF a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternShow a => Show (Event a)Defined in tidal-core-1.10.2 · Sound.Tidal.Show · orphan(Eq a, Eq b) => Eq (EventF a b)Defined in tidal-core-1.10.2 · Sound.Tidal.Pattern(Ord a, Ord b) => Ord (EventF a b)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternGeneric (EventF a b)Defined in tidal-core-1.10.2 · Sound.Tidal.Pattern(NFData a, NFData b) => NFData (EventF a b)Defined in tidal-core-1.10.2 · Sound.Tidal.Patterntype Rep (EventF a b) = D1 ('MetaDataDefined in tidal-core-1.10.2 · Sound.Tidal.Pattern"EventF"
"Sound.Tidal.Pattern"
"tidal-core-1.10.2-55VXwrckvBEB569cP16xXM"
'False) (C1 ('MetaCons"Event"
'PrefixI 'True) ((S1 ('MetaSel ('Just"context"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Context) :*: S1 ('MetaSel ('Just"whole"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))) :*: (S1 ('MetaSel ('Just"part"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just"value"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b))))
Methods
gmod :: a -> a -> a
Instances5Moddable
Moddable RationalDefined in tidal-core-1.10.2 · Sound.Tidal.PatternModdable DoubleDefined in tidal-core-1.10.2 · Sound.Tidal.PatternModdable IntDefined in tidal-core-1.10.2 · Sound.Tidal.PatternModdable NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternModdable ValueMapDefined in tidal-core-1.10.2 · Sound.Tidal.Pattern
Instances17Enum, Eq, Floating, Fractional, Data, Num, …
Enum NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternEq NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternFloating NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternFractional NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternData NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternNum NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternOrd NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternReal NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternRealFrac NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternShow NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternGeneric NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternNFData NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternModdable NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternEnumerable NoteDefined in tidal-core-1.10.2 · Sound.Tidal.ParseBPParseable NoteDefined in tidal-core-1.10.2 · Sound.Tidal.ParseBPValuable NoteDefined in tidal-core-1.10.2 · Sound.Tidal.Patterntype Rep Note = D1 ('MetaDataDefined in tidal-core-1.10.2 · Sound.Tidal.Pattern"Note"
"Sound.Tidal.Pattern"
"tidal-core-1.10.2-55VXwrckvBEB569cP16xXM"
'True) (C1 ('MetaCons"Note"
'PrefixI 'True) (S1 ('MetaSel ('Just"unNote"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))
A datatype representing events taking place over time
Instances22Monad, Functor, Applicative, Enum, Eq, Floating, …
Monad PatternDefined in tidal-core-1.10.2 · Sound.Tidal.PatternFunctor PatternDefined in tidal-core-1.10.2 · Sound.Tidal.PatternIsString ControlPatternDefined in tidal-core-1.10.2 · Sound.Tidal.Simple · orphanApplicative PatternDefined in tidal-core-1.10.2 · Sound.Tidal.PatternEnum a => Enum (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternEq (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternFloating a => Floating (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternFractional a => Fractional (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternIntegral a => Integral (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternNum a => Num (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternOrd a => Ord (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.Pattern(Num a, Ord a) => Real (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternRealFloat a => RealFloat (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternRealFrac a => RealFrac (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternShow a => Show (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.Show · orphan(Enumerable a, Parseable a) => IsString (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.ParseBP · orphanGeneric (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternSemigroup (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternMonoid (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternNFData a => NFData (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.PatternStringy (Pattern a)Defined in tidal-core-1.10.2 · Sound.Tidal.Patterntype Rep (Pattern a) = D1 ('MetaDataDefined in tidal-core-1.10.2 · Sound.Tidal.Pattern"Pattern"
"Sound.Tidal.Pattern"
"tidal-core-1.10.2-55VXwrckvBEB569cP16xXM"
'False) (C1 ('MetaCons"Pattern"
'PrefixI 'True) (S1 ('MetaSel ('Just"query"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (State -> [Event a])) :*: (S1 ('MetaSel ('Just"steps"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Rational)) :*: S1 ('MetaSel ('Just"pureValue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a)))))
Methods
deltaContext :: Int -> Int -> a -> a
Instances8Valuable, …
Valuable StringDefined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable RationalDefined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable BoolDefined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable DoubleDefined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable IntDefined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable NoteDefined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable [Word8]Defined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable [Value]Defined in tidal-core-1.10.2 · Sound.Tidal.Pattern
Polymorphic values
Instances14Eq, Floating, Fractional, Num, Ord, Show, …
Eq ValueDefined in tidal-core-1.10.2 · Sound.Tidal.PatternFloating ValueMapDefined in tidal-core-1.10.2 · Sound.Tidal.PatternFractional ValueMapDefined in tidal-core-1.10.2 · Sound.Tidal.PatternNum ValueMapDefined in tidal-core-1.10.2 · Sound.Tidal.PatternOrd ValueDefined in tidal-core-1.10.2 · Sound.Tidal.PatternShow ValueDefined in tidal-core-1.10.2 · Sound.Tidal.Show · orphanShow ValueMapDefined in tidal-core-1.10.2 · Sound.Tidal.Show · orphanIsString ControlPatternDefined in tidal-core-1.10.2 · Sound.Tidal.Simple · orphanGeneric ValueDefined in tidal-core-1.10.2 · Sound.Tidal.PatternNFData ValueDefined in tidal-core-1.10.2 · Sound.Tidal.PatternUnionable ValueMapDefined in tidal-core-1.10.2 · Sound.Tidal.CoreModdable ValueMapDefined in tidal-core-1.10.2 · Sound.Tidal.PatternValuable [Value]Defined in tidal-core-1.10.2 · Sound.Tidal.Patterntype Rep Value = D1 ('MetaDataDefined in tidal-core-1.10.2 · Sound.Tidal.Pattern"Value"
"Sound.Tidal.Pattern"
"tidal-core-1.10.2-55VXwrckvBEB569cP16xXM"
'False) (((C1 ('MetaCons"VS"
'PrefixI 'True) (S1 ('MetaSel ('Just"svalue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons"VF"
'PrefixI 'True) (S1 ('MetaSel ('Just"fvalue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) :+: (C1 ('MetaCons"VN"
'PrefixI 'True) (S1 ('MetaSel ('Just"nvalue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Note)) :+: (C1 ('MetaCons"VR"
'PrefixI 'True) (S1 ('MetaSel ('Just"rvalue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational)) :+: C1 ('MetaCons"VI"
'PrefixI 'True) (S1 ('MetaSel ('Just"ivalue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))) :+: ((C1 ('MetaCons"VB"
'PrefixI 'True) (S1 ('MetaSel ('Just"bvalue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: 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 (Pattern Value))) :+: (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))))))))
module Sound.Tidal.Time