summaryrefslogtreecommitdiff
path: root/index.html
blob: 58dc8516a4be731ab25f784d649fb6206d0e1e18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
<html>
  <head>
    <title>Triangle / Lambdoma</title>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
        overflow: hidden;
        overscroll-behavior: contain;
      }
      body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
          Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
          "Segoe UI Symbol";
        color: white;
        text-shadow: 0 0 1px #000;
        transition: background-color 100ms;
      }
      grid {
        display: block;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
        user-select: none;
      }
      grid * {
        position: absolute;
        cursor: pointer;
        box-sizing: border-box;
      }
      grid > div {
        width: 50px;
        height: 50px;
      }
      grid > div > div {
        width: 20px;
      }
      grid > div > div:nth-child(1) {
        text-align: right;
        top: 5px;
        left: 3px;
      }
      grid > div > div:nth-child(2) {
        text-align: center;
        top: 15px;
        left: 16px;
        opacity: 0.8;
        transform: rotate(20deg);
      }
      grid > div > div:nth-child(3) {
        text-align: left;
        top: 29px;
        left: 28px;
      }
      grid > div.playing {
        border: 2px solid #fff;
        box-shadow: 0 1px 3px #fff;
        z-index: 2;
      }
      grid > div.playing > div {
        margin: -2px -2px;
      }

      #message {
        position: absolute;
        bottom: 0;
        right: 0;
        padding: 0.5rem;
        text-align: right;
        pointer-events: none;
        text-shadow: 0 0 2px #000;
        font-size: 72px;
        z-index: 1234;
      }
      #help {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        padding: 0.5rem;
        z-index: 1;
        transition: opacity 0.2s;
        overflow: scroll;
        opacity: 0;
        pointer-events: none;
      }
      #help.visible {
        opacity: 1;
        pointer-events: auto;
      }
      #help h1,
      #help h2 {
        margin: 0;
        padding: 0;
        margin-bottom: 0.5rem;
      }
      #help h1 {
        font-size: 24px;
      }
      #help h2 {
        font-size: 18px;
        margin-top: 1.5rem;
      }
      #help .content {
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(10px);
        padding: 1rem 1rem 1rem 1.5rem;
        max-width: 600px;
        border-radius: 8px;
        box-shadow: 0 2px #000;
      }
      #help a {
        color: #fff;
      }
      #help ul {
        margin: 0;
        padding: 0;
      }
      #help li {
        margin-left: 1rem;
        padding: 0;
      }
      #help tableContainer {
        display: inline-block;
        border-radius: 8px;
      }
      #help table {
        font-size: 14px;
        padding: 0;
        margin: 0;
        border-spacing: 0;
      }
      #help table td {
        padding: 0.125rem 1rem;
        min-width: 100px;
      }
      #help table td:first-child {
        text-align: right;
        color: #ff8;
      }
      #help table tr:nth-child(even) {
        background: rgba(0, 0, 0, 0.75);
      }
      #help table tr:nth-child(odd) {
        background: rgba(0, 0, 0, 0.25);
      }
      .close {
        position: absolute;
        top: 0;
        right: 0;
        font-size: 16px;
        padding: 1rem;
        font-weight: bold;
        cursor: pointer;
        user-select: none;
      }
      super {
        font-size: 10px;
        position: relative;
        bottom: 5px;
      }
      #help p {
        margin-block-start: 0;
        margin-block-end: 0.75rem;
        line-height: 1.4;
      }
      #help li {
        line-height: 1.4;
      }
      #help-button {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 12345;
        cursor: pointer;
        margin: 0.75rem;
        width: 32px;
        height: 32px;
        display: flex;
        text-align: center;
        align-items: center;
        justify-content: center;
        display: block;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(20px);
        line-height: 0;
        box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
      }
      #help-button span {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        font-weight: bold;
        font-size: 20px;
        height: 100%;
      }
      u {
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <div id="message"></div>
    <div id="help">
      <div class="content">
        <h1>Triangle / Lambdoma</h1>

        <p>
          This instrument uses basic fractions to make a wide palette of just
          intonation intervals available all at once.
        </p>

        <p>
          The rows display the <b>overtone series</b> (1/1, 2/1, 3/1 ...). The
          columns multiply out the <b>undertone series</b> (1/1, 1/2, 1/3, ...).
          The resulting intervals are instantly musically meaningful, though
          they arise from simple ratios.
        </p>

        <p>
          <b>Color</b> indicates position in the octave, with red being the root
          or unison interval 1/1. <b>Brightness</b> indicates octave, with white
          and black tending toward the extremes of human hearing.
        </p>

        <ul>
          <li>
            The default instrument is a Hokema sansula, a type of kalimba.
          </li>
          <li>
            Right-click notes to turn on sine waves matching the interval.
          </li>
          <li>
            Drag-and-drop samples into the window to play with your own sounds.
          </li>
        </ul>

        <h2>keyboard shortcuts</h2>
        <tableContainer
          ><table>
            <tr>
              <td>ESC</td>
              <td>Stop all sound</td>
            </tr>
            <tr>
              <td>ESC ESC</td>
              <td>Return to home position</td>
            </tr>
            <tr>
              <td>?</td>
              <td>Show this help</td>
            </tr>
            <tr>
              <td>+ -</td>
              <td>Change scale</td>
            </tr>
            <tr>
              <td>up<br />down<br />left<br />right</td>
              <td>Scroll the grid</td>
            </tr>
            <tr>
              <td>0-9 a-z</td>
              <td>Keyboard mapped to the top-left 8x8 grid, sorted by pitch</td>
            </tr>
            <tr>
              <td>?</td>
              <td>Toggle this help</td>
            </tr>
            <tr>
              <td>\</td>
              <td>Detect MIDI device (listening on channel 1)</td>
            </tr>
            <tr>
              <td>⇧ +<br />⇧ -</td>
              <td>Change scale root by +/- 1 hz</td>
            </tr>
            <tr>
              <td>⌘⇧ +<br />⌘⇧ -</td>
              <td>Change scale root by +/- 10 hz</td>
            </tr>
            <tr>
              <td>⌘ up<br />⌘⇧ up<br />⌘⇧⌃ up</td>
              <td>Change pitch of sampler by +10 / +1 / -0.1 hz</td>
            </tr>
            <tr>
              <td>⌘ down<br />⌘⇧ down<br />⌘⇧⌃ down</td>
              <td>Change pitch of sampler by -10 / -1 / -0.1 hz</td>
            </tr>
          </table>
        </tableContainer>

        <h2>scales</h2>

        <p>Alternate scales are accessed by pressing the +/- keys:</p>

        <tableContainer>
          <table>
            <tr>
              <td>natural</td>
              <td>Natural numbers: 1, 2, 3 ...</td>
            </tr>
            <tr>
              <td>undertone</td>
              <td>Subharmonic intervals under the line 1/1</td>
            </tr>
            <tr>
              <td>overtone</td>
              <td>Harmonic intervals above the line 1/1</td>
            </tr>
            <tr>
              <td>primes</td>
              <td>Prime numbers only (most dissonant)</td>
            </tr>
            <tr>
              <td>arithmetic</td>
              <td>Multiply all cells by an interval rather than scrolling</td>
            </tr>
            <!--
            <tr>
              <td>equal</td>
              <td>Equal-tempered intervals based on 1:<super>n</super>√2</td>
            </tr>
            -->
            <tr>
              <td>Collatz</td>
              <td>
                <a
                  href="https://en.wikipedia.org/wiki/Collatz_conjecture"
                  target="_blank"
                  >Hailstone numbers</a
                >
                of Lothar Collatz
              </td>
            </tr>
            <tr>
              <td>Pythagorean</td>
              <td>
                <a
                  href="https://en.wikipedia.org/wiki/Pythagorean_interval"
                  target="_blank"
                  >Pythagorean intervals</a
                >
                where each ratio is a power of 2<super>n</super> or 3<super
                  >n</super
                >
              </td>
            </tr>
          </table>
        </tableContainer>

        <h2>about this page</h2>

        <p>
          This webpage was inspired by
          <a href="https://www.youtube.com/watch?v=4pdSYkI86go"
            >Peter Neubäcker</a
          >, inventor of the Melodyne software. In the short biographical
          documentary <i>Wie klingt ein Stein?</i> (<i
            >What does a stone sound like?</i
          >), Neubäcker describes the basic principles of harmonic intervals. He
          first demonstrates how one plays harmonics on a monochord. He then
          shows it next to a grid of whole-number fractions, and demonstrates
          how one can use these ratios to find specific intervals. I had never
          seen just intonation demonstrated so elegantly, so I made this page to
          explore the concept.
        </p>

        <p>
          I later learned that I had constructed the "lamboid diagram" or
          Lambdoma, named for its resemblance to the Greek letter Lambda Λ. The
          synergy of color and tone, linking the octave to the color wheel,
          seemed intuitive, and revealed a beautiful pattern. This pattern had
          previously been uncovered by artist and sound practitioner
          <a href="https://www.lambdoma.com/">Barbara Hero</a>, who built an 8x8
          electronic Lambdoma instrument for sound healing purposes, using the
          same pattern of colors.
        </p>

        <p>
          Hero learned of the Lambdoma from
          <i>Tone: A Study in Musical Acoustics</i> (1968) by
          <a
            href="https://archive.org/details/tonestudyinmusic0000leva/page/n5/mode/2up"
            >Levarie and Levy</a
          >, who trace the Lambdoma back to Pythagoras (ca. 500 BCE) by way of
          the <i>Introduction to Arithmetic</i> by
          <a
            href="https://archive.org/details/nicomachus-introduction-to-arithmetic/page/191/mode/1up"
            >Nicomachus of Gerasa</a
          >
          (ca. 100 BCE) and the <i>Theologumena arithmeticae</i> of
          <a
            href="https://archive.org/details/astius-theologumena-arithmeticae-gr-1817/page/159/mode/1up"
            >Iamblichus</a
          >
          (ca. 300 CE). The Lambdoma is also mentioned by
          <a
            href="https://www.perseus.tufts.edu/hopper/text?doc=Perseus%3Atext%3A2008.01.0385%3Astephpage%3D1027b"
            >Plutarch</a
          >
          (ca. 100 CE) in his commentary on Plato's <i>Timaeus</i>. It was
          <a
            href="https://archive.org/details/bsb10527783/page/137/mode/1up"
            target="_blank"
            >depicted</a
          >
          in the 19th century by Albert von Thimus in the neo-Pythagorean
          treatise
          <i>Die harmonikale Symbolik des Alterthums</i> (1876) which connects
          musical intervals to other harmonic relationships in nature. The
          Lambdoma was also used by mathematician Georg Cantor in his theory of
          transfinite sets (see below). More information can be gleaned from
          Hero's
          <a
            href="https://lambdoma.com/pdfs/the-lambdoma-matrix-and-harmonic-intervals.pdf"
            target="_blank"
            >paper</a
          >, <i>The Lambdoma Matrix and Harmonic Intervals</i> (1999).
        </p>

        <h2>the mathematics of perception</h2>

        <p>
          With the root, fifth, fourth, and octave in the top-left corner, the
          Lambdoma shows how the 3:2 proportion is basic to musical perception.
        </p>

        <p>
          The musical Circle of Fifths, derived from repeatedly stacking the 3:2
          proportion, can be studied in more detail in this program's
          <u id="pythagorean">Pythagorean</u> scale mode, where each ratio is a
          power of 2 or 3. Similar notes can be found by color and compared. One
          can easily hear how stacked fifths overshoot the octave by finding two
          far-apart red notes and playing both at once, which makes them beat
          against each other. This interval is the "syntonic comma" which is
          averaged out in various keyboard tuning systems.
        </p>

        <p>
          Tuning systems must weigh the purity of thirds and fifths. A just
          tuning system made from pure fractions might use as its basis the
          difference between 3:2 and 4:3, which constitutes a semitone. Such a
          scale implies different ratios between "fifths" and "thirds" at
          different points in the scale. Each mode can sound highly distinctive,
          and some intervals may be considered dissonant or harsh.
        </p>

        <p>
          In a sense, 12-tone equal temperament "bends" all of the notes such
          that the fifths are more consisent, making it easier to modulate
          between keys, though other intervals (like thirds) are quite different
          from a interval. This process invokes irrational numbers, and creates
          in-between intervals which do not exist anywhere on the Lambdoma, no
          matter how far out you go. Equal-tempered semitones are separated by a
          ratio of the 12th root of 2 (1:<super>12</super>√2). Irrationals are
          real numbers, and these can only be approximated by fractions made up
          of natural numbers.
        </p>

        <p>
          In the Lambdoma, Barbara Hero also sees the image of Georg Cantor's
          transfinite set of rational numbers ℚ, which Cantor proved countably
          infinite by arranging fractions along two axes by numerator and
          denominator, similar to the Lambdoma. One may easily grasp this
          countable infinity of rationals by considering that, though there are
          infinitely many rational numbers, in between any two there lies an
          uncountable continuity of real numbers in ℝ.
        </p>

        <h2>thank you!</h2>

        <p>
          Sansula samples by Freesound user
          <a
            href="https://freesound.org/people/cabled_mess/packs/21410/"
            target="_blank"
            >cabled_mess</a
          >. Thanks to
          <a href="https://www.nyz.recycled-plastics.net/" target="_blank"
            >Dave Noyze</a
          >
          for telling me about
          <a href="https://www.lambdoma.com/" target="_blank">Barbara Hero</a>.
          Gradient algorithm via
          <a href="https://iquilezles.org/articles/palettes/">Inigo Quizeles</a
          >. Thanks to <a href="https://hems.io/" target="_blank">Hems</a> for
          the support!
        </p>

        <p>Jules LaPlace / <a href="/">asdf.us</a> / 2018-2025</p>
        <div class="close"></div>
      </div>
      <br />
    </div>
    <div id="help-button"><span>?</span></div>
  </body>
  <script src="bundle.js"></script>
</html>