This week I learned of the stack function, which can layer multiple patterns into one. I applied this to the second sound sample from last week’s blog, which was made up of 3 samples.
d1 $ stack [
sound “[sn[sn sn]] sn” |+|shape sinewave,
every 4 rev $ (sound “bd:2 sn:3*2 cp jvbass”),
foldEvery [2, 4] (|+|up “3”) $ sound (samples’ “arpy” (irand 8))
It’s a much more concise way of layering the patterns when you don’t need to be able to have individual control over their playback. Speaking of which, individual samples can be stopped by using their identifier and silence together. E.g. d1 silence.
Stack also allows modifiers to be applied to all of the samples at once, rather than having to add them individually to d1, d2,..dn.
Density is used to compress a pattern so that it plays a given number of times in one cycle. Density 2 would make the pattern play at twice the speed.
Brak is an interesting effect as it adds a short pause on each second cycle of a pattern and then compresses the first two elements. It’s described as sounding like a breakbeat, but even after some googling I’m not entirely sure what that is.
Finally, anticipateIn is a function which can be used for scheduling. You pass in the number of loops you want to pass by before the pattern changes, and what you want the pattern to change to, and the rest is handled for you. Alternatively, anticipate exists which is the same kind of thing but defaults at 8 cycles.
I’ve used these new features to try to improve the second example track from last week. Soundcloud link and source code are below.
(N.B. anticipate seemed to layer the d1 pattern for reasons I’m not entirely sure of so it doesn’t sound as good as it should)
d1 $ stack [
sound (brak “[sn[sn sn]] sn”) |+|shape sinewave,
every 4 rev $ (density 2 $ sound “bd:2 sn:3*2 cp jvbass”) |+|gain “0.75”,
foldEvery [2, 4] (|+|up “3”) $ sound (samples’ “arpy” (irand 12))
t1 (anticipateIn 16) $ foldEvery [2, 4] (|+|up “3”) $ sound (samples’ “arpy” (irand 12))