Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Commit

Permalink
more renders
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Mar 12, 2017
1 parent d272843 commit 46a76b2
Show file tree
Hide file tree
Showing 71 changed files with 597 additions and 286 deletions.
3 changes: 3 additions & 0 deletions _functions/combining_parameters/index.md
Expand Up @@ -12,6 +12,7 @@ value of `3` is ignored:
~~~haskell
d1 $ sound "bd sn:2" # speed "3" # speed "2"
~~~
{: .render}

Actually, `#` is shorthand for the `|=|` operator, and there are a few
others which behave a bit differently. For example instead of
Expand All @@ -21,6 +22,7 @@ the following ends up with a value of `5`.
~~~haskell
d1 $ sound "bd sn:2" # speed "3" |+| speed "2"
~~~
{: .render}

There also exists `|*|`, `|/|` and `|-|` operators which multiply,
divide and subtract the values, as you might expect. Here's a pattern
Expand All @@ -29,6 +31,7 @@ which adds values taken from a sine fucntion to a speed pattern:
~~~haskell
d1 $ every 2 (|+| speed sine1) $ sound "bd*2" # speed "1 2"
~~~
{: .render}

The `|+|` `|-|` `|/|` and `|*|` operators only exhibit this behaviour
with numerical pattern parameters.
2 changes: 2 additions & 0 deletions _functions/compositions/append.md
Expand Up @@ -15,10 +15,12 @@ first pattern, within a single cycle.
~~~~haskell
d1 $ append (sound "bd*2 sn") (sound "arpy jvbass*2")
~~~~
{: .render}

`append'` does the same as `append`, but over two cycles, so that
the cycles alternate between the two patterns.

~~~~haskell
d1 $ append' (sound "bd*2 sn") (sound "arpy jvbass*2")
~~~~
{: .render}
7 changes: 7 additions & 0 deletions _functions/compositions/cat.md
Expand Up @@ -13,6 +13,13 @@ will be played so that all patterns can fit into a single cycle. Examples:

~~~~haskell
d1 $ cat [sound "bd*2 sn", sound "arpy jvbass*2"]
~~~
{: .render}
~~~haskell
d1 $ cat [sound "bd*2 sn", sound "arpy jvbass*2", sound "drum*2"]
~~~
{: .render}
~~~haskell
d1 $ cat [sound "bd*2 sn", sound "jvbass*3", sound "drum*2", sound "ht mt"]
~~~~
{: .render}
1 change: 1 addition & 0 deletions _functions/compositions/interlace.md
Expand Up @@ -18,3 +18,4 @@ Example:
~~~~ haskell
d1 $ interlace (sound "bd sn kurt") (every 3 rev $ sound "bd sn:2")
~~~~
{: .render}
1 change: 1 addition & 0 deletions _functions/compositions/randcat.md
Expand Up @@ -13,3 +13,4 @@ patterns in order, picks them at random.
~~~~haskell
d1 $ randcat [sound "bd*2 sn", sound "jvbass*3", sound "drum*2", sound "ht mt"]
~~~~
{: .render}
1 change: 1 addition & 0 deletions _functions/compositions/seqP.md
Expand Up @@ -16,3 +16,4 @@ d1 $ seqP [
(16, 128, sound (samples "arpy*8" (run 16)))
]
~~~~
{: .render}
7 changes: 7 additions & 0 deletions _functions/compositions/slowcat.md
Expand Up @@ -12,6 +12,13 @@ original duration. `slowcat` is similar to `cat`, except that pattern lengths ar

