Tutorial 3: Playing Built-In Samples🔗
FoxDot can also be used to sequence and manipulate audio samples. To do this all you need to do is use the special play SynthDef. The first argument of the play SynthDef should be a string of characters instead of a list of numbers as you would do for any other SynthDef. Each character represents a different audio file, which is stored in a buffer in SuperCollider.
To view which character relates to which audio file, execute
You can play audio samples in the FoxDot/snd/ sub-directories by using the
play Synth and using a string of characters instead of list of notes.
A character refers to a sound and whitespace is used for silence, so you can spread sounds out in time:
You can lace patterns using round brackets
Whick plays like: "x o xo "
The following is the same as "-------="
Putting characters in square brackets will play them all in the space of one beat And will be played like one character, not simultaneous, but in quick succession
d1 >> play("x-o[-o]")
d1 >> play("x-o[---]")
d1 >> play("x-o[-----]")
d1 >> play("x-o[--------------]")
and can be put in round brackets as if they were one character themselves.
You can combine the brackets however you like: the following patterns are identical
Curly braces select a sample sound at random if you want more variety
Angle brackets combine patterns to be play simultaneously
Each character is mapped to a folder of sound files and you can select different samples by using the "sample" keyword argument
d1 >> play("(x[--])xu[--]")
d1 >> play("(x[--])xu[--]", sample=1)
d1 >> play("(x[--])xu[--]", sample=2)
Change the sample for each beat
You can layer two patterns together - note the P, look at tutorial 4 for more information.
And change effects applied to all the layered patterns at the same time
Example from the player tutorial, but with samples instead Conditionals...
Or change it to sample bank 2 by multiplying
Chain multiple conditionals
Which is the same as