tutorial updates

This commit is contained in:
Jack Armitage 2022-12-25 16:21:18 +00:00
parent 823115c4ec
commit 858f4f74b3
14 changed files with 744 additions and 390 deletions

View file

@ -1,26 +1,49 @@
---
title: Getting Started
description: Strudel Tutorial
description: Strudel Tutorial - Getting Started
layout: ../../layouts/MainLayout.astro
---
import { MiniRepl } from '../../docs/MiniRepl';
import { JsDoc } from '../../docs/JsDoc';
# Welcome
Welcome to the Strudel documentation pages!
These pages will introduce you to [Strudel](https://strudel.tidalcycles.org/), a web-based [live coding](https://github.com/toplap/awesome-livecoding/) environment that implements the [Tidal Cycles](https://tidalcycles.org) algorithmic pattern language.
# What is Strudel?
[Strudel](https://strudel.tidalcycles.org/) is a version of [Tidal Cycles](https://tidalcycles.org) written in [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript), initiated by [Alex McLean](https://slab.org) and [Felix Roos](https://github.com/felixroos) in 2022.
Tidal Cycles, also known as Tidal, is a language for [algorithmic pattern](https://algorithmicpattern.org), and though it is most commonly used for [making music](https://tidalcycles.org/docs/showcase), it can be used for any kind of pattern making activity, including [weaving](https://www.youtube.com/watch?v=TfEmEsusXjU).
Tidal was first implemented as a library written in the [Haskell](https://www.haskell.org/) functional programming language, and by itself it does not make any sound.
To make sound, it has to be connected to a sound engine, and by default this is a [SuperCollider](https://supercollider.github.io/) plugin called [SuperDirt](https://github.com/musikinformatik/SuperDirt/).
As such, it can be difficult for first-time users to install both Tidal Cycles and SuperDirt, as there are many small details to get right.
Strudel however runs directly in your web browser, does not require any custom software installation, and can make sound all by itself.
# Strudel REPL and MiniREPL
The main place to actually make music with Strudel is the [Strudel REPL](https://strudel.tidalcycles.org/) ([what is a REPL?](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)), but in these pages you will also encounter interactive "MiniREPLs" where you can listen to and edit Strudel patterns.
Try clicking the play icon below:
<MiniRepl client:idle tune={`s("bd sn")`}/>
Then edit the text so it reads `s("bd sn cp hh")` and click the refresh icon.
Congratulations, you have now live coded your first Strudel pattern!
With Strudel, you can expressively write dynamic music pieces.
It aims to be [Tidal Cycles](https://tidalcycles.org/) for JavaScript (started by the same author).
You don't need to know JavaScript or Tidal Cycles to make music with Strudel.
This interactive tutorial will guide you through the basics of Strudel.
The best place to actually make music with Strudel is the [Strudel REPL](https://strudel.tidalcycles.org/).
# Show me some demos!
## Show me a Demo
To see and hear what Strudel can do, visit the [Strudel REPL](https://strudel.tidalcycles.org/) and click the Shuffle icon in the top menu bar.
You can get a feel for Strudel by browsing and editing these examples and clicking the Refresh icon to update.
To get a taste of what Strudel can do, check out this track:
Alternatively, you can get a taste of what Strudel can do by clicking play on this track:
<MiniRepl
client:idle
@ -53,93 +76,15 @@ s("bd,[~ <sd!3 sd(3,4,2)>],hh(3,4)") // drums
.slow(3/2)`}
/>
## Disclaimer
# Strudel is a work in progress 🚧
- This project is still in its experimental state. In the future, parts of it might change significantly.
- This tutorial is far from complete.
Please note that this project is still in its experimental state.
In the future, parts of it might change significantly.
This tutorial is also far from complete.
You can contribute to it clicking 'Edit this page' in the top right, or by visiting the [Strudel GitHub page](https://github.com/tidalcycles/strudel/).
# Playing Pitches
# What's next?
Pitches are an essential building block for music. In Strudel, there are 3 different options to express a pitch:
Head on over to the [Notes](/learn/notes) page.
- `note`: letter notation
- `n`: number notation
- `freq`: frequency notation
## note
Notes are notated with the note letter, followed by the octave number. You can notate flats with `b` and sharps with `#`.
<MiniRepl client:only="react" tune={`note("a3 c#4 e4 a4")`} />
By the way, you can edit the contents of the player, and press "update" to hear your change!
You can also press "play" on the next player without needing to stop the last one.
## n
If you don't like notes, you can also use numbers with `n` instead:
<MiniRepl client:only="react" tune={`n("57 61 64 69")`} />
These numbers are interpreted as so called midi numbers, where adjacent whole numbers are 1 semitone apart.
You could also write decimal numbers to get microtonal pitches:
<MiniRepl client:only="react" tune={`n("74.5 75 75.5 76")`} />
## freq
To get maximum freedom, you can also use `freq` to directly control the frequency:
<MiniRepl client:only="react" tune={`freq("220 275 330 440")`} />
In this example, we play A3 (220Hz), C#4 natural (275Hz), E4 (330Hz) and A4 (440Hz).
<br />
# Playing Sounds
Instead of pitches, we can also play sounds with `s`:
<MiniRepl client:only="react" tune={`s("bd hh sd hh")`} />
Similarly, we can also use `s` to change the sound of our pitches:
<MiniRepl client:only="react" tune={`note("a3 c#4 e4 a4").s("sawtooth")`} />
Try changing the sound to `square`, `triangle` or `sine`!
We will go into the defails of sounds and synths [later](/learn/synths-samples-effects).
<br />
# Syntax
So far, we've seen the following syntax:
```
xxx("foo").yyy("bar")
```
Generally, `xxx` and `yyy` are called functions, while `foo` and `bar` are called function arguments.
So far, we've used the functions to declare which aspect of the sound we want to control, and their arguments for the actual data.
The `yyy` function is called a chained function, because it is appended with a dot.
Strudel makes heavy use of chained functions. Here is a more extreme example:
<MiniRepl
client:idle
tune={`note("a3 c#4 e4 a4")
.s("sawtooth")
.cutoff(500)
//.delay(0.5)
.room(0.5)`}
/>
The `//` is a line comment, resulting in the `delay` function being ignored.
It is a handy way to quickly turn stuff on and off. Try uncommenting this line by deleting `//`!
The good news is, that this covers 99% of the JavaScript syntax needed for Strudel!
Let's now look at the way we can express rhythms..
<br />
<br/>