Lesson 10 +10 XP

Tempo & Sample Numbers

Two handy controls: the tempo and choosing sample numbers with n.

Changing tempo with setcpm

setcpm sets the tempo in cycles per minute:

Code

strudel
setcpm(90/4)
sound("<bd hh rim hh>*8")

By default the tempo is 30 cycles per minute = 120/4 = 1 cycle every 2 seconds.

In western music terms, the example above is like 8th notes at 90 bpm in 4/4 - but you don't need to know these terms to make music!

Try different tempos

Code

strudel
setcpm(120/4)
sound("bd hh sd hh")

Lower numbers = slower, higher numbers = faster.

Selecting sample numbers with n

Instead of writing jazz:0 jazz:1 [jazz:4 jazz:2] jazz:3*2, use n for the numbers and sound for the sound:

Code

strudel
n("0 1 [4 2] 3*2").sound("jazz")

This is shorter and more readable!

n separates numbers from the sound

  • n(&quot;0 1 4 2&quot;) gives the sample numbers.
  • .sound(&quot;jazz&quot;) says which sound to play.
  • Change the sound without rewriting every sample number.

TL;DR

  • setcpm(x) sets tempo in cycles per minute.
  • Default is 30 cpm (120/4).
  • n(&quot;0 1 4 2&quot;).sound(&quot;jazz&quot;) picks sample numbers cleanly.
  • n separates the numbers from the sound name.