Merge pull request #356 from tidalcycles/docs

docs: tidal comparison + add global fx + add missing sampler fx
This commit is contained in:
Felix Roos
2023-01-06 22:02:31 +01:00
committed by GitHub
8 changed files with 366 additions and 92 deletions
+3 -2
View File
@@ -48,14 +48,15 @@ export const SIDEBAR: Sidebar = {
{ text: 'Notes', link: 'learn/notes' },
{ text: 'Sounds', link: 'learn/sounds' },
{ text: 'Coding syntax', link: 'learn/code' },
{ text: 'Mini-notation', link: 'learn/mini-notation' },
{ text: 'Mini-Notation', link: 'learn/mini-notation' },
{ text: 'Samples', link: 'learn/samples' },
{ text: 'Synths', link: 'learn/synths' },
{ text: 'Audio effects', link: 'learn/effects' },
{ text: 'Audio Effects', link: 'learn/effects' },
{ text: 'Functions', link: 'learn/functions' },
{ text: 'Signals', link: 'learn/signals' },
{ text: 'Tonal', link: 'learn/tonal' },
{ text: 'MIDI & OSC', link: 'learn/input-output' },
{ text: 'Strudel vs Tidal', link: 'learn/strudel-vs-tidal' },
],
'Technical Manual': [
{ text: 'Patterns', link: 'technical-manual/patterns' },
+12 -12
View File
@@ -1,9 +1,9 @@
h1::before,
h2::before,
h3::before,
h4::before,
h5::before,
h6::before {
.prose h1::before,
.prose h2::before,
.prose h3::before,
.prose h4::before,
.prose h5::before,
.prose h6::before {
display: block;
content: ' ';
margin-top: -70px;
@@ -13,12 +13,12 @@ h6::before {
position: relative;
}
h1:hover .icon-link,
h2:hover .icon-link,
h3:hover .icon-link,
h4:hover .icon-link,
h5:hover .icon-link,
h6:hover .icon-link,
.prose h1:hover .icon-link,
.prose h2:hover .icon-link,
.prose h3:hover .icon-link,
.prose h4:hover .icon-link,
.prose h5:hover .icon-link,
.prose h6:hover .icon-link,
.icon.icon-link:hover {
visibility: visible;
}
+44 -13
View File
@@ -12,54 +12,85 @@ import { JsDoc } from '../../docs/JsDoc';
Wether you're using a synth or a sample, you can apply any of the following built-in audio effects.
As you might suspect, the effects can be chained together, and they accept a pattern string as their argument.
# bandf
## bandf
<JsDoc client:idle name="bandf" h={0} />
# bandq
## bandq
<JsDoc client:idle name="bandq" h={0} />
# coarse
## coarse
<JsDoc client:idle name="coarse" h={0} />
# crush
## crush
<JsDoc client:idle name="crush" h={0} />
# cutoff
## cutoff
<JsDoc client:idle name="cutoff" h={0} />
# gain
## gain
<JsDoc client:idle name="gain" h={0} />
# hcutoff
## hcutoff
<JsDoc client:idle name="hcutoff" h={0} />
# hresonance
## hresonance
<JsDoc client:idle name="hresonance" h={0} />
# pan
## pan
<JsDoc client:idle name="pan" h={0} />
# resonance
## resonance
<JsDoc client:idle name="resonance" h={0} />
# shape
## shape
<JsDoc client:idle name="shape" h={0} />
# velocity
## velocity
<JsDoc client:idle name="velocity" h={0} />
# vowel
## vowel
<JsDoc client:idle name="vowel" h={0} />
# Global Effects
## Local vs Global Effects
While the above listed "local" effects will always create a separate effects chain for each event,
global effects use the same chain for all events of the same orbit:
## orbit
<JsDoc client:idle name="orbit" h={0} />
## delay
<JsDoc client:idle name="delay" h={0} />
## delaytime
<JsDoc client:idle name="delaytime" h={0} />
## delayfeedback
<JsDoc client:idle name="delayfeedback" h={0} />
## room
<JsDoc client:idle name="room" h={0} />
## size / roomsize
<JsDoc client:idle name="size" h={0} />
+7 -1
View File
@@ -217,6 +217,10 @@ Almost everything in Tidal can be patterned using strings!
<JsDoc client:idle name="Pattern.end" h={0} />
### `cut`
<JsDoc client:idle name="cut" h={0} />
### `loopAt`
<JsDoc client:idle name="Pattern.loopAt" h={0} />
@@ -225,4 +229,6 @@ Almost everything in Tidal can be patterned using strings!
<JsDoc client:idle name="Pattern.chop" h={0} />
<br />
### `speed`
<JsDoc client:idle name="speed" h={0} />
@@ -0,0 +1,146 @@
---
title: Strudel vs Tidal
layout: ../../layouts/MainLayout.astro
---
import { MiniRepl } from '../../docs/MiniRepl';
import { JsDoc } from '../../docs/JsDoc';
# Comparing Strudel and Tidal
This page is dedicated to exisiting tidal users, giving an overview of all the differences between Strudel and Tidal.
## Language
Strudel is written in JavaScript, while Tidal is written in Haskell.
### Example
This difference is most obvious when looking at the syntax:
```hs
iter 4 $ every 3 (||+ n "10 20") $ (n "0 1 3") # s "triangle" # crush 4
```
One _could_ express that pattern to Strudel like so:
```txt
iter(4, every(3, add.squeeze("10 20"), n("0 1 3").s("triangle").crush(4)))
```
- The `$` operator does not exist, so the `iter` function has to wrap everything in parens.
- Custom operators like `||+` are explicit function calls, `add.squeeze` in this case
- The `#` operator is replaced with a chained function call `# crush 4` => `.crush(4)`
Unlike Haskell, JavaScript lacks the ability to define custom infix
operators, or change the meaning of existing ones.
Before you discard Strudel as an unwieldy paren monster, look at this alternative way to write the above:
```txt
n("0 1 3").every(3, add.squeeze("10 20")).iter(4).s("triangle").crush(4)
```
By reordering calls, the parens are much less nested.
As a general rule by thumb, you could say that everything Tidal does with `$` is reversed in Strudel:
`iter 4 $ every 3 (||+ n "10 20") $ (n "0 1 3")`
becomes
`n("0 1 3").every(3, add.squeeze("10 20")).iter(4)`
Simply put, `foo x $ bar x` becomes `bar(x).foo(x)`.
### Operators
The [custom operators of tidal](https://tidalcycles.org/docs/reference/pattern_structure/#all-the-operators) are normal functions in strudel:
| function | tidal | strudel |
| ----------- | ------ | ------- |
| add | \|+ n | .add(n) |
| subtract | \|- n | .sub(n) |
| multiply | \|\* n | .mul(n) |
| divide | \|\/ n | .div(n) |
| modulo | \|\% n | .mod(n) |
| left values | \|\< n | .set(n) |
The above list only displays the operators taking the structure comes from the `left`.
For each of those, a `right` and `both` variant also exists.
As this directional thinking only works with code, strudel calls these `in` / `out` / `mix`:
| direction | tidal | strudel |
| --------- | ------- | ----------- |
| left | \|+ n | .add.in(n) |
| right | +\| n | .add.out(n) |
| both | \|+\| n | .add.mix(n) |
Instead of `+` / `add`, you can use any of the available operators of the first list.
## Function Compatibility
[This issue](https://github.com/tidalcycles/strudel/issues/31) tracks which Tidal functions are implemented in Strudel.
The list might not be 100% up to date and probably also misses some functions completely..
Feel encouraged to search the source code for a function you're looking for.
If you find a function that's not on the list, please tell!
## Control Params
As seen in the example, the `#` operator (shorthand for `|>`) is also just a function call in strudel.
So `note "c5" # s "gtr"` becomes `note("c5").s('gtr')`.
[This file](https://github.com/tidalcycles/strudel/blob/main/packages/core/controls.mjs) lists all available control params.
Note that not all of those work in the Webaudio Output of Strudel.
If you find a tidal control that's not on the list, please tell!
## Sound
Tidal is commonly paired with Superdirt / Supercollider for sound generation.
While Strudel also has a way of [communicating with Superdirt](./learn/input-output),
it aims to provide a standalone live coding environment that runs entirely in the browser.
### Audio Effects
Many of SuperDirt's effects have been reimplemented in Strudel, using the Web Audio API.
You can find a [list of available effects here](./learn/effects).
### Sampler
Strudel's sampler supports [a subset](http://127.0.0.1:3000/learn/samples) of Superdirt's sampler.
Also, samples are always loaded from a URL rather than from the disk, although [that might be possible in the future](https://github.com/tidalcycles/strudel/issues/118).
## Evaluation
The Strudel REPL does not support [block based evaluation](https://github.com/tidalcycles/strudel/issues/34) yet.
You can use the following "workaround" to create multiple patterns that can be turned on and off:
```txt
let a = note("c a f e")
let b = s("bd sd")
stack(
a,
// b
)
```
Alternatively, you could write everything as one `stack` and use `.hush()` to silence a pattern:
```txt
stack(
note("c a f e"),
s("bd sd").hush()
)
```
Note that strudel will always use the last statement in your code as the pattern for querying
## Tempo
Strudels tempo is 1 cycle per second, while tidal defaults to `0.5625`.
You can get the same tempo as tidal with:
```txt
note("c a f e").fast(.5625);
```