/ interactive_tutorials / mcmc_sonification
Sign in
interactive_tutorials / mcmc_sonification
mcmc_sonification / app / index.html
124 lines · 4.2 KBCodeBlameHistory
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>Listening to MCMC</title>
7 <link rel="stylesheet" href="style.css">
8</head>
9<body>
10 <header>
11 <div>
12 <h1>Listening for convergence</h1>
13 <p class="eq">
14 <i>p</i>(<i>θ</i>) = ½ 𝒩(<i>θ</i> | <i>m</i><sub>1</sub>, Σ<sub>1</sub>) + ½ 𝒩(<i>θ</i> | <i>m</i><sub>2</sub>, Σ<sub>2</sub>),
15 &nbsp;<i>m</i><sub>1,2</sub> = (∓<i>μ</i>/2, 0)
16 </p>
17 </div>
18 <button id="sound" class="sound-button" aria-pressed="false">
19 <span class="icon" aria-hidden="true">🔇</span>
20 <span class="label">Turn sound on</span>
21 </button>
22 </header>
24 <div class="layout">
25 <aside class="panel">
26 <section class="group">
27 <h2>Target</h2>
28 <select id="preset" aria-label="Target preset"></select>
29 <div id="model-sliders" class="sliders"></div>
30 </section>
32 <section class="group">
33 <h2>Sampler</h2>
34 <select id="sampler" aria-label="Sampler">
35 <option value="rwm">Random-walk Metropolis</option>
36 <option value="mala">Langevin, adjusted (MALA)</option>
37 <option value="ula">Langevin, unadjusted (ULA)</option>
38 <option value="ghmc">Generalized HMC</option>
39 <option value="hmc">HMC</option>
40 </select>
41 <div id="sampler-sliders" class="sliders"></div>
42 <p id="limit" class="note"></p>
43 </section>
45 <section class="group">
46 <h2>Chains</h2>
47 <div id="chain-sliders" class="sliders"></div>
48 <div class="buttons">
49 <button id="run" class="toggle" aria-pressed="false">▶ Run</button>
50 <button id="restart">Restart</button>
51 <button id="skip" title="Run 1000 iterations at once, without sound">+1000</button>
52 </div>
53 <ul id="chain-list" class="chain-list"></ul>
54 </section>
56 <section class="group">
57 <h2>Draws <span id="draws-note" class="note"></span></h2>
58 <table id="stats" class="stats"></table>
59 </section>
61 <section class="group sound">
62 <h2>Sound</h2>
63 <label class="row">
64 <span>Notes from</span>
65 <select id="pitch-map">
66 <option value="value" selected>θ: θ₁ pitch, θ₂ timbre</option>
67 <option value="rank">Rank among all chains' draws</option>
68 </select>
69 </label>
70 <label class="row">
71 <span>Drone</span>
72 <input id="drone" type="range" min="0" max="1" step="0.01" value="0.5">
73 <output></output>
74 </label>
75 <label class="row">
76 <span>Listen back</span>
77 <select id="listen">
78 <option value="off" selected>Off</option>
79 <option value="order">3 s live, then 3 s from halfway back</option>
80 <option value="shuffled">3 s live, then 3 s shuffled from the first half</option>
81 </select>
82 </label>
83 <label class="row">
84 <span>Rejected</span>
85 <select id="rejected">
86 <option value="soft" selected>Repeat the note, softly</option>
87 <option value="silent">Silent</option>
88 </select>
89 </label>
90 <label class="row">
91 <span>Scale</span>
92 <select id="scale"></select>
93 </label>
94 <div class="row">
95 <span>Key</span>
96 <div id="keys" class="keys" role="group" aria-label="Key"></div>
97 </div>
98 <label class="row">
99 <span>Tempo</span>
100 <input id="tempo" type="range" min="0" max="1000" step="1">
101 <output></output>
102 </label>
103 <label class="row">
104 <span>Sustain</span>
105 <input id="sustain" type="range">
106 <output></output>
107 </label>
108 <label class="row">
109 <span>Volume</span>
110 <input id="volume" type="range" min="0" max="1" step="0.01" value="0.6">
111 <output></output>
112 </label>
113 </section>
114 </aside>
116 <div class="plot-wrap">
117 <canvas id="plot"></canvas>
118 <p id="hint" class="hint">Click to start every chain at a point</p>
119 </div>
120 </div>
122 <script type="module" src="main.js"></script>
123</body>
124</html>
↑↓ move↵openescclose