Time shorthand
When dealing with time functions, many times we need to specify times shorter than a cycle by using fractions or decimal numbers.
Alternately, we can use textual shorthands to refer to the most common durations.
For example, we can swap 0.25 or 1/4 for the shorthand q, which stands for a quarter of a cycle.
These three examples are equivalent:
d1 $ off 0.25 (|+ n 7) $ n "c e" # sound "supermandolin"d1 $ off (1/4) (|+ n 7) $ n "c e" # sound "supermandolin"d1 $ off "q" (|+ n 7) $ n "c e" # sound "supermandolin"Here’s the current list of shorthands available:
| Fraction | Decimal | Mnemonic | |
|---|---|---|---|
| w | 1 | whole | |
| h | 1/2 | 0.5 | half |
| t | 1/3 | third | |
| q | 1/4 | 0.25 | quarter |
| f | 1/5 | 0.2 | fifth |
| x | 1/6 | sixth | |
| e | 1/8 | 0.125 | eighth |
| s | 1/16 | 0.0624 | sixteenth |
We can prefix these shorthand with a number to have multiples. These two examples sound the same:
d1 $ stack [ s "[bd,co sd bd sd]", pressBy "<0 0.25 0.5 0.75>" $ s "cp" ]
d1 $ stack [ s "[bd,co sd bd sd]", pressBy "<0 q h 3q>" $ s "cp" ]For a 32nd, you could do 0.5s:
d1 $ echo 4 "0.5s" 0.9 $ sound "hh"You can only use these shorthands on any function that receives a Pattern. This will work:
d1 $ s "bd" # delaytime "x" # delay 0.8 # delayfb 0.4But this won’t (as compress needs a Time, not a Pattern Time):
d1 $ compress ("q", "3q") $ s "[bd sn]!" -- ERROR