Lesson 22 +10 XP

Fast & Slow with fast()

Earlier we used * to speed patterns up inside strings. There's also a function version.

fast() speeds a pattern up


strudel
sound("bd hh sd hh").fast(2)

fast(2) is like writing *2 inside the string. Try different numbers.

slow() slows a pattern down

slow does the opposite:


strudel
sound("bd hh sd hh").slow(2)

fast and slow are inverses

  • fast(n) makes the pattern n times faster.
  • slow(n) makes the pattern n times slower.

strudel
sound("bd hh sd hh").fast(2).slow(2)

The example above plays at normal speed - they cancel out!

Use them on any pattern


strudel
n("<0 2 4 6>").sound("casio").fast(2)

TL;DR

  • fast(n) speeds a pattern up.
  • slow(n) slows it down.
  • They're inverses: fast(2).slow(2) = original.
  • Function versions of * and /.