Safe Haskell | None |
---|---|
Language | Haskell2010 |
Sound.Tidal.Control
spin ::PatternInt ->ControlPattern ->ControlPatternSource#
spin
will "spin" and layer up a pattern the given number of times,with each successive layer offset in time by an additional1/n
of a cycle,and panned by an additional1/n
. The result is a pattern that seems to spinaround. This function work well on multichannel systems.
d1 $ slow 3 $ spin 4 $ sound "drum*3 tabla:4 [arpy:2 ~ arpy] [can:2 can:3]"
chop ::PatternInt ->ControlPattern ->ControlPatternSource#
chop
granularises every sample in place as it is played, turning a pattern of samples into a pattern of sample parts. Can be used to explore granular synthesis.
Use an integer value to specify how many granules each sample is chopped into:
d1 $ chop 16 $ sound "arpy arp feel*4 arpy*4"
Different values ofchop
can yield very different results, depending on the samples used:
d1 $ chop 16 $ sound (samples "arpy*8" (run 16))d1 $ chop 32 $ sound (samples "arpy*8" (run 16))d1 $ chop 256 $ sound "bd*4 [sn cp] [hh future]*2 [cp feel]"
You can also usechop
(orstriate
) with very long samples to cut them into short chunks and pattern those chunks. The following cuts a sample into 32 parts, and plays it over 8 cycles:
d1 $ loopAt 8 $ chop 32 $ sound "bev"
TheloopAt
takes care of changing the speed of sample playback so that the sample fits in the given number of cycles perfectly. As a result, in the above the granules line up perfectly, so you can’t really hear that the sample has been cut into bits. Again, this becomes more apparent when you do further manipulations of the pattern, for examplerev
to reverse the order of the cut up bits:
d1 $ loopAt 8 $ rev $ chop 32 $ sound "bev"
striate ::PatternInt ->ControlPattern ->ControlPatternSource#
Striate is a kind of granulator, cutting samples into bits in a similar tochop, but the resulting bits are organised differently. For example:
d1 $ striate 3 $ sound "ho ho:2 ho:3 hc"
This plays the loop the given number of times, but triggers progressive portionsof each sample. So in this case it plays the loop three times, the firsttime playing the first third of each sample, then the second time playing thesecond third of each sample, and lastly playing the last third of each sample.Replacingstriate
withchop
above, one can hear that the 'chop
versionplays the bits from each chopped-up sample in turn, whilestriate
"interlaces"the cut up bits of samples together.
You can also usestriate
with very long samples, to cut them into shortchunks and pattern those chunks. This is where things get towards granularsynthesis. The following cuts a sample into 128 parts, plays it over 8 cyclesand manipulates those parts by reversing and rotating the loops:
d1 $ slow 8 $ striate 128 $ sound "bev"
striateBy ::PatternInt ->PatternDouble ->ControlPattern ->ControlPatternSource#
ThestriateBy
function is a variant ofstriate
with an extraparameter which specifies the length of each part. ThestriateBy
function still scans across the sample over a single cycle, but ifeach bit is longer, it creates a sort of stuttering effect. Forexample the following will cut thebev
sample into 32 parts, but eachwill be 1/16th of a sample long:
d1 $ slow 32 $ striateBy 32 (1/16) $ sound "bev"
Note thatstriate
andstriateBy
use thebegin
andend
parametersinternally. This means that you probably shouldn't also specifybegin
orend
.
striate' ::PatternInt ->PatternDouble ->ControlPattern ->ControlPatternSource#
DEPRECATED, usestriateBy
instead.
weave ::Time ->ControlPattern -> [ControlPattern] ->ControlPatternSource#
weave
applies one control pattern to a list of other control patterns, with a successive time offset. It uses anOscPattern
to apply the function at different levels to each pattern, creating a weaving effect. For example:
d1 $ weave 16 (pan sine) [ sound "bd sn cp" , sound "casio casio:1" , sound "[jvbass*2 jvbass:2]/2" , sound "hc*4" ]
In the above, thepan sine
control pattern is slowed down by the given number of cycles, in particular 16, and applied to all of the given sound patterns. What makes this interesting is that thepan
control pattern is successively offset for each of the given sound patterns; because thepan
is closed down by 16 cycles, and there are four patterns, they are ‘spread out’, i.e. with a gap of four cycles. For this reason, the four patterns seem to chase after each other around the stereo field. Try listening on headphones to hear this more clearly.
You can even have it the other way round, and have the effect parameters chasing after each other around a sound parameter, like this:
d1 $ weave 16 (sound "arpy" >| n (run 8)) [ vowel "a e i" , vowel "i [i o] o u" , vowel "[e o]/3 [i o u]/2" , speed "1 2 3" ]
weaveWith ::Time ->Pattern a -> [Pattern a ->Pattern a] ->Pattern aSource#
weaveWith
is similar to the above, but weaves with a list of functions, rather than a list of controls. For example:
d1 $ weaveWith 3 (sound "bd [sn drum:2*2] bd*2 [sn drum:1]") [ fast 2 , (# speed "0.5") , chop 16 ]
interlace ::ControlPattern ->ControlPattern ->ControlPatternSource#
(A function that takes two ControlPatterns, and blends them together intoa new ControlPattern. An ControlPattern is basically a pattern of messages toa synthesiser.)
Shifts between the two given patterns, using distortion.
Example:
d1 $ interlace (sound "bd sn kurt") (every 3 rev $ sound "bd sn:2")
slice ::PatternInt ->PatternInt ->ControlPattern ->ControlPatternSource#
slice
is similar tochop
andstriate
, in that it’s used to slice samples up into bits. The difference is that it allows you to rearrange those bits as a pattern.
d1 $ slice 8 "7 6 5 4 3 2 1 0" $ sound "breaks165" # legato 1
The above slices the sample into eight bits, and then plays them backwards, equivalent of applying rev $ chop 8. Here’s a more complex example:
d1 $ slice 8 "[<0*8 0*2> 3*4 2 4] [4 .. 7]" $ sound "breaks165" # legato 1
_slice ::Int ->Int ->ControlPattern ->ControlPatternSource#
randslice ::PatternInt ->ControlPattern ->ControlPatternSource#
randslice
chops the sample into the given number of pieces and then plays back a random one each cycle:
d1 $ randslice 32 $ sound "bev"
Usefast
to get more than one per cycle:
d1 $ fast 4 $ randslice 32 $ sound "bev"
splice ::PatternInt ->PatternInt ->ControlPattern ->Pattern (MapStringValue)Source#
splice
is similar toslice
, but the slices are automatically pitched up or down to fit their ‘slot’.
d1 $ splice 8 "[<0*8 0*2> 3*4 2 4] [4 .. 7]" $ sound "breaks165"
loopAt ::PatternTime ->ControlPattern ->ControlPatternSource#
loopAt
makes a sample fit the given number of cycles. Internally, it works by setting theunit
parameter to"c"
, changing the playback speed of the sample with thespeed
parameter, and setting setting thedensity
of the pattern to match.
d1 $ loopAt 4 $ sound "breaks125"
It’s a good idea to use this in conjuction withchop
, so the break is chopped into pieces and you don’t have to wait for the whole sample to start/stop.
d1 $ loopAt 4 $ chop 32 $ sound "breaks125"
Like all Tidal functions, you can mess about with this considerably. The below example shows how you can supply a pattern of cycle counts toloopAt
:
d1 $ juxBy 0.6 (|* speed "2") $ slowspread (loopAt) [4,6,2,3] $ chop 12 $ sound "fm:14"
hurry ::PatternRational ->ControlPattern ->ControlPatternSource#
hurry
is similiar tofast
in that it speeds up a pattern, but it also increases the speed control by the same factor. So, if you’re triggering samples, the sound gets higher in pitch. For example:
d1 $ every 2 (hurry 2) $ sound "bd sn:2 ~ cp"
smash ::PatternInt -> [PatternTime] ->ControlPattern ->PatternValueMapSource#
smash
is a combination ofspread
andstriate
— it cuts the samplesinto the given number of bits, and then cuts between playing the loopat different speeds according to the values in the list. So this:
d1 $ smash 3 [2,3,4] $ sound "ho ho:2 ho:3 hc"
is a bit like this:
d1 $ spread (slow) [2,3,4] $ striate 3 $ sound "ho ho:2 ho:3 hc"
This is quite dancehall:
d1 $ ( spread' slow "1%4 2 1 3" $ spread (striate) [2,3,4,1] $ sound "sn:2 sid:3 cp sid:4" ) # speed "[1 2 1 1]/2"
smash' ::Int -> [PatternTime] ->ControlPattern ->ControlPatternSource#
echo ::PatternInteger ->PatternRational ->PatternDouble ->ControlPattern ->ControlPatternSource#
Applies a type of delay to a pattern. It has three parameters, which could be calleddepth
,time
andfeedback
.depth
is and integer, andtime
andfeedback
are floating point numbers.
This adds a bit of echo:
d1 $ echo 4 0.2 0.5 $ sound "bd sn"
The above results in 4 echos, each one 50% quieter than the last, with 1/5th of a cycle between them.
It is possible to reverse the echo:
d1 $ echo 4 (-0.2) 0.5 $ sound "bd sn"
echoWith ::PatternInt ->PatternTime -> (Pattern a ->Pattern a) ->Pattern a ->Pattern aSource#
echoWith
is similar toecho
, but instead of just decreasing volume to produce echoes,echoWith
applies a function each step and overlays the result delayed by the given time.
d1 $ echoWith 2 "1%3" (# vowel "{a e i o u}%2") $ sound "bd sn"
In this case there are two _overlays_ delayed by 1/3 of a cycle, where each has thevowel
filter applied.
d1 $ echoWith 4 (1/6) (|* speed "1.5") $ sound "arpy arpy:2"
In the above, three versions are put on top, with each step getting higher in pitch as|* speed "1.5"
is successively applied.
stut ::PatternInteger ->PatternDouble ->PatternRational ->ControlPattern ->ControlPatternSource#
DEPRECATED, useecho
instead
stutWith ::PatternInt ->PatternTime -> (Pattern a ->Pattern a) ->Pattern a ->Pattern aSource#
DEPRECATED, useechoWith
instead
stut' ::PatternInt ->PatternTime -> (Pattern a ->Pattern a) ->Pattern a ->Pattern aSource#
DEPRECATED, useechoWith
instead
sec ::Fractional a =>Pattern a ->Pattern aSource#
Turns a pattern of seconds into a pattern of (rational) cycle durations
msec ::Fractional a =>Pattern a ->Pattern aSource#
Turns a pattern of milliseconds into a pattern of (rational) cycle durations, according to the current cps.
trigger ::Pattern a ->Pattern aSource#
Align the start of a pattern with the time a pattern is evaluated, rather than the global start time. Because of this, the pattern will probably not be aligned to the pattern grid.
qtrigger ::Pattern a ->Pattern aSource#
(Aliasqt
) Quantise trigger. Aligns the start of the pattern with the next cycle boundary. For example, this pattern will fade in starting with the next cycle after the pattern is evaluated:
d1 $ qtrigger $ s "hh(5, 8)" # amp envL
Note that the pattern will start playing immediately. Thestart of the pattern aligns with the next cycle boundary, but events will play before if the pattern has events at negative timestamps (which most loops do). These events can be filtered out, for example:
d1 $ qtrigger $ filterWhen (>= 0) $ s "hh(5, 8)"
Alternatively, you can usewait
to achieve the same result:
wait 1 1 $ s "bd hh hh hh"
ctrigger ::Pattern a ->Pattern aSource#
Ceiling trigger. Aligns the start of a pattern to the next cycle boundary, just likeqtrigger
.
rtrigger ::Pattern a ->Pattern aSource#
Rounded trigger. Aligns the start of a pattern to the nearest cycle boundary, either next or previous.
ftrigger ::Pattern a ->Pattern aSource#
Floor trigger. Aligns the start of a pattern to the previous cycle boundary.
mtrigger ::Int ->Pattern a ->Pattern aSource#
(Aliasmt
) Mod trigger. Aligns the start of a pattern to the next cycle boundary where the cycle is evenly divisible by a given number.qtrigger
is equivalent tomtrigger 1
.
In the following example, when activating thed1
pattern, it will start at the same time as the next clap, even if it has to wait for 3 cycles. Once activated, thearpy
sound will play on every cycle, just like any other pattern:
do resetCycles d2 $ every 4 (# s "clap") $ s "bd"
d1 $ mtrigger 4 $ filterWhen (>=0) $ s "arpy"
triggerWith :: (Time ->Time) ->Pattern a ->Pattern aSource#
This aligns the start of a pattern to some value relative to the time the pattern is evaluated. The provided function maps the evaluation time (on the global cycle clock) to a new time, and thentriggerWith
aligns the pattern's start to the time that's returned.
This is a more flexible triggering function. In fact, all the other trigger functions are defined based ontriggerWith
. For example,trigger
is justtriggerWith id
.
In the next example, used1
as a metronome, and play with different values (from 0 to 1) on theconst
expression. You’ll notice how theclap
is displaced from the beginning of each cycle to the end, as the number increases:
d1 $ s "bd hh!3"d2 $ triggerWith (const 0.1) $ s "clap"
This last example is equivalent to this:
d2 $ rotR 0.1 $ s "clap"
Produced byHaddock version 2.30.0