---
title: First Sounds
layout: ../../layouts/MainLayout.astro
---

import { MiniRepl } from '@src/docs/MiniRepl';
import Box from '@components/Box.astro';
import QA from '@components/QA';

# First Sounds

This is the first chapter of the Strudel Workshop, nice to have you on board!

## Code Fields

The workshop is full of interactive code fields. Let's learn how to use those. Here is one:

<MiniRepl hideHeader client:visible tune={`sound("casio")`} dirt />

<Box>

1. ⬆️ click into the text field above ⬆️
2. press `ctrl`+`enter` to play
3. change `casio` to `metal`
4. press `ctrl`+`enter` to update
5. press `ctrl`+`.` to stop

</Box>

Congratulations, you are now live coding!

## Sounds

We have just played a sound with `sound` like this:

<MiniRepl hideHeader client:visible tune={`sound("casio")`} hideHeader />

<Box>

`casio` is one of many standard sounds.

Try out a few other sounds:

```
insect wind jazz metal east crow casio space numbers
```

You might hear a little pause while the sound is loading

</Box>

**Change Sample Number with :**

One Sound can contain multiple samples (audio files).

You can select the sample by appending `:` followed by a number to the name:

<MiniRepl hideHeader client:visible tune={`sound("casio:1")`} hideHeader />

<Box>

Try different sound / sample number combinations.

Not adding a number is like doing `:0`

</Box>

Now you know how to use different sounds.
For now we'll stick to this little selection of sounds, but we'll find out how to load your own sounds later.

## Drum Sounds

By default, Strudel comes with a wide selection of drum sounds:

<MiniRepl hideHeader client:visible tune={`sound("bd hh sd oh")`} hideHeader />

<Box>

These letter combinations stand for different parts of a drum set:

- `bd` = **b**ass **d**rum
- `sd` = **s**nare **d**rum
- `rim` = **rim**shot
- `hh` = **h**i**h**at
- `oh` = **o**pen **h**ihat

Try out different drum sounds!

</Box>

To change the sound character of our drums, we can use `bank` to change the drum machine:

<MiniRepl hideHeader client:visible tune={`sound("bd hh sd oh").bank("RolandTR909")`} hideHeader />

In this example `RolandTR909` is the name of the drum machine that we're using.
It is a famous drum machine for house and techno beats.

<Box>

Try changing `RolandTR909` to one of

- `AkaiLinn`
- `RhythmAce`
- `RolandTR808`
- `RolandTR707`
- `ViscoSpaceDrum`

There are a lot more, but let's keep it simple for now

🦥 Pro-Tip: Mark a name via double click. Then just copy and paste!

</Box>

## Sequences

In the last example, we already saw that you can play multiple sounds in a sequence by separating them with a space:

<MiniRepl hideHeader client:visible tune={`sound("bd hh sd hh")`} punchcard />

Notice how the currently playing sound is highlighted in the code and also visualized below.

<Box>

Try adding more sounds to the sequence!

</Box>

**The longer the sequence, the faster it runs**

<MiniRepl hideHeader client:visible tune={`sound("bd bd hh bd rim bd hh bd")`} punchcard />

The content of a sequence will be squished into what's called a cycle.

**One way to change the tempo is using `cpm`**

<MiniRepl hideHeader client:visible tune={`sound("bd bd hh bd rim bd hh bd").cpm(40)`} punchcard />

<Box>

cpm = cycles per minute

By default, the tempo is 60 cycles per minute = 1 cycle per second.

</Box>

We will look at other ways to change the tempo later!

**Add a rests in a sequence with '~'**

<MiniRepl hideHeader client:visible tune={`sound("bd hh ~ rim")`} punchcard />

**Sub-Sequences with [brackets]**

<MiniRepl hideHeader client:visible tune={`sound("bd [hh hh] sd [hh bd]")`} punchcard />

<Box>

Try adding more sounds inside a bracket!

</Box>

Similar to the whole sequence, the content of a sub-sequence will be squished to the its own length.

**Multiplication: Speed things up**

<MiniRepl hideHeader client:visible tune={`sound("bd hh*2 rim hh*3")`} punchcard />

**Multiplication: Speed up sequences**

<MiniRepl hideHeader client:visible tune={`sound("bd [hh rim]*2")`} punchcard />

**Multiplication: Speeeeeeeeed things up**

<MiniRepl hideHeader client:visible tune={`sound("bd hh*16 rim hh*8")`} punchcard />

<Box>

Pitch = really fast rhythm

</Box>

**Sub-Sub-Sequences with [[brackets]]**

<MiniRepl hideHeader client:visible tune={`sound("bd [[rim rim] hh]")`} punchcard />

<Box>

You can go as deep as you want!

</Box>

**Play sequences in parallel with comma**

<MiniRepl hideHeader client:visible tune={`sound("hh hh hh, bd casio")`} punchcard />

You can use as many commas as you want:

<MiniRepl hideHeader client:visible tune={`sound("hh hh hh, bd bd, ~ casio")`} punchcard />

Commas can also be used inside sub-sequences:

<MiniRepl hideHeader client:visible tune={`sound("hh hh hh, bd [bd,casio]")`} punchcard />

<Box>

Notice how the 2 above are the same?

It is quite common that there are many ways to express the same idea.

</Box>

**Multiple Lines with backticks**

