Shortcuts:
1. In this first example we are using some built in drums to create a simple rhythm.
The
weird notation below, the bd and the sd are often used to abbreviate drums, as in BassDrum and SnareDrum.
Everything within the quotes " " is interpreted as a pattern. The space between each word is there so the program knows how many sounds is in the pattern.
2. Others that we can use per default are cb and hh among others, which stand for CowBell and HiHat. These are common names for the different drums and cymbals of a drum kit:
In this example we have added the brackets ([ ]). They are used for grouping sounds into sub-patterns. All the sounds inside the [ ] will play within the time it takes for one sound outside the [ ] to play.
The .gain( ) command on the end of the line is a useful command. It is used to ajust the volume of what is playing. The regular value, the one that is on by default, is 1. If you set the gain to 0.5, that is the half of the volume, and set to 2 we double the volume. With the gain set to 0.0 makes it silent.
3. There is also the comma (,) which makes sounds play on top of eachother at the same time. Notice the difference between grouping with a space: [hh cb] and grouping with a comma: [bd, hh].
4. There is one more thing. To repeat a sound, you can use the multiplication symbol '*'. Combined with a number '*5' and written close to the name of a sound, it tells the sound to play that many times during its normal duration.
To help visualize this, there is a tool called .pianoroll() that we can use. It makes a graphical representation of the sounds, and it is more easy to see what each of the different sound are doing. It is special in that you need to write .pianoroll({fold: 1}) to make it work, for reasons we won't cover here.