-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
368 lines (304 loc) · 11.6 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
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Harmonizer</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
* {
box-sizing: border-box
}
body {
padding: 0;
margin: 0;
background: rgb(189, 189, 189)
}
ul {
height: 18.875em;
float: left;
margin: 0;
padding: 0;
position: relative;
}
li {
margin: 0;
padding: 0;
list-style: none;
position: relative;
float: left
}
.white {
height: 16em;
width: 2.4em;
z-index: 1;
border-left: 1px solid #bbb;
border-bottom: 1px solid #bbb;
border-radius: 0 0 5px 5px;
box-shadow: -1px 0 0 rgba(255, 255, 255, 0.8) inset, 0 0 5px #ccc inset, 0 0 3px rgba(0, 0, 0, 0.2);
background: linear-gradient(to bottom, #eee 0%, #fff 100%)
}
.white.pressed {
border-top: 1px solid #777;
border-left: 1px solid #999;
border-bottom: 1px solid #999;
box-shadow: 2px 0 3px rgba(0, 0, 0, 0.1) inset, -5px 5px 20px rgba(0, 0, 0, 0.2) inset, 0 0 3px rgba(0, 0, 0, 0.2);
background: linear-gradient(to bottom, rgb(148, 245, 148) 0%, #2fd846 100%) !important
}
.white.pressable {
background: linear-gradient(to bottom, rgb(227, 241, 245) 0%, #addaf8 100%)
}
.black {
height: 8em;
width: 1.2em;
margin: 0 0 0 -0.6em;
z-index: 2;
border: 1px solid #000;
border-radius: 0 0 3px 3px;
box-shadow: -1px -1px 2px rgba(255, 255, 255, 0.2) inset, 0 -5px 2px 3px rgba(0, 0, 0, 0.6) inset, 0 2px 4px rgba(0, 0, 0, 0.5);
background: linear-gradient(45deg, #222 0%, #555 100%)
}
.black.pressed {
box-shadow: -1px -1px 2px rgba(255, 255, 255, 0.2) inset, 0 -2px 2px 3px rgba(0, 0, 0, 0.6) inset, 0 1px 2px rgba(0, 0, 0, 0.5);
background: linear-gradient(to right, rgb(153, 106, 153) 0%, #a928b4 100%) !important
}
.black.pressable {
background: linear-gradient(to bottom, rgb(141, 152, 155) 0%, #587181 100%)
}
.a,
.g,
.f,
.d,
.c {
margin: 0 0 0 -0.6em
}
ul:first-of-type li:first-child {
border-radius: 5px 0 5px 5px
}
ul:last-of-type li:last-child {
border-radius: 0 5px 5px 5px
}
.custom-control {
line-height: 2.25em;
}
.custom-control-label::before {
top: 0.75rem;
}
.custom-switch .custom-control-label::after {
top: calc(.75rem + 2px);
}
/*
#sequencer td {
border-width: 12px !important;
}
*/
.seq-active {
border-color: red !important;
}
#note,
#key {
font-size: 1.3em;
}
#ts-top,
#ts-bottom {
display: inline-block;
width: 40%;
}
.activeProgr {
background-color: #ffef5a !important;
}
#cursor {
width: 12px;
background-color: white;
border: none;
margin: 0;
padding: 0;
position: absolute;
z-index: 9999;
}
</style>
<script src="p5/p5.min.js"></script>
<script src="p5/p5.sound.min.js"></script>
</head>
<body>
<div id="cursor" style="display:none"></div>
<div class="container-full">
<div class="row">
<div class="col">
<div id="kb">
</div>
</div>
</div>
<div class="row">
<div class="col text-center" id="key"></div>
<div class="col text-center">
<div id="note" class="">
</div>
</div>
</div>
<div class="row">
<div class="col-1"> </div>
<div class="col">
<table class="table table-borderless">
<tbody>
<tr id="sequencer">
</tr>
</tbody>
</table>
<div id="cursor-holder"></div>
</div>
<div class="col-1"> </div>
</div>
<div class="row">
<div class="col">
<form style="padding: 16px;">
<div class="form-group form-row">
<div class="col-1 d-none d-lg-block"> </div>
<label for="ts-top" class="col-3 col-md-2 col-lg-1 col-form-label">Time Signature</label>
<div class="col-6 col-md-3 col-lg-2">
<input id="ts-top" type="number" min="1" step="1" class="form-control" value="4">
<label for="ts-bottom" class="">/</label>
<select id="ts-bottom" class="form-control" id="modMode">
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
<option selected value="8">8</option>
<option value="16">16</option>
</select>
</div>
<div class="w-100 d-block d-md-none"></div>
<div class="col-1 d-none d-lg-block"> </div>
<label for="bpm" class="col-2 col-sm-1 col-md-1 col-lg-1 col-form-label">BPM</label>
<div class="col-3 col-sm-2 col-md-1 col-lg-1">
<input id="bpm" type="number" min="50" step="1" class="form-control" value="145">
</div>
<div class="col-1 d-none d-md-block"> </div>
<div class="col-3 col-md-2 col-lg-1">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="beatOn">
<label class="custom-control-label" for="beatOn">Beat</label>
</div>
</div>
<div class="col-1 d-none d-lg-block"> </div>
<div class="col-3 col-md-2 col-lg-1">
<div class="custom-control custom-switch">
<input type="checkbox" checked class="custom-control-input" id="drumsOn">
<label class="custom-control-label" for="drumsOn">Drums</label>
</div>
</div>
</div>
<div class="form-group form-row">
<div class="col-1 d-none d-lg-block"> </div>
<div class="col-3 col-md-2 col-lg-1">
<div class="custom-control custom-switch">
<input type="checkbox" checked class="custom-control-input" id="synthOn">
<label class="custom-control-label" for="synthOn">Synth</label>
</div>
</div>
<div class="col-9 col-md-3 col-lg-2">
<select class="form-control" id="modMode">
<option value="0">Only minor keys (no modulation)</option>
<option value="1">Only major keys (no modulation)</option>
<option selected value="2">Only minor keys</option>
<option value="3">Only major keys</option>
<option value="4">Major/minor keys</option>
<option value="5">Major/minor keys (harder)</option>
</select>
</div>
<div class="w-100 d-block d-md-none"></div>
<div class="col-1 d-none d-md-block"> </div>
<div class="col-3 col-md-1 col-lg-1">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="inversionOn">
<label class="custom-control-label" for="inversionOn">Inv</label>
</div>
</div>
<div class="col-1 d-none d-md-block"> </div>
<div class="col-3 col-md-1 col-lg-1">
<div class="custom-control custom-switch">
<input type="checkbox" checked class="custom-control-input" id="seventhOn">
<label class="custom-control-label" for="seventhOn">7th</label>
</div>
</div>
<div class="col-1 d-none d-md-block"> </div>
<div class="col-6 col-md-2 col-lg-2">
<label for="filterFreq">Filter</label>
<input type="range" class="custom-range" min="100" max="10000" step="10" id="filterFreq" value="3500">
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col text-center">
<button type="button" class="btn btn-primary" onclick="openProgWindow()">Show list of progressions</a>
</div>
</div>
<div class="row">
<div class="col-3"> </div>
<div class="col">
<table id="progList" class="table table-sm table-borderless">
</table>
</div>
<div class="col-3"> </div>
</div>
<div class="row">
<div class="col">
<div class="alert alert-warning alert-dismissible fade show text-center" role="alert">
<h4 class="alert-heading">Instructions</h4>
<p>
Click on the piano keyboard (or press <b>SPACE</b>) to start playing<br />
Please note that you can click only the light blue buttons on the keyboard<br />
To stop, press <b>SPACE</b><br />
Adjust the parameters as you like, toggles/sliders work while playing, while the others take effect on the
first restart<br />
</p>
<h4 class="alert-heading">How does this work</h4>
<p>
Plays chords according to predefined progressions, in various keys taken from the Circle of fifths<br />
It always starts from the key you pressed; if you use <b>SPACE</b>, it starts from A3 note (so the first key
is A
major or A minor)<br />
At times, shifts to a new key (using pivot chords) according to the rules chosen in the select field<br />
To modulate from a major key to its relative minor, it makes use of <i>ii - iv</i> correspondence or <i>iii
- i</i> correspondence (in the latter case it doesn't switch to the strict relative key, but to its
neighbouring key)<br />
To modulate form a minor key to its relative major, it makes use of <i>I - vi</i> correspondence or <i>VI -
I</i> correspondence (in the latter case it doesn't switch to the strict relative key, but to its
neighbouring key)<br />
At times, shifts to a new progression<br />
At times, makes a chord inversion (if <b>Inv</b> parameter is toggled on)<br />
Rhythm is generated randomly and changes at each restart
</p>
<h4 class="alert-heading">Thanks to ...</h4>
<p>
p5.js, p5.sound<br />
bootstrap<br />
https://codepen.io/zastrow/pen/oDBki for the nice piano keyboard.<br />
https://soundpacks.com/free-sound-packs/jazz-drum-kit/ for the drum kit sounds.
</p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
</div>
<div class="row">
<div class="col text-center">
Copyright © 2019 Alberto Fiore
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<script src="sketch.js"></script>
</body>
</html>