<MiniRepl
  hideHeader
  client:visible
  tune={`sound(\`bd*2, ~ cp, 
~ ~ ~ oh, hh*4,
[~ casio]*2\`)`}
  punchcard
/>

**selecting sample numbers separately**

Instead of using ":", we can also use the `n` function to select sample numbers:

<MiniRepl hideHeader client:visible tune={`n("0 1 [4 2] 3*2").sound("jazz")`} punchcard />

This is shorter and more readable than:

<MiniRepl hideHeader client:visible tune={`sound("jazz:0 jazz:1 [jazz:4 jazz:2] jazz:3*2")`} punchcard />

## Recap

Now we've learned the basics of the so called Mini-Notation, the rhythm language of Tidal.
This is what we've leared so far:

| Concept           | Syntax   | Example                                                                          |
| ----------------- | -------- | -------------------------------------------------------------------------------- |
| Sequence          | space    | <MiniRepl hideHeader client:visible tune={`sound("bd bd sd hh")`} />             |
| Sample Number     | :x       | <MiniRepl hideHeader client:visible tune={`sound("hh:0 hh:1 hh:2 hh:3")`} />     |
| Rests             | ~        | <MiniRepl hideHeader client:visible tune={`sound("metal ~ jazz jazz:1")`} />     |
| Sub-Sequences     | \[\]     | <MiniRepl hideHeader client:visible tune={`sound("bd wind [metal jazz] hh")`} /> |
| Sub-Sub-Sequences | \[\[\]\] | <MiniRepl hideHeader client:visible tune={`sound("bd [metal [jazz sd]]")`} />    |
| Speed up          | \*       | <MiniRepl hideHeader client:visible tune={`sound("bd sd*2 cp*3")`} />            |
| Parallel          | ,        | <MiniRepl hideHeader client:visible tune={`sound("bd*2, hh*2 [hh oh]")`} />      |

The Mini-Notation is usually used inside some function. These are the functions we've seen so far:

| Name  | Description                         | Example                                                                            |
| ----- | ----------------------------------- | ---------------------------------------------------------------------------------- |
| sound | plays the sound of the given name   | <MiniRepl hideHeader client:visible tune={`sound("bd sd")`} />                     |
| bank  | selects the sound bank              | <MiniRepl hideHeader client:visible tune={`sound("bd sd").bank("RolandTR909")`} /> |
| cpm   | sets the tempo in cycles per minute | <MiniRepl hideHeader client:visible tune={`sound("bd sd").cpm(90)`} />             |
| n     | select sample number                | <MiniRepl hideHeader client:visible tune={`n("0 1 4 2").sound("jazz")`} />         |

## Examples

**Basic rock beat**

<MiniRepl hideHeader client:visible tune={`sound("bd sd, hh*4").bank("RolandTR505").cpm(100/2)`} punchcard />

**Classic house**

<MiniRepl hideHeader client:visible tune={`sound("bd*2, ~ cp, [~ hh]*2").bank("RolandTR909")`} punchcard />

<Box>

Notice that the two patterns are extremely similar.
Certain drum patterns are reused across genres.

</Box>

We Will Rock you

<MiniRepl hideHeader client:visible tune={`sound("bd*2 cp").bank("RolandTR707").cpm(81/2)`} punchcard />

**Yellow Magic Orchestra - Firecracker**

<MiniRepl
  hideHeader
  client:visible
  tune={`sound("bd sd, ~ ~ ~ hh ~ hh ~ ~, ~ perc ~ perc:1*2")
.bank("RolandCompurhythm1000")`}
  punchcard
/>

**Imitation of a 16 step sequencer**

<MiniRepl
  hideHeader
  client:visible
  tune={`sound(\`
[~  ~  oh ~ ] [~  ~  ~  ~ ] [~  ~  ~  ~ ] [~  ~  ~  ~ ],
[hh hh ~  ~ ] [hh ~  hh ~ ] [hh ~  hh ~ ] [hh ~  hh ~ ],
[~  ~  ~  ~ ] [cp ~  ~  ~ ] [~  ~  ~  ~ ] [cp ~  ~  ~ ],
[bd ~  ~  ~ ] [~  ~  ~  bd] [~  ~  bd ~ ] [~  ~  ~  bd]
\`).cpm(90/4)`}
  punchcard
/>

**Another one**

<MiniRepl
  hideHeader
  client:visible
  tune={`sound(\`
[~  ~  ~  ~ ] [~  ~  ~  ~ ] [~  ~  ~  ~ ] [~  ~  oh:1 ~ ],
[hh hh hh hh] [hh hh hh hh] [hh hh hh hh] [hh hh ~  ~ ],
[~  ~  ~  ~ ] [cp ~  ~  ~ ] [~  ~  ~  ~ ] [~  cp ~  ~ ],
[bd bd ~  ~ ] [~  ~  bd ~ ] [bd bd ~ bd ] [~  ~  ~  ~ ]
\`).bank("RolandTR808").cpm(88/4)`}
  punchcard
/>

**Not your average drums**

<MiniRepl
  hideHeader
  client:visible
  tune={`s(\`jazz*2, 
insect [crow metal] ~ ~, 
~ space:4 ~ space:1,
~ wind\`)
.cpm(100/2)`}
  punchcard
/>

Now that we know the basics of how to make beats, let's look at how we can play [notes](/workshop/first-notes)
