In the last section, we introduced how to make very simple patterns and showed a single transformation on them. Now, let’s briefly touch on a couple of quick topics. The first is how to have your patterns vary over time. The second is going to be two small ways to make patterns that have randomness built into them.
To make a pattern change over time you can use the
<> syntax, like in the following example
s "<bd bd*2 bd*4 bd*8 ~>"
which will vary between one, two, four, and eight bass drums, and then none at all in a cycle. It will march around between these on each consecutive cycle, looping back around to the beginning after the silent cycle.
These can also be nested in more complicated patterns like
s "<bd*4 <bd bd*2>>"
which will play like four bass drums then one bass drum then four then two and then the pattern loops back around to the beginning.
Try playing around and seeing how the rhythms of it feel when you put in different variations.
Back to our complementary hi-hats, it’s time to introduce variation in the form of randomness. Enter the following code and try running it.
? symbol in the pattern means that each event in the pattern you’re modifying has a fifty percent chance of being silent, in other words of an equal sized rest being put in its place. So even though there’s no other variation with the angle brackets in this pattern, it’s going to sound different every cycle. Personally what I like to do is use it for creating extra texture in background percussion like hi-hats! We can even combine this with all the tricks we’ve seen so far to get a bass drum pattern that’s also changing with every cycle.
s "<bd*4 bd bd*2> bd*4? bd <bd*2 bd*4?>"
If you play with both of these using
stack, like so,
stack [s "hh27*16?", s "<bd*4 bd bd*2> bd*4? bd <bd*2 bd*4?>"]
you should be able to get something pretty satisfying for just two lines of code and two samples.
Next, we’ll be covering more on how to use samples and even seen what all the samples in Estuary even are!