summaryrefslogtreecommitdiff
path: root/index.html
blob: a6b993fb2e2980a5a67a50d88ddbdaf7756741ee (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
<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%;
      }
    </style>
  </head>
  <body>
    <div id="message"></div>
    <div id="help">
      <div class="content">
        <h1>Triangle / Lambdoma</h1>

        <p>
          This instrument uses 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 ratios, and demonstrates how
          one can use these intervals to find specific ratios. I had never seen
          just intonation demonstrated so elegantly, so I made this page to
          explore the concept interactively.
        </p>

        <p>
          I later learned that I had rediscovered the
          <a href="https://www.lambdoma.com/">Lambdoma</a>, so called by the
          ancient Greeks for its resemblance to the letter Lambda. The synergy
          of color and sound in the Lambdoma, linking the octave to the color
          wheel, had been studied in depth by artist and sound practitioner
          <a href="https://www.lambdoma.com/barbara-hero.html">Barbara Hero</a>.
          Hero made the Lambdoma her life's work, and built an 8x8 electronic
          Lambdoma instrument for sound healing purposes. Hero herself 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
          >, which traces the Lambdoma back to Pythagoras (ca. 500 BCE) via the
          <i>Introduction to Arithmetic</i> by
          <a
            href="https://archive.org/details/nicomachus-introduction-to-arithmetic/page/191/mode/1up"
            >Nichomachus of Gerasa</a
          >
          (ca. 100 BCE). They suggest it has been rediscovered several times,
          including in the 19th century by Albert von Thimus, who
          <a
            href="https://archive.org/details/bsb10527783/page/137/mode/1up"
            target="_blank"
            >depicts it</a
          >
          in
          <i>Die harmonikale Symbolik des Alterthums</i> (1876). More 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>mathematics and perception</h2>

        <p>
          With the root, fifth, and fourth in the top-left corner, the Lambdoma
          shows how the 3:2 proportion is essential to the perception of
          consonance. The musical circle of fifths, derived from these simple
          proportions, can be studied in more detail in this program's
          Pythagorean scale mode. 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 is the "comma" which is
          averaged out in various keyboard tuning systems.
        </p>

        <p>
          Tuning systems must weigh the harmony of pure intervals against
          musical versatility. A Pythagorean tuning system made from pure
          fractions will include many different "fifths" and "thirds" between
          the other notes, which makes each musical key sound highly
          distinctive. Some intervals are extremely dissonant and harsh,
          rendering certain keys unplayable.
        </p>

        <p>
          12-tone equal temperament enables musicians to play in any key by
          bending all of the notes slightly out of tune. This process invokes
          irrational numbers, and creates in-between intervals which do not
          exist anywhere in 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 whole-numbered fractions.
        </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. One may easily grasp this countable infinity of rationals
          by considering that, while there are infinitely many fractions, 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 Barbara Hero. 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>