finish notes chapter

This commit is contained in:
Felix Roos 2023-05-27 21:52:44 +02:00
parent ed792fc0d4
commit 1ba5d2e1ca
4 changed files with 191 additions and 26 deletions

View File

@ -9,54 +9,52 @@ import { MiniRepl } from '../../docs/MiniRepl';
**vowel**
<MiniRepl client:load tune={`sound("drum drum drum drum").vowel("a o")`} />
<MiniRepl hideHeader client:load tune={`sound("drum drum drum drum").vowel("a o")`} />
You can probably think of more vowels :)
**gain**
<MiniRepl client:load tune={`sound("bd hh sn:1 hh sn:1 hh").gain("1 .5 .2")`} />
<MiniRepl hideHeader client:load tune={`sound("bd hh sn:1 hh sn:1 hh").gain("1 .5 .2")`} />
**control the gain with a sine wave**
<MiniRepl client:load tune={`sound("hh*16").gain(sine)`} />
<MiniRepl hideHeader client:load tune={`sound("hh*16").gain(sine)`} />
Try also `saw`, `square`, `tri`
**The 'structure' comes from the left - try swapping:**
<MiniRepl client:load tune={`vowel("a o").sound("drum")`} />
<MiniRepl hideHeader client:load tune={`vowel("a o").sound("drum")`} />
**speed of playback, e.g. 2 = double speed (up 1 octave)**
<MiniRepl client:load tune={`speed("1 2 4").sound("jungbass:6")`} />
<MiniRepl hideHeader client:load tune={`speed("1 2 4").sound("jungbass:6")`} />
<MiniRepl
hideHeader
client:load
tune={`sound("numbers:1 numbers:2 numbers:3 numbers:4")
.speed("1 1.5 2 0.5")
.slow(2)`}
/>
**set note**
<MiniRepl client:load tune={`note("40 43 47").sound("jungbass:6")`} />
**pan**
<MiniRepl
hideHeader
client:load
tune={`sound("numbers:1 numbers:2 numbers:3 numbers:4")
.pan("0 0.3 .6 1")
.slow(2)`}
/>
<MiniRepl client:load tune={`sound("drum*8").pan(sine)`} />
<MiniRepl hideHeader client:load tune={`sound("drum*8").pan(sine)`} />
**delay**
<MiniRepl client:load tune={`sound("bd sd").delay(".5:.1:.4")`} />
<MiniRepl hideHeader client:load tune={`sound("bd sd").delay(".5:.1:.4")`} />
**room**
<MiniRepl client:load tune={`sound("bd sd").room(".5")`} />
<MiniRepl hideHeader client:load tune={`sound("bd sd").room(".5")`} />

View File