~~~~haskell
d1 $ slowcat [sound "bd*2 sn", sound "arpy jvbass*2"]
~~~
{: .render}
~~~haskell
d1 $ slowcat [sound "bd*2 sn", sound "arpy jvbass*2", sound "drum*2"]
~~~
{: .render}
~~~haskell
d1 $ slowcat [sound "bd*2 sn", sound "jvbass*3", sound "drum*2", sound "ht mt"]
~~~~
{: .render}
2 changes: 1 addition & 1 deletion _functions/compositions/spin.md
Expand Up @@ -12,4 +12,4 @@ spin :: Int n -> Pattern a -> Pattern a
~~~~haskell
d1 $ slow 3 $ spin 4 $ sound "drum*3 tabla:4 [arpy:2 ~ arpy] [can:2 can:3]"
~~~~

{: .render}
2 changes: 2 additions & 0 deletions _functions/compositions/stack.md
Expand Up @@ -17,6 +17,7 @@ d1 $ stack [
sound (samples "arpy*8" (run 16))
]
~~~~
{: .render}

This is useful if you want to use a transform or synth parameter on the entire
stack:
Expand All @@ -28,3 +29,4 @@ d1 $ whenmod 5 3 (striate 3) $ stack [
sound (samples "arpy*8" (run 16))
] # speed "[[1 0.8], [1.5 2]*2]/3"
~~~~
{: .render}
4 changes: 4 additions & 0 deletions _functions/compositions/superimpose.md
Expand Up @@ -12,5 +12,9 @@ resulting in two patterns being played at the same time.

