-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmelodia.html
622 lines (537 loc) · 20.7 KB
/
melodia.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
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
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
<!DOCTYPE html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8" />
<title>0is1 - Luke Nilaratna</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="version" content="2" />
<link rel="stylesheet" href="https://unpkg.com/chota@latest" />
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Playfair+Display:wght@700&display=swap"
rel="stylesheet"
lazyload
/>
<!-- prettier-ignore -->
<style>
/* css reset */
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}:focus{outline:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none}input[type=search]{-webkit-appearance:none;-moz-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}textarea{overflow:auto;vertical-align:top;resize:vertical}audio,canvas,video{display:inline-block;max-width:100%}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted}a:active,a:hover{outline:0}img{border:0;-ms-interpolation-mode:bicubic}figure{margin:0}form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}button,html,input,select,textarea{color:#222}::-moz-selection{background:#b3d4fc;text-shadow:none}::selection{background:#b3d4fc;text-shadow:none}img{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}.chromeframe{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}
</style>
<script id="2d-fragment-shader" type="x-shader/x-fragment">
// <![CDATA[
#ifdef GL_ES
precision highp float;
#endif
#define PI 3.14159265359;
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
uniform float u_xpos;
uniform float u_ypos;
vec3 mod289(vec3 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec4 mod289(vec4 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec4 permute(vec4 x) {
return mod289(((x*34.0)+1.0)*x);
}
vec4 taylorInvSqrt(vec4 r)
{
return 1.79284291400159 - 0.85373472095314 * r;
}
float snoise(vec3 v)
{
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
vec3 i = floor(v + dot(v, C.yyy) );
vec3 x0 = v - i + dot(i, C.xxx) ;
vec3 g = step(x0.yzx, x0.xyz);
vec3 l = 1.0 - g;
vec3 i1 = min( g.xyz, l.zxy );
vec3 i2 = max( g.xyz, l.zxy );
vec3 x1 = x0 - i1 + C.xxx;
vec3 x2 = x0 - i2 + C.yyy;
vec3 x3 = x0 - D.yyy;
i = mod289(i);
vec4 p = permute( permute( permute(
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
float n_ = 0.142857142857;
vec3 ns = n_ * D.wyz - D.xzx;
vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
vec4 x_ = floor(j * ns.z);
vec4 y_ = floor(j - 7.0 * x_ );
vec4 x = x_ *ns.x + ns.yyyy;
vec4 y = y_ *ns.x + ns.yyyy;
vec4 h = 1.0 - abs(x) - abs(y);
vec4 b0 = vec4( x.xy, y.xy );
vec4 b1 = vec4( x.zw, y.zw );
vec4 s0 = floor(b0)*2.0 + 1.0;
vec4 s1 = floor(b1)*2.0 + 1.0;
vec4 sh = -step(h, vec4(0.0));
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
vec3 p0 = vec3(a0.xy,h.x);
vec3 p1 = vec3(a0.zw,h.y);
vec3 p2 = vec3(a1.xy,h.z);
vec3 p3 = vec3(a1.zw,h.w);
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
m = m * m;
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
dot(p2,x2), dot(p3,x3) ) );
}
void main() {
vec2 lt = vec2(gl_FragCoord.x + u_xpos, gl_FragCoord.y + u_ypos);
vec2 st = lt.xy/u_resolution.xy;
st.x *= u_resolution.x/u_resolution.y;
vec3 color = vec3(0.0);
vec2 pos = vec2(st*0.6);
float DF = 0.0;
float a = 0.0;
vec2 vel = vec2(u_time*.1);
st.xy *= 0.4;
float r = snoise(vec3(st.x,st.y,u_time * 0.15));
vec3 color1 = vec3((19.0+ r*20.0)/255.0,34.0/255.0,(90.0+ r*20.0)/255.0);
vec3 color2 = vec3((19.0+ r*20.0)/255.0,34.0/255.0,(70.0+ r*20.0)/255.0);
vec3 color3 = vec3((19.0+ r*20.0)/255.0,34.0/255.0,(50.0+ r*20.0)/255.0);
vec3 color4 = vec3((19.0+ r*20.0)/255.0,34.0/255.0,(30.0+ r*20.0)/255.0);
vec3 color5 = vec3((19.0+ r*20.0)/255.0,34.0/255.0,(10.0+ r*20.0)/255.0);
if(r > 0.60){
color = color5;
} else if(r > 0.20){
color = color4;
} else if(r > -0.20){
color = color3;
} else if(r > -0.60){
color = color2;
} else if(r > -2.0){
color = color1;
}
gl_FragColor = vec4(color,1.0);
}
// ]]>
</script>
<script id="2d-vertex-shader" type="x-shader/x-vertex">
// <![CDATA[
attribute vec2 a_position;
void main() {
gl_Position = vec4(a_position, 0, 1);
}
// ]]>
</script>
<script>
// Credit goes to Darryl Huffman https://codepen.io/darrylhuffman/pen/prrzVQ
// I just modified
// set up global javascript variables
var canvas, gl; // canvas and webgl context
var shaderScript;
var shaderSource;
var vertexShader; // Vertex shader. Not much happens in that shader, it just creates the vertex's to be drawn on
var fragmentShader; // this shader is where the magic happens. Fragment = pixel. Vertex = kind of like "faces" on a 3d model.
var buffer;
/* Variables holding the location of uniform variables in the WebGL. We use this to send info to the WebGL script. */
var locationOfTime;
var locationOfResolution;
var startTime = new Date().getTime(); // Get start time for animating
var currentTime = 0;
function init() {
// standard canvas setup here, except get webgl context
canvas = document.getElementById("glscreen");
gl =
canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// give WebGL it's viewport
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
// kind of back-end stuff
buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0,
]),
gl.STATIC_DRAW
); // ^^ That up there sets up the vertex's used to draw onto. I think at least, I haven't payed much attention to vertex's yet, for all I know I'm wrong.
shaderScript = document.getElementById("2d-vertex-shader");
shaderSource = shaderScript.text;
vertexShader = gl.createShader(gl.VERTEX_SHADER); //create the vertex shader from script
gl.shaderSource(vertexShader, shaderSource);
gl.compileShader(vertexShader);
shaderScript = document.getElementById("2d-fragment-shader");
shaderSource = shaderScript.text;
fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); //create the fragment from script
gl.shaderSource(fragmentShader, shaderSource);
gl.compileShader(fragmentShader);
program = gl.createProgram(); // create the WebGL program. This variable will be used to inject our javascript variables into the program.
gl.attachShader(program, vertexShader); // add the shaders to the program
gl.attachShader(program, fragmentShader); // ^^
gl.linkProgram(program); // Tell our WebGL application to use the program
gl.useProgram(program); // ^^ yep, but now literally use it.
locationOfResolution = gl.getUniformLocation(program, "u_resolution");
locationOfTime = gl.getUniformLocation(program, "u_time");
gl.uniform2f(locationOfResolution, canvas.width, canvas.height);
gl.uniform1f(locationOfTime, currentTime);
render();
}
function render() {
var now = new Date().getTime();
currentTime = (now - startTime) / 1000; // update the current time for animations
gl.uniform1f(locationOfTime, currentTime); // update the time uniform in our shader
window.requestAnimationFrame(render, canvas); // request the next frame
positionLocation = gl.getAttribLocation(program, "a_position"); // do stuff for those vertex's
gl.enableVertexAttribArray(positionLocation);
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
gl.drawArrays(gl.TRIANGLES, 0, 6);
}
window.addEventListener("load", function (event) {
init();
});
window.addEventListener("resize", function (event) {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
gl.viewport(0, 0, window.innerWidth, window.innerHeight);
locationOfResolution = gl.getUniformLocation(program, "u_resolution");
});
</script>
<link
rel="stylesheet"
href="https://unpkg.com/swiper/swiper-bundle.min.css"
/>
<style>
:root {
--swiper-theme-color: #d33c4f;
}
html,
body {
padding: 0px;
margin: 0px;
overflow: hidden;
background: #152234;
font-size: 16px;
font-weight: 400;
color: white;
font-family: "Open Sans", sans-serif;
overflow-x: hidden;
}
p,
span {
line-height: 1.8;
letter-spacing: 0.2px;
}
.content {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100vh;
overflow-y: scroll;
overflow-x: hidden;
}
.container {
width: 80vw;
padding: 20px;
margin: auto;
}
h1,
h3,
h4,
h5 {
font-family: "Playfair Display", serif;
font-size: 50px;
font-weight: 700;
margin: 16px 0;
line-height: 1.2;
}
h2 {
font-size: 20px;
line-height: 1.2;
}
h3 {
font-size: 28px;
}
a {
color: #ff3e57;
}
a h1,
a h3,
a h2 {
color: white;
}
.intro,
footer {
max-width: 700px;
}
footer {
opacity: 0.3;
}
p {
margin-bottom: 3vh;
}
svg {
width: 7vw;
min-width: 100px;
margin-right: 4vw;
}
canvas {
width: 100%;
height: 100%;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-slide {
background-size: cover;
background-position: center;
width: 40vw;
height: 16vw;
}
.projects h1 {
text-align: center;
line-height: 1.4;
}
hr {
padding: 0;
border: none;
border-top: medium double #ffffff1f;
color: #ffffff0a;
text-align: center;
font-family: "Playfair Display", serif;
margin: 26px 0;
background: none;
}
.swiper-button-next {
right: -55px;
top: 7vw;
}
.pill {
background: #7e53c16e;
border-radius: 200px;
padding: 6px 16px;
font-size: 13px;
color: white;
display: inline-block;
margin-right: 10px;
font-family: "Open Sans", sans-serif;
margin-bottom: 10px;
letter-spacing: 1.1px;
}
@media only screen and (max-width: 1200px) {
.project {
display: block;
}
.project > div:first-child {
width: 100%;
padding-right: 0;
padding-top: 30px;
padding-bottom: 30px;
}
.swiper-button-next {
bottom: 6vw;
top: auto;
}
}
@media only screen and (max-width: 960px) {
h1 {
font-size: 40px;
}
.project {
display: block;
position: relative;
}
.swiper-slide {
width: 80vw;
height: 38vw;
}
.swiper-button-next {
display: none;
}
}
.mb-1 {
margin-bottom: 10px;
}
.mb-2 {
margin-bottom: 20px;
}
.mb-3 {
margin-bottom: 30px;
}
figure {
font-style: italic;
}
.ratio img {
aspect-ratio: 1/1;
object-fit: cover;
}
.ratio169 img {
width: 100%;
aspect-ratio: 16/9;
object-fit: cover;
}
</style>
</head>
<body>
<div class="content">
<div class="container">
<div>
<hr />
<h1>Electro Melodia - An electric folk accordion</h1>
<hr />
</div>
<div class="row ratio169 mb-2">
<div class="col">
<img src="/images/melodia/feature.jpg" alt="" />
</div>
<div class="col">
<img src="/images/melodia/exterior_large.jpg" alt="" />
</div>
</div>
<div class="row ratio169 mb-2">
<div class="col">
<img src="/images/melodia/2player.gif" alt="" />
</div>
<div class="col">
<img src="/images/melodia/3player.gif" alt="" />
</div>
</div>
<div class="row">
<div class="col">
<p>
The Irish Arts Center was looking for a way to get people
interested in the Concertina. The concertina is an Irish folk
instrument that functions similar to an accordion. I identified
two major roadblocks stopping new potential players from picking
up the instrument. First, the instrument is quite expensive, a new
concertina can cost upwards of $500. A big investment for someone
who is not sure if they want to play. Second, the concertina
button layout is quite complex. It can have over 30 buttons. Each
button can play two different notes depending on if you are
pushing it close or pulling it open.
</p>
<p>
My solution was to protype , what I call the, “Electro Melodia”.
The Electro Melodia is a physical device that has the same button
layout of the concertina but uses midi protocol over bluetooth to
connect to a phone. The phone can produce a digital audio
simulation of the concertina.
</p>
</div>
</div>
<div class="row ratio169 mb-2">
<div class="col">
<img src="/images/melodia/full.png" alt="" />
</div>
<div class="col">
<img src="/images/melodia/concertinalid.gif" alt="" />
</div>
</div>
<div class="row">
<div class="col">
<p>
The goal of this project was to make the instrument reproducible.
In a potential class of 10 people everyone would need their own
instrument. To accomplish this goal, 3d printing and small scale
PCB manufacturing was employed.
</p>
<p>
The case of the instrument was made using 3d printing. Then each
component could be slotted into place. The case was designed in
CAD using Fusion 360 and then 3D printed using PLA.
</p>
</div>
</div>
<div class="row ratio169 mb-2">
<div class="col">
<img src="/images/melodia/print.gif" alt="" />
</div>
<div class="col">
<img src="/images/melodia/print2.gif" alt="" />
</div>
</div>
<div class="row">
<div class="col">
<p>
Soldering each electronic component would be difficult so a PCB
board was designed using EasyEDA and manufactured using JLCPCB.
Using these services was crucial because I could make a dozen
prototypes without the need for expensive tooling costs.
</p>
</div>
</div>
s
<div class="row ratio169 mb-2">
<div class="col">
<img src="/images/melodia/easyeda.png" alt="" />
</div>
<div class="col">
<img src="/images/melodia/ele.jpg" alt="" />
</div>
<div class="col">
<img src="/images/melodia/board.png" alt="" />
</div>
</div>
<div class="row">
<div class="col">
<p>
Finally a phone app was made to connect to the device. This app
could connect to the Electro Melodia allowing any piece of
software to read the midi signal coming from the device.
</p>
</div>
</div>
<div class="row ratio169 mb-2">
<div class="col">
<img src="/images/melodia/pp.jpg" alt="" />
</div>
<div class="col">
<img src="/images/melodia/piano.gif" alt="" />
</div>
</div>
<hr />
<div class="intro">
<h2>Hello my name is</h2>
<h1>Luke Nilaratna</h1>
<p>
I'm a NYC based creative technologist with over 10 years of
experience designing and building creative sites, mobile apps and
interactive experiences.
</p>
<h2>
Interested in working together?
<a href="mailto:[email protected]">Let's talk.</a>
</h2>
</div>
</div>
</div>
<canvas id="glscreen"></canvas>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<script>
var elements = document.querySelectorAll(".project");
Array.prototype.forEach.call(elements, function (el, i) {
new Swiper(el.querySelectorAll(".swiper-container")[0], {
slidesPerView: 1.3,
spaceBetween: 30,
grabCursor: true,
navigation: {
nextEl: el.querySelectorAll(".swiper-button-next")[0],
},
loop: true,
breakpoints: {
960: {
slidesPerView: 2.3,
},
},
});
});
</script>
</body>
</html>