@ -190,6 +190,7 @@ Try adding more notes inside the brackets and notice how it does **not** get fas
client:visible
tune={`note("<[36 48]*4 [34 46]*4 [41 53]*4 [39 51]*4>/2")
.sound("gm_acoustic_bass")`}
punchcard
/>
**Alternate between multiple things**
@ -199,6 +200,7 @@ Try adding more notes inside the brackets and notice how it does **not** get fas
client:visible
tune={`note("60 <63 62 65 63>")
.sound("gm_xylophone")`}
punchcard
/>
This is also useful for unpitched sounds:
@ -208,6 +210,7 @@ This is also useful for unpitched sounds:
client:visible
tune={`sound("bd*2, ~ <sd cp>, [~ hh]*2")
.bank("RolandTR909")`}
punchcard
/>
## Scales
@ -219,6 +222,7 @@ Finding the right notes can be difficult.. Scales are here to help:
client:visible
tune={`n("0 2 4 <[6,8] [7,9]>")
.scale("C:minor").sound("piano")`}
punchcard
/>
<Box>
@ -243,23 +247,136 @@ Just like anything, we can automate the scale with a pattern:
<MiniRepl
hideHeader
client:visible
tune={`n("0, 2 4 <[6,8] [7,9]>")
.scale("<C:major F:lydian>/2")
tune={`n("<0 -3>, 2 4 <[6,8] [7,9]>")
.scale("<C:major D:mixolydian>/4")
.sound("piano")`}
punchcard
/>
<Box>
If you have no idea what these scale mean, don't worry.
These are just labels for different sets of notes that go well together.
Take your time and you'll find scales you like!
</Box>
## Repeat & Elongate
**Elongate with @**
<MiniRepl hideHeader client:visible tune={`note("c@3 eb").sound("gm_acoustic_bass")`} punchcard />
<Box>
Not using `@` is like using `@1`. In the above example, c is 3 units long and eb is 1 unit long.
Try changing that number!
</Box>
**Elongate within sub-sequences**
<MiniRepl
hideHeader
client:visible
tune={`n("<[4@2 4] [5@2 5] [6@2 6] [5@2 5]>*2")
.scale("<C2:mixolydian F2:mixolydian>/4")
.sound("gm_acoustic_bass")`}
punchcard
/>
<Box>
This groove is called a `shuffle`.
Each beat has two notes, where the first is twice as long as the second.
This is also sometimes called triplet swing. You'll often find it in blues and jazz.
</Box>
**Replicate**
<MiniRepl hideHeader client:visible tune={`note("c!2 [eb,<g a bb a>]").sound("piano")`} punchcard />
<Box>
Try switching between `!`, `*` and `@`
What's the difference?
</Box>
## Recap
Let's recap what we've learned in this chapter:
| Concept | Syntax | Example |
| --------- | ------ | ------------------------------------------------------------------- |
| Slow down | \/ | <MiniRepl hideHeader client:visible tune={`note("[c a f e]/2")`} /> |
| Alternate | \<\> | <MiniRepl hideHeader client:visible tune={`note("c <e g>")`} /> |
| Elongate | @ | <MiniRepl hideHeader client:visible tune={`note("c@3 e")`} /> |
| Replicate | ! | <MiniRepl hideHeader client:visible tune={`note("c!3 e")`} /> |
## Examples
**Classy Bassline**
<MiniRepl
hideHeader
client:visible
tune={`note("<[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>/2")
.sound("gm_synth_bass_1")`}
.sound("gm_synth_bass_1")
.lpf(800) // <-- we'll learn about this soon`}
/>
**Classy Melody**
<MiniRepl
hideHeader
client:visible
tune={`note("[0 12]*2".add("<36 34 41 39>/2"))
.sound("gm_synth_bass_1")`}
tune={`n(\`<
[~ 0] 2 [0 2] [~ 2]
[~ 0] 1 [0 1] [~ 1]
[~ 0] 3 [0 3] [~ 3]
[~ 0] 2 [0 2] [~ 2]
>*2\`).scale("C4:minor")
.sound("gm_synth_strings_1")`}
/>
**Classy Drums**
<MiniRepl
hideHeader
client:visible
tune={`sound("bd*2, ~ <sd cp>, [~ hh]*2")
.bank("RolandTR909")`}
/>
**If there just was a way to play all the above at the same time.......**
<Box>
It's called `stack` 😙
</Box>
<MiniRepl
hideHeader
client:visible
tune={`stack(
note("<[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>/2")
.sound("gm_synth_bass_1").lpf(800),
n(\`<
[~ 0] 2 [0 2] [~ 2]
[~ 0] 1 [0 1] [~ 1]
[~ 0] 3 [0 3] [~ 3]
[~ 0] 2 [0 2] [~ 2]
>*2\`).scale("C4:minor")
.sound("gm_synth_strings_1"),
sound("bd*2, ~ <sd cp>, [~ hh]*2")
.bank("RolandTR909")
)`}
/>
This is starting to sound like actual music! We have sounds, we have notes, now the last piece of the puzzle is missing: [effects](/workshop/first-effects)

View File

@ -91,7 +91,7 @@ There are a lot more, but let's keep it simple for now
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:4")`} punchcard />
<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.
@ -173,6 +173,18 @@ 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
@ -203,13 +215,18 @@ This is what we've leared so far:
**Basic rock beat**
<MiniRepl hideHeader client:visible tune={`sound("bd sd, hh*4").bank('RolandTR505')`} punchcard />
<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 />
Notice that the house and rock beats are extremely similar. Besides their different tempos and minor differences in the hihat and kick drum lines, these patterns are the same. You'll find certain drum patterns reused in many styles.
<Box>
Notice that the two patterns are extremely similar.
Certain drum patterns are reused across genres.
</Box>
We Will Rock you

View File

@ -67,7 +67,7 @@ d1 $ sound "[[bd bd] bd sn:5] [bd sn:3]"
-- Keep going..
d1 $ sound "[[bd [bd bd bd bd]] bd sn:5] [bd sn:3]"
-- * Polymetric / polyrhythmic sequences
-- \* Polymetric / polyrhythmic sequences
-- Play two subsequences at once by separating with a comma:
@ -87,11 +87,6 @@ d1 $ sound "[bd sn, can:2 can:3 can:1, arpy arpy:1 arpy:2 arpy:3 arpy:5]"
d1 $ sound "{bd sn, can:2 can:3 can:1, arpy arpy:1 arpy:2 arpy:3 arpy:5}"
**Play X per cycle with \{ \}**
<MiniRepl
@ -119,3 +114,41 @@ Try different numbers after `%`
- `[]` squeezes contents to 1 cycle
- `<>` plays one item per cycle
- `{}%x` plays x items per cycle
<MiniRepl
hideHeader
client:visible
tune={`note("[0 12]*2".add("<36 34 41 39>/2"))
.sound("gm_synth_bass_1")`}
/>
vertical
<MiniRepl
hideHeader
client:visible
tune={`n(\`<
<[0,7] [-1,6] [-1,6] [-1,6]>
< 4 4 4 3>
<[2,7] [2,6] [1,6] [1,6]>
< 4 4 4 3>
>*2\`)
.scale("<E:minor>/4")
.sound("piano")`}
/>
horizontal
<MiniRepl
hideHeader
client:visible
tune={`
n(\`<
[0,7] 4 [2,7] 4
[-1,6] 4 [2,6] 4
[-1,6] 4 [1,6] 4
[-1,6] 3 [1,6] 3
>*2\`)
.scale("<E:minor>/4")
.sound("piano")`}
/>