jevstrudel.git / website / src / pages / learn / notes.mdx
notes.mdx90 lines · 3.0 KB · raw
1---
2title: Notes
3layout: ../../layouts/MainLayout.astro
4---
5
6import { MiniRepl } from '../../docs/MiniRepl';
7import { JsDoc } from '../../docs/JsDoc';
8
9# Notes
10
11Pitches are an important building block in many musical traditions.
12In Strudel, pitches can be expressed as note names, note numbers or frequencies.
13Here's the same pattern written in three different ways:
14
15- `note`: letter notation, good for those who are familiar with western music theory:
16
17  <MiniRepl client:idle tune={`note("a3 c#4 e4 a4")`} />
18
19- `note`: number notation, good for those who want to use recognisable pitches, but don't care about music theory:
20
21  <MiniRepl client:idle tune={`note("57 61 64 69")`} />
22
23- `freq`: frequency notation, good for those who want to go beyond standardised tuning systems:
24
25  <MiniRepl client:idle tune={`freq("220 275 330 440")`} />
26
27Let's look at those in more detail...
28
29## `note` names
30
31Notes names can be notated with the note letter, followed by the octave number. You can notate flats with `b` and sharps with `#`.
32
33<MiniRepl client:idle tune={`note("a3 c#4 e4 a4")`} />
34
35By the way, you can edit the contents of the player, and press "update" to hear your change!
36You can also press "play" on the next player without needing to stop the last one.
37
38## `note` numbers
39
40If you prefer, you can also use numbers with `note` instead:
41
42<MiniRepl client:idle tune={`note("57 61 64 69")`} />
43
44These numbers are interpreted as so called [MIDI numbers](https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies), where adjacent whole numbers are one 'semitone' apart.
45
46You could also write decimal numbers to get 'microtonal' pitches (in between the black and white piano notes):
47
48<MiniRepl client:idle tune={`note("74.5 75 75.5 76")`} />
49
50## `freq`
51
52To get maximum freedom, you can also use `freq` to directly control the frequency:
53
54<MiniRepl client:idle tune={`freq("220 275 330 440")`} />
55
56## Hearing and frequency
57
58In the above example, we play A3 (220Hz), C#4 natural (275Hz), E4 (330Hz) and A4 (440Hz), mirroring our previous examples.
59
60But can you hear the difference between these individual frequencies?
61
62<MiniRepl client:idle tune={`freq("220 221 223 224")`} />
63
64How about these?
65
66<MiniRepl client:idle tune={`freq("2020 2021 2023 2024")`} />
67
68The higher we go up...
69
70<MiniRepl client:idle tune={`freq("5020 5021 5023 5024")`} />
71
72The less distance we can hear between the frequencies!
73
74<MiniRepl client:idle tune={`freq("10020 10021 10023 10024")`} />
75
76Why is this? [Human hearing operates logarithmically](https://www.audiocheck.net/soundtests_nonlinear.php).
77
78## From notes to sounds
79
80In this page, when we played a pattern of notes like this:
81
82<MiniRepl client:idle tune={`note("a3 c#4 e4 a4")`} />
83
84We heard a simple synthesised sound, in fact we heard a [triangle wave oscillator](https://en.wikipedia.org/wiki/Triangle_wave).
85
86This is the default synthesiser used by Strudel, but how do we then make different sounds in Strudel?
87
88Let's find out in the next page on [Sounds](/learn/sounds).
89
90<br />