~~~~haskell
d1 $ superimpose (density 2) $ sound "bd sn [cp ht] hh"
~~~
{: .render}
~~~haskell
d1 $ superimpose ((# speed "2") . (0.125 <~)) $ sound "bd sn cp hh"
~~~~
{: .render}
2 changes: 2 additions & 0 deletions _functions/compositions/weave.md
Expand Up @@ -14,9 +14,11 @@ apply the function at different levels to each pattern, creating a weaving effec
~~~~haskell
d1 $ weave 3 (shape $ sine1) [sound "bd [sn drum:2*2] bd*2 [sn drum:1]", sound "arpy*8 ~"]
~~~~
{: .render}

`weave'` is similar in that it blends functions at the same time at different amounts over a pattern:

~~~~haskell
d1 $ weave' 3 (sound "bd [sn drum:2*2] bd*2 [sn drum:1]") [density 2, (# speed "0.5"), chop 16]
~~~~
{: .render}
3 changes: 2 additions & 1 deletion _functions/compositions/wedge.md
Expand Up @@ -14,4 +14,5 @@ remainder of the pattern cycle.

~~~~haskell
d1 $ wedge (1/4) (sound "bd*2 arpy*3 cp sn*2") (sound "odx [feel future]*2 hh hh")
~~~~
~~~~
{: .render}
1 change: 1 addition & 0 deletions _functions/conditional/every.md
Expand Up @@ -14,6 +14,7 @@ Example:
~~~~ haskell
d1 $ every 3 (density 2) $ sound "bd sn kurt"
~~~~
{: .render}

There is a primed variant with an offset

Expand Down
7 changes: 6 additions & 1 deletion _functions/conditional/foldEvery.md
Expand Up @@ -14,7 +14,12 @@ Example:

~~~~ haskell
d1 $ foldEvery [3, 4, 5] (density 2) $ sound "bd sn kurt"
~~~
{: .render}

-- this is equal to:
this is equal to:

~~~haskell
d1 $ every 3 (density 2) $ every 4 (density 2) $ every 5 (density 2) $ sound "bd sn kurt"
~~~~
{: .render}
2 changes: 1 addition & 1 deletion _functions/conditional/ifp.md
Expand Up @@ -15,7 +15,7 @@ d1 $ ifp ((== 0).(flip mod 2))
(# coarse "24 48") $
sound "hh hc"
~~~
{: render-block }
{: .render}

This will apply `striate 4` for every _even_ cycle and aply `# coarse "24 48"` for every _odd_.

Expand Down
6 changes: 3 additions & 3 deletions _functions/conditional/mask.md
Expand Up @@ -14,7 +14,7 @@ Consider this, kind of messy rhythm without any rests.
~~~haskell
d1 $ sound (slowcat ["sn*8", "[cp*4 bd*4, hc*5]"]) # n (run 8)
~~~
{: .render-lines }
{: .render }

If we apply a mask to it

Expand All @@ -23,7 +23,7 @@ d1 $ s (mask ("1 1 1 ~ 1 1 ~ 1" :: Pattern Bool)
(slowcat ["sn*8", "[cp*4 bd*4, bass*5]"] ))
# n (run 8)
~~~
{: .render-block }
{: .render }

Due to the use of `slowcat` here, the same mask is first applied to `"sn*8"` and in the next cycle to `"[cp*4 bd*4, hc*5]".

Expand All @@ -34,7 +34,7 @@ d1 $ s (mask ("1 ~ 1 ~ 1 1 ~ 1" :: Pattern Bool)
(slowcat ["can*8", "[cp*4 sn*4, jvbass*16]"] ))
# n (run 8)
~~~
{: .render-block }
{: .render }

Detail: It is currently needed to explicitly _tell_ Tidal that the mask itself is a `Pattern Bool` as it cannot infer this by itself, otherwise it will complain as it does not know how to interpret your input.

Expand Down
1 change: 1 addition & 0 deletions _functions/conditional/someCyclesBy.md
Expand Up @@ -16,6 +16,7 @@ following code results in `density 2` being applied for about 25% of all cycles:
~~~~ haskell
d1 $ someCyclesBy 0.25 (density 2) $ sound "bd*8"
~~~~
{: .render }

There is an alias as well:

Expand Down
1 change: 1 addition & 0 deletions _functions/conditional/swingBy.md
Expand Up @@ -15,6 +15,7 @@ The end result is a shuffle or swing-like rhythm. For example
~~~~haskell
d1 $ swingBy (1%3) 4 $ sound "hh*8"
~~~~
{: .render }

will delay every other `"hh"` 1/3 of the way to the next `"hh"`.

Expand Down
4 changes: 2 additions & 2 deletions _functions/conditional/when.md
Expand Up @@ -14,6 +14,6 @@ d1 $ when ((elem '4').show)
(striate 4)
$ sound "hh hc"
~~~
{: render-block }
{: .render }

The above will only apply `striate 4` to the pattern if the current cycle number contains the number 4. So the fourth cycle will be striated and the fourteenth and so on. Expect lots of striates after cycle number 399.
The above will only apply `striate 4` to the pattern if the current cycle number contains the number 4. So the fourth cycle will be striated and the fourteenth and so on. Expect lots of striates after cycle number 399.
1 change: 1 addition & 0 deletions _functions/conditional/whenmod.md
Expand Up @@ -18,3 +18,4 @@ as dense:
~~~~ haskell
d1 $ whenmod 8 4 (density 2) (sound "bd sn kurt")
~~~~
{: .render }
2 changes: 2 additions & 0 deletions _functions/conditional/within.md
Expand Up @@ -13,9 +13,11 @@ apply `density 2` to only the first half of a pattern:
~~~~haskell
d1 $ within (0, 0.5) (density 2) $ sound "bd*2 sn lt mt hh hh hh hh"
~~~~
{: .render }

Or, to apply `(# speed "0.5") to only the last quarter of a pattern:

~~~~haskell
d1 $ within (0.75, 1) (# speed "0.5") $ sound "bd*2 sn lt mt hh hh hh hh"
~~~~
{: .render }
3 changes: 2 additions & 1 deletion _functions/operators/index.md
Expand Up @@ -18,7 +18,7 @@ is the same as

~~~~ haskell
speed "3 4 5 6"
~~~~
~~~~

#### `#`, `|=|`
They mean the same thing: they merge *ParamPatterns* together
Expand All @@ -29,6 +29,7 @@ These take a **list** of *ParamPatterns* as their second argument, and merge the
~~~~ haskell
s "bd sn" # "speed "1.2" *** [speed "2", crush "4"]
~~~~
{: .render }
#### `<~`, `~>`
These time-shift the pattern on the RHS by the number of cycles on the LHS.
Expand Down
5 changes: 3 additions & 2 deletions _functions/pattern_transformers/beat_rotation.md
Expand Up @@ -21,6 +21,7 @@ Rotate a loop either to the left or the right.

Example:

~~~~ haskell
~~~haskell
d1 $ every 4 (0.25 <~) $ sound (density 2 "bd sn kurt")
~~~~
~~~
{: .render }
1 change: 1 addition & 0 deletions _functions/pattern_transformers/brak.md
Expand Up @@ -17,3 +17,4 @@ Example:
~~~~ haskell
d1 $ sound (brak "bd sn kurt")
~~~~
{: .render }
6 changes: 5 additions & 1 deletion _functions/pattern_transformers/degrade.md
Expand Up @@ -14,19 +14,22 @@ d1 $ slow 2 $ degrade $ sound "[[[feel:5*8,feel*3] feel:3*8], feel*4]"
# accelerate "-6"
# speed "2"
~~~~
{: .render }

The shorthand syntax for `degrade` is a question mark: `?`. Using `?`
will allow you to randomly remove events from a portion of a pattern:

~~~~ haskell
d1 $ slow 2 $ sound "bd ~ sn bd ~ bd? [sn bd?] ~"
~~~~
{: .render }

You can also use `?` to randomly remove events from entire sub-patterns:

~~~~ haskell
d1 $ slow 2 $ sound "[[[feel:5*8,feel*3] feel:3*8]?, feel*4]"
~~~~
{: .render }

### degradeBy

Expand All @@ -41,4 +44,5 @@ are removed. For example, to remove events 90% of the time:
d1 $ slow 2 $ degradeBy 0.9 $ sound "[[[feel:5*8,feel*3] feel:3*8], feel*4]"
# accelerate "-6"
# speed "2"
~~~~
~~~~
{: .render }
1 change: 1 addition & 0 deletions _functions/pattern_transformers/density.md
Expand Up @@ -15,5 +15,6 @@ cycle), and the vowel pattern three times as fast:
d1 $ sound (density 2 "bd sn kurt")
# density 3 (vowel "a e o")
~~~~
{: .render }

Also, see `slow`.
3 changes: 3 additions & 0 deletions _functions/pattern_transformers/fit.md
Expand Up @@ -12,6 +12,7 @@ The `fit` function takes a pattern of integer numbers, which are used to select
~~~~ haskell
d1 $ sound (fit 3 ["bd", "sn", "arpy", "arpy:1", "casio"] "0 [~ 1] 2 1")
~~~~
{: .render }

The above fits three samples into the pattern, i.e. for the first cycle this will be `"bd"`, `"sn"` and `"arpy"`, giving the result `"bd [~ sn] arpy sn"` (note that we start counting at zero, so that `0` picks the first value). The following cycle the *next* three values in the list will be picked, i.e. `"arpy:1"`, `"casio"` and `"bd"`, giving the pattern `"arpy:1 [~ casio] bd casio"` (note that the list wraps round here).

Expand All @@ -24,6 +25,7 @@ fit' :: Time -> Int -> Pattern Int -> Pattern Int -> Pattern a -> Pattern a
~~~~ haskell
d1 $ sound (fit' 1 2 "0 1" "1 0" "bd sn")
~~~~
{: .render }

So what does this do? The first `1` just tells it to slice up a single cycle of `"bd sn"`. The `2` tells it to select two values each cycle, just like the first argument to `fit`. The next pattern `"0 1"` is the "from" pattern which tells it how to slice, which in this case means `"0"` maps to `"bd"`, and `"1"` maps to `"sn"`. The next pattern `"1 0"` is the "to" pattern, which tells it how to rearrange those slices. So the final result is the pattern `"sn bd"`.

Expand All @@ -32,5 +34,6 @@ A more useful example might be something like
~~~~ haskell
d1 $ fit' 1 4 (run 4) "[0 3*2 2 1 0 3*2 2 [1*8 ~]]/2" $ chop 4 $ (sound "breaks152" # unit "c")
~~~~
{: .render }

which uses `chop` to break a single sample into individual pieces, which `fit'` then puts into a list (using the `run 4` pattern) and reassembles according to the complicated integer pattern.
1 change: 1 addition & 0 deletions _functions/pattern_transformers/iter.md
Expand Up @@ -16,6 +16,7 @@ Example:
~~~~ haskell
d1 $ iter 4 $ sound "bd hh sn cp"
~~~~
{: .render }

This will produce the following over four cycles:

Expand Down
3 changes: 3 additions & 0 deletions _functions/pattern_transformers/jux.md
Expand Up @@ -10,6 +10,7 @@ example, the following reverses the pattern on the righthand side:
~~~~ haskell
d1 $ slow 32 $ jux (rev) $ striate' 32 (1/16) $ sound "bev"
~~~~
{: .render }

When passing pattern transforms to functions like `jux` and `every`,
it's possible to chain multiple transforms together with `.`, for
Expand All @@ -19,6 +20,7 @@ pattern in the righthand channel:
~~~~ haskell
d1 $ slow 32 $ jux ((# speed "0.5") . rev) $ striate' 32 (1/16) $ sound "bev"
~~~~
{: .render }

With `jux`, the original and effected versions of the pattern are
panned hard left and right (i.e., panned at 0 and 1). This can be a
Expand All @@ -29,6 +31,7 @@ centre. For example:
~~~~ haskell
d1 $ juxBy 0.5 (density 2) $ sound "bd sn:1"
~~~~
{: .render }

In the above, the two versions of the pattern would be panned at 0.25
and 0.75, rather than 0 and 1.
1 change: 1 addition & 0 deletions _functions/pattern_transformers/mapping-over.md
Expand Up @@ -14,6 +14,7 @@ from `0` to `0.5` rather than from `0` to `1`, you could do this:
d1 $ sound "bd*2 [bd [sn sn*2 sn] sn]"
# shape ((/ 2) <$> sinewave1)
~~~~
{: .render }

The above applies the function `(/ 2)` (which simply means divide by
two), to all the values inside the `sinewave1` pattern.
1 change: 1 addition & 0 deletions _functions/pattern_transformers/palindrome.md
Expand Up @@ -11,3 +11,4 @@ Example:
~~~~ haskell
d1 $ palindrome $ sound "hh*2 [sn cp] cp future*4"
~~~~
{: .render }
3 changes: 2 additions & 1 deletion _functions/pattern_transformers/rev.md
Expand Up @@ -13,4 +13,5 @@ Examples:

~~~~ haskell
d1 $ every 3 (rev) $ sound (density 2 "bd sn kurt")
~~~~
~~~~
{: .render }
1 change: 1 addition & 0 deletions _functions/pattern_transformers/scramble.md
Expand Up @@ -13,6 +13,7 @@ from the parts. This could also be called "sampling with replacement". For exam
~~~~ haskell
d1 $ sound $ scramble 3 "bd sn hh"
~~~~
{: .render }

will sometimes play `"sn bd hh"` or `"hh sn bd"`, but can also play `"bd sn bd"` or `"hh hh hh"`, because it can make
any random combination of the three parts.
1 change: 1 addition & 0 deletions _functions/pattern_transformers/shuffle.md
Expand Up @@ -13,6 +13,7 @@ random permutation of those parts. This could also be called "sampling without r
~~~~ haskell
d1 $ sound $ shuffle 3 "bd sn hh"
~~~~
{: .render }

will sometimes play `"sn bd hh"` or `"hh sn bd"` or `"hh bd sn"`. But it can **never** play `"hh hh hh"`, because that isn't
a permutation of the three parts.

0 comments on commit 46a76b2

Please sign in to comment.