-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
374 lines (360 loc) · 18.1 KB
/
index.html
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
---
---
{% assign first_black_index = 9 %}
{% comment %} Construct an array of "display notes {% endcomment %}
{%- assign display_notes = "" | split: "" -%}
{%- for color in site.data.chords -%}
{%- assign _notes = "" | split: "" -%}
{%- for _note in color.notes -%}
{%- assign _note_array = _note | split: "" -%}
{%- assign _display_note = "" | split: "" -%}
{%- for char in _note_array -%}
{%- if "0123456789" contains char -%}
{%- continue -%}
{%- endif -%}
{%- assign _display_note = _display_note | push: char -%}
{%- endfor -%}
{%- assign _display_note = _display_note | join: "" -%}
{%- assign _notes = _notes | push: _display_note -%}
{%- endfor -%}
{%- assign _display_note = "" | split: "" -%}
{%- assign _display_note = _display_note | push: color.name -%}
{%- assign _display_note = _display_note | push: _notes -%}
{%- assign display_notes = display_notes | push: _display_note -%}
{%- endfor -%}
<!doctype html>
<html>
<head>
<title>Chord Identification Method Trainer</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta http-equiv="Content-Language" content="en">
<meta name="color-scheme" content="light dark">
<meta name="description" content="This is an implementation of Eguchi's Chord Identification method (paper access can be found via Sci-Hub). See also Ichionkai Music School.
This is a method for teaching absolute pitch to children aged 2-6. Children should practice ~5x per day for 2-3 minutes (about 20-25 identifications). Chords are always identified with colors, and progress in the sequence red (CEG), yellow (CFA), blue (HDG), black (ACF), green (DGH), orange (EGC), purple (FAC), pink (GHD), brown (GCE).">
<link rel="preload" href={{ "assets/fonts/forkawesome-webfont.woff2?v=1.2.0" }}
as="font" type="font/woff2" crossorigin="">
<link rel="stylesheet" href="{{ "assets/css/style.css" }}">
<link rel="shortcut icon" type="image/png" href="{{ "assets/images/favicon.png" }}">
<link rel="manifest" href="{{ "assets/manifest.json" }}">
<style>
{% capture sass_file %}
{% include _note_shapes.scss %}
{% endcapture %}
{{ sass_file | scssify }}
</style>
</head>
<script>
const FIRST_BLACK_INDEX = {{ first_black_index }};
const CHORDS_TONE = {
{%- for color in site.data.chords -%}
"{{ color.name }}": [{%-for chord in color.notes-%}"{{chord}}",{%-endfor-%}],
{%- endfor -%}
};
const UNSORTED_AUDIO_FILES = [
{%- for file in site.static_files -%}
{%- if file.extname == ".mp3" and file.path contains "/static_files/chords" -%}
"{{ file.name }}",
{%- endif -%}
{%- endfor -%}
];
const INSTRUMENT_INFO = {
{%- for instrument in site.data.instruments -%}
{%- assign base_url = 'static_files/samples/' | append: instrument.name -%}
{%- assign instrument_files = site.static_files |
where_exp: "file",
"file.extname == '.mp3' and file.path contains base_url" -%}
"{{instrument.name}}": {
"display_name": "{{instrument.display}}",
"base_url": "{{base_url}}/",
{%- if instrument.legacy -%}
"legacy": true,
"fallback": "{{ instrument.fallback }}",
{%- else -%}
"legacy": false,
"sample_files": {
{%- for file in instrument_files -%}
"{{ file.name | split: 'v' | first }}" : "{{ file.name | replace: '#', '%23' }}",
{%- endfor -%}
},
{%- endif -%}
},
{%- endfor -%}
};
</script>
<script type="module" src="js/vendor/Tone.js"></script>
<script src="js/cim.js"></script>
<script>
function is_ios() {
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
// Disable zoom on iOS 10+ (normally I would be against this, but it's
// causing usability problems)
if (is_ios()) {
document.addEventListener('gesturestart', function (e) {
e.preventDefault();
});
}
</script>
</head>
<body class="colorscheme-dark">
<div class="cim-container">
<div class="menu-container" id="menu-container">
<div class="menu-spacer"></div>
<div class="expansion-container">
<div class="infobox-container">
<a href="#"
id="trainer-infobox-trigger"
class="infobox-trigger"
onclick="toggle_trainer_visibility()">
<i class="fa fa-solid fa-music"></i>
</a>
</div>
<div class="infobox-container">
<a href="#" class="infobox-trigger"
id="i-infobox-trigger"
onclick="toggle_infobox_visibility()">
<i class="fa fa-solid fa-info-circle"></i>
</a>
</div>
<div class="infobox-container">
<a href="#"
id="stats-history-trigger"
class="infobox-trigger"
onclick="toggle_stats_history_visibility()">
<i class="fa fa-solid fa-line-chart"></i>
</a>
</div>
<!-- Profiles -->
<div class="infobox-container">
<div class="trigger-container" id="user-container">
<a href="#"
id="profile-infobox-trigger"
class="infobox-trigger"
onclick="toggle_profile_visibility()">
<i class="fa fa-solid" id="profile-icon"></i>
<span id="profile-text" class="pulldown-target"></span>
</a>
<div class="pulldown infobox" id="profile-container">
<div class="pulldown-item" onclick="open_profile_adder()">
<i class="profile-icon fa fa-solid fa-user-plus"></i><span class="profile-name">Add Profile</span>
</div>
</div>
</div>
</div>
</div>
<div class="hamburger">
<a href="#"
id="hamburger-link"
onclick="toggle_expansion_bar()"
>
<i class="fa fa-bars"></i>
</a>
</div>
</div>
<div class="control-wrapper">
<img src="{{ "assets/images/cim_logo.png" }}" class="logo" onclick="enable_download()"/>
<div class="control-container">
<div class="controls">
<a id="play-button" class="deactivated" onclick="play_audio()">
<i class="fa fa-play" aria-hidden="true"></i>
</a>
<a id="next-chord" class="deactivated" onclick="next_audio()">
<i class="fa fa-arrow-right" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
<div class="flag-container" id="flag-holder">
<div class="flag-spacer"></div>
{%- for color in site.data.chords -%}
<div class="flag-wrapper" id="{{ color.name }}-flag" data-color="{{ color.name}}">
<div class="flag {{ color.name }}" onclick="select_flag(this);">
<i class="answer-icon correct fa"></i>
<i class="answer-icon incorrect fa"></i>
<div class="chord-notes-container chord-{{color.chord | replace: "/", "-"}}">
{%- assign _notes = display_notes
| where_exp: "display", "display.first == color.name"
| first | last -%}
{%- for note in _notes -%}
{%- assign absolute_note = color.notes[forloop.index0]
| replace: "#", "-sharp" -%}
{%- assign note_class = note
| replace: "#", "-sharp"
| replace: "b", "-flat"
| prepend: "note-" -%}
<div class="note-wrapper {{note_class}} note-{{absolute_note}}">
<div class="note"></div>
<div class="note-text">
<span class="note-text-span">{{ note | replace: "#", "♯" | replace: "b", "♭" }}</span>
</div>
</div>
{%- endfor -%}
</div>
</div>
</div>
{%- endfor -%}
<div class="flag-spacer"></div>
</div>
<div class="stats controls" id="stats-container">
<div class="emoji-container">
<span id="reaction-emoji"></span>
</div>
<div class="stats-display">
<div class="num-correct">
<span id="stats-correct">0</span><span id="stats-divider"> / </span><span id="stats-total">0</span>
</div>
<div class="percent">
<span id="stats-percent"></span>
</div>
</div>
<a id="reset-button" onclick="reset_stats()">
<i class="fa fa-refresh" aria-hidden="true"></i>
</a>
</div>
<div class="selectors">
<select class="selector" name="chords" id="chord-selector" onchange="change_selector()">
<optgroup label="White chords">
{%- assign level = 0 -%}
{% for color in site.data.chords %}
{%- assign idx = forloop.index0 | int -%}
{%- if idx == first_black_index -%}
{%- assign level = 1 -%}
</optgroup>
<optgroup label="Black chords">
{%- endif -%}
{%- assign _notes_display = display_notes
| where_exp: "display", "display.first == color.name"
| first | last | join: " " |
replace: "#", "♯" | replace: "b", "♭" -%}
<option value="{{color.name}}"{%-if idx < 1 -%} hidden{%-endif-%}>Level {{level}}: {{color.display}} ({{_notes_display}})</option>
{%- assign level = level | plus: 1 -%}
{% endfor %}
</optgroup>
</select>
<select class="selector" name="instruments" id="instrument-selector" onchange="change_instrument()">
{%- for instrument in site.data.instruments -%}
<option value="{{instrument.name}}">{{instrument.display}}</option>
{%- endfor -%}
</select>
</div>
</div>
<div class="mode-toggle-container">
<a id="mode-toggle" class="colorscheme-toggle"
onclick="toggle_theme_mode()"
>
<i class="fa fa-adjust fa-fw" aria-hidden="true"></i>
</a>
<a id="download-link" class="download-button colorscheme-toggle" onclick="download_state()">
<i class="fa fa-download fa-fw" aria-hidden="true"></i>
</a>
</div>
<!------------------------------------------------------>
<!---------------------- Modals ---------------------->
<!------------------------------------------------------>
<!-- Infobox -->
<div class="infobox" id="i-infobox">
<p>This is an implementation of <a href="http://pom.sagepub.com/content/42/1/86">Eguchi's Chord Identification method</a> (paper access can be found via <a href="https://en.wikipedia.org/wiki/Sci-Hub">Sci-Hub</a>). See also <a href="https://ichionkai.co.jp/english3.html">Ichionkai Music School</a>.</p>
<p><a href="https://youtu.be/kNfkm6PQC20">Here is a short video explaining how we use it</a>.</p>
<p>This is a method for teaching absolute pitch to children aged 2-6. Children should practice ~5x per day for 2-3 minutes (about 20-25 identifications). Chords are always identified with colors, and progress in the sequence <span onclick="trigger_easter_egg()">red</span> (CEG), yellow (CFA), blue (HDG), black (ACF), green (DGH), orange (EGC), purple (FAC), pink (GHD), brown (GCE).</p>
<p>Introduce the chords to the children one at a time, spacing out new chord introductions by at least 2 weeks each time. Do not introduce a new chord until the child can identify all presented chords with 100% accuracy.</p>
<p><b>Note</b>: This application is an early alpha. I'm still in the first training phase so I've put off work on the later parts of the method until my son catches up. Let me know if you need a feature to make this work, of if it seems that I've misunderstood the method as described in the paper. Please feel free to make pull requests or report issues on <a href="https://github.com/pganssle/cim">the GitHub repository</a>.</p>
</div>
<!-- Music player -->
<div class="infobox" id="trainer-infobox">
<div class="box-title">
Music Trainer: Play the chords manually
</div>
<div class="trainer-container">
{%- for color in site.data.chords -%}
<div class="flag-wrapper trainer visible">
<div class="flag trainer {{color.name}}" onclick="play_chord('{{color.name}}');"></div>
</div>
{%- endfor -%}
</div>
</div>
<!-- Statistics -->
<div class="infobox stats-history-container" id="stats-history-container"></div>
<!-- "Add profile" / "Profile settings" dialog -->
<div class="profile-info-container" id="profile-info-container">
<span class="close-button" id="close-add-profile-container-button" onclick="close_profile_adder()">×</span>
<div class="entry-row">
<label for="profile_name">Profile Name:</label>
<input type="text" id="profile_name_setting" class="entry">
</div>
<div class="entry-row">
<label for="profile_icon_selector">Icon:</label>
<input type="radio" name="profile_icon_selector"
value="fa-user" id="npis-user">
<label for="npis-user"><i class="fa fa-solid fa-user"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-truck" id="npis-truck">
<label for="npis-truck"><i class="fa fa-solid fa-truck"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-bolt" id="npis-bolt">
<label for="npis-bolt"><i class="fa fa-solid fa-bolt"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-paw" id="npis-paw">
<label for="npis-paw"><i class="fa fa-solid fa-paw"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-soccer-ball-o" id="npis-soccer-ball">
<label for="npis-paw"><i class="fa fa-solid fa-soccer-ball-o"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-smile-o" id="npis-smile-o">
<label for="npis-smile-o"><i class="fa fa-solid fa-smile-o"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-umbrella" id="npis-umbrella">
<label for="npis-umbrella"><i class="fa fa-solid fa-umbrella"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-trophy" id="npis-trophy">
<label for="npis-trophy"><i class="fa fa-solid fa-trophy"></i></label>
<input type="radio" name="profile_icon_selector"
value="fa-taxi" id="npis-taxi">
<label for="npis-taxi"><i class="fa fa-solid fa-taxi"></i></label>
</div>
<div class="entry-row">
<label for="show_chord_name_mode">Show chord names:</label>
<select class="selector" name="show_chord_name_mode" id="show-chord-name-mode-selector">
<option value="always">Always</option>
<option value="black_only">Black chords only</option>
<option value="never">Never</option>
</select>
<select class="selector" name="chord_reveal_mode" id="chord-reveal-mode-selector">
<option value="always">Always on</option>
<option value="after_guess">Reveal after guess</option>
</select>
</div>
<div class="entry-row">
<label for="chord_name_display_mode">Chord name display:</label>
<select class="selector" name="chord_name_display_mode" id="chord-name-display-mode-selector">
<option value="shapes_and_letters">Shapes and Letters</option>
<option value="shapes_only">Shapes only</option>
<option value="letters_only">Letters only</option>
</select>
</div>
<div class="entry-row">
<label for="target_number_setting">Target Number:</label>
<input type="number" id="target_number_setting" class="entry">
</div>
<div class="button-container">
<button class="button settings-button" id="delete-profile-button" onclick="delete_profile()">Delete Profile</button>
<button class="button settings-button" id="submit-changes-button" onclick="submit_profile_changes()">Save Changes</button>
<button class="button add-button" id="add-user-button" onclick="add_profile()">Add Profile</button>
</div>
</div>
<div class="shape-container">
{% include note_shapes.svg %}
</div>
</body>
</html>