-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreen.html
More file actions
1306 lines (1217 loc) · 54.3 KB
/
screen.html
File metadata and controls
1306 lines (1217 loc) · 54.3 KB
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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html{% if stage_mode %} class="nocursor"{% end %}>
<head>
<title>LED 眼鏡背後的蟒蛇魂 - PyCon TW 2019</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="/static/3rd_party/bootstrap-4.3.1-dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="/static/css/main.css" />
<link rel="stylesheet" href="/static/css/slides.css" />
<style>
</style>
</head>
<body>
<div class="coins-overlay">
</div>
<!-- These are the slides -->
<div class="slides">
{% if not stage_mode %}
<div class="slide" data-console="enable" data-indicators="on" data-title="Livespring Demo">
<div class="center-upper">
<h1>You are in demo console.</h1>
<div>
If you'd like to see the slides, press <code>RIGHT</code> or <code>DOWN</code> to start.<br />
Feel free to navigate using the arrow keys.
</div>
<hr />
<div class="mt-4">
<div class="midi-connected">
Livespring is connected to MIDI input <strong data-indicator="device"></strong>.<br />
Hit some keys to try it out.<br />
<br />
<span class="ruleset-selected">
Rule set <strong data-indicator="ruleset"></strong> loaded from<br />
<code>{{ ruleset_dir }}/<span data-indicator="ruleset"></span></code>
</span>
<span class="ruleset-not-selected">
No rule set selected.<br />
</span>
</div>
<div class="midi-not-connected">
There is no MIDI input connected to livespring.<br />
You'll need at least one MIDI input to try it out.
</div>
</div>
</div>
</div>
{% end %}
<div class="slide" data-console="disable" data-indicators="off">
<div class="center-upper">
<h1>LED 眼鏡背後的蟒蛇魂</h1>
<h1>The python spirit behind LED glasses</h1>
</div>
<div class="center-lower">
<div>陳炯廷 Tom Chen</div>
<div>PyCon TW 2019</div>
<div>ctchen@gmail.com</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<div class="django-girls-logo">
<img src="/static/images/slides/djangogirls.png" />
</div>
<div class="p2 pt-5 bold" style="height: 136px;">
One day, one of the attendee in my group ran into me in Starbucks.<br />
It was the day before CFP ended.
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<div class="django-girls-logo">
<img src="/static/images/slides/djangogirls.png" />
</div>
<div class="p2 pt-5 bold" style="height: 136px;">
I encouraged her to keep it up, and mentioned PyCon TW.<br />
And that motivated me to apply my second talk.
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<div class="django-girls-logo">
<img src="/static/images/slides/djangogirls.png" />
</div>
<div class="p2 pt-5 bold" style="height: 136px;">
I have never thought of this when I volunteered.
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<div class="django-girls-logo">
<img src="/static/images/slides/djangogirls.png" />
</div>
<div class="p2 pt-5 bold" style="height: 136px;">
</div>
</div>
</div>
<div class="slide">
<div class="d-flex align-items-center intro-1">
<div class="flex-grow-1 text-right">
<img src="/static/images/slides/tom.png" class="pr-5 mr-5" />
</div>
<div class="p2 bold flex-grow-1">
<p style="font-size: 1.6rem;">
陳炯廷 Tom (yychen)
</p>
<p class="pt-3">
2014-19 當若科技藝術 IF Plus<br />
2012-14 House123<br />
2008-12 趨勢科技 TrendMicro
</p>
<p class="pt-3" style="font-size: 1.6rem;">
Full Stack<br />
Multimedia Development<br />
Operation (Linux / Network)
</p>
</div>
</div>
</div>
<div class="slide">
<div class="d-flex align-items-center intro-2">
<div class="flex-grow-1 text-right">
<img src="/static/images/slides/band.png" class="pr-5 mr-2" />
</div>
<div class="flex-grow-1">
<h2>
21樂團 21 Band<br />
Keyboard (Piano)
</h2>
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>Computer (Engineering) & Music</h2>
</div>
</div>
<div class="slide">
<div class="ref-link">
<a href="https://www.youtube.com/watch?v=4Qvnv5wZIx8" target="_blank">https://www.youtube.com/watch?v=4Qvnv5wZIx8</a>
</div>
<div class="center-center">
<h1 class="display-4" style="font-weight: 500;">2014</h1>
<p class="p2 bold mt-4">
PyCon APAC 2014 Lightning Talk<br />
Python and Live Music Performance
</p>
</div>
</div>
<div class="slide">
<div class="center-center">
<h1 style="font-size: 6rem;">Recap</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>Computer (Engineering) + Music = ???</h2>
</div>
</div>
<div class="slide">
<div class="center-center" style="top: 80%;">
<p class="p2 bold">Engineering something like this maybe a little bit too hardcore for me</p>
<img src="/static/images/slides/live10.png" class="mt-3"/>
</div>
</div>
<div class="slide">
<div class="center-left" style="left: 45%;">
<p class="p1">
Front End Technologies (javascript, CSS, HTML…)
</p>
<p class="p1">
Back End Programming / Python
</p>
<p class="p1">
Piano Playing
</p>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: normal; font-size: 3.8rem;">Maybe I can control the display while I'm playing</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: normal; font-size: 3.8rem;">Maybe I can <span class="under">control the display</span> while I'm <span class="under">playing</span></h2>
<div class="float float-1 p2">the front end / back end part</div>
<div class="float float-2 p2">the music playing part</div>
</div>
</div>
<div class="slide">
<div class="illustration">
<img src="/static/images/slides/noun/projector-screen.png" class="img-screen" />
<img src="/static/images/slides/noun/keyboard-with-stand.png" class="img-keyboard" />
</div>
</div>
<div class="slide">
<div class="center-center">
<h1 class="bold">But actually</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<h1 class="bold">I can also <strong>ask someone to control</strong> it</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<h1>then it wouldn't be cool</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
It would be awesome when it is automatically synced<br />
without any other person involved
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h1 class="bold">But how?</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<img src="/static/images/slides/diagram2014.png" width="90%"/>
</div>
</div>
<div class="slide" data-change-ruleset="demo1" data-coins-overlay="on" data-indicators="on" data-shortcut="q">
<div class="left-top">
<h2>
Get the notes played through MIDI signals
</h2>
<h2 class="mt-5">
See if it matches any pattern<br />
Dispatch the events to frontend (tornado websocket)
</h2>
<p style="font-size: 2.1rem; font-weight: 300;">
for example: <code>G6 C7 --> coin</code>
</p>
<h2 class="mt-5">
We can also dispatch each MIDI signals
</h2>
<div class="notes mt-3"></div>
</div>
</div>
<div class="slide slide-demo-2" data-change-ruleset="demo2" data-indicators="on" data-shortcut="w">
<div class="left-top">
<h2>
Detect the notes on the beat.
</h2>
<p style="font-size: 2.1rem; font-weight: 300;" class="my-5">
for example:
<span class="enlarge-block">
<code>
<span style="color: white;"><span data-bar-demo2="|1">|<span class="timestamp-block">N/A</span></span></span>
<span data-note-demo2="D#3">D#3<span class="shadow-block"></span></span>
<span style="color: white;">- <span data-bar-demo2="|2">|<span class="timestamp-block">N/A</span></span> </span>
<span data-note-demo2="F3">F3<span class="shadow-block"></span></span>
<span style="color: white;">- <span data-bar-demo2="|3">|<span class="timestamp-block">N/A</span></span> </span>
<span data-note-demo2="G3">G3<span class="shadow-block"></span></span>
<span style="color: white;">- <span data-bar-demo2="|4">|<span class="timestamp-block">N/A</span></span> - - |</span></code>
</span>
</p>
<div class="p1">
<span style="font-weight: 700;">1 Bar</span> <span class="demo2-interval" style="font-weight: 300;">N/A </span><span style="font-size: 1.8rem;">sec</span>,
<span style="font-weight: 700;">eighth</span> <span class="demo2-eighth" style="font-weight: 300;">N/A </span><span style="font-size: 1.8rem;">sec</span>
</div>
<h2 style="font-weight: 400; padding-top: 6rem;">
Save the timestamp of these.
</h2>
<h2 class="mt-5" style="font-weight: 400;">
Once we have two timestamps,<br/>we know the speed<br />and we can dispatch time related signals
</h2>
<div class="notes mt-3"></div>
<div class="demo2-time-signal"> </div>
</div>
</div>
<div class="slide">
<img src="/static/images/slides/backtothe21.png" width="100%" class="back-to-the-21-img" />
<div class="top-left">
<div class="p2" style="font-weight: 600;">
Back to the 21
</div>
<div class="p1" style="font-weight: 300; margin-top: -15px;">
2014 9/27 20:00 @ A House
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<h1 class="display-4" style="font-weight: 500;">2017</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>2017 October</h2>
<div class="mt-5">
<div class="p2">
30th Anniversary, National Theater & Concert Hall<br />
Electric Indigo
</div>
<div class="p1" style="font-weight: 700;">
兩廳院30週年 眾聲之所
</div>
</div>
<div class="mt-5">
<div class="p2">
Lim Giong × DJ Point × Po-yu Wang
</div>
<div class="p1" style="font-weight: 700;">
林強 × DJ Point × 王伯宇
</div>
</div>
</div>
</div>
<div class="slide">
<div class="electric-indigo-full">
<div class="ref-link" style="top: auto; bottom: 15%;">
<a href="https://www.facebook.com/ifplusco/videos/917577795065174" target="_blank">https://www.facebook.com/ifplusco/videos/917577795065174</a>
</div>
</div>
</div>
<div class="slide">
<div class="ref-link" style="top: 10%;">
<a href="http://macetech.com/store/index.php?main_page=index&cPath=14" target="_blank">http://macetech.com/store/index.php?main_page=index&cPath=14</a>
</div>
<div class="center-center" style="top: 75%; opacity: 0.7;">
<img src="/static/images/slides/macetech.jpg" class="mt-3"/>
</div>
</div>
<div class="slide">
<div class="center-center" style="top: 75%; opacity: 0.05;">
<img src="/static/images/slides/macetech.jpg" class="mt-3"/>
</div>
<div class="center-center">
<h2>The secret weapon for encore <span style="font-weight: 400;">—</span> <span style="font-weight: 300;">LED Glasses</span></h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>But, there was no encore.</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>Nobody saw the cool glasses.</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>so...</h2>
</div>
</div>
<div class="slide">
<div class="d-flex align-items-center our-little-progression justify-content-start">
<div class="mr-5 br-5">
<div style="width: 60vw; opacity: 0.8;">
<img src="/static/images/slides/ourlittleprogression.png" />
</div>
</div>
<div class="ml-3">
<div class="p2 bold">
21點點<br />
Our little progression...<br />
<br />
Backstage Cafe<br />
Nov. 4, 2017
</div>
</div>
</div>
</div>
<div class="slide" data-trigger="reset">
<div class="center-center">
<img src="/static/images/slides/led-glasses.png" />
</div>
</div>
<div class="slide" data-trigger="led-pattern-1">
<div class="center-center">
<div class="led-glasses-container">
<img src="/static/images/slides/led-glasses.png" />
<div class="notation-block">
<img src="/static/images/slides/blue-arrow.png" style="transform: rotate(90deg);"/>
<div class="notation p2 bold">
Arduino-compatible<br />
source code available
</div>
</div>
</div>
</div>
</div>
<div class="slide" data-trigger="reset">
<div class="center-center">
<div class="led-glasses-container">
<img src="/static/images/slides/led-glasses.png" />
<div class="notation-block">
<img src="/static/images/slides/blue-arrow.png" style="transform: rotate(90deg);"/>
<div class="notation p2 bold">
Hack it!<br />
Listens to serial port and change pattern
</div>
</div>
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">Dig the 3-year-old code from last event<br />
port it from 2.7 to 3<br />
<br />
I have very limited time to do whatever I need to do</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>
The night before the last rehearsal
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2>
Hack the Arduino code to <strong>receive data from serial port</strong><br />
<br />
Change the signal triggering part from tornado websocket to <strong>pyserial</strong>
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<img src="/static/images/slides/diagram2017.png" width="90%"/>
</div>
</div>
<!--
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400; line-height: 1.5;">
Originally, I wanted to design the LED patterns<br />
But I have no time. I used the patterns included directly.
</h2>
</div>
</div>
-->
<div class="slide">
<div class="left-top">
<h2>
Design the triggering chords / notes<br />
<span style="font-weight: 300;">
How would the musician play?
</span>
<br />
<br />
Decide the triggered effects (LED patterns)<br />
<span style="font-weight: 300;">
See how it would fit best in the song<br />
Sometimes it is cutting off the effect on the precise beat
</span>
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<img src="/static/images/slides/2017performance.jpg" style="width: 100vw; height: 100vh; object-fit: contain;" />
</div>
</div>
<div class="slide">
<div class="d-flex align-items-center justify-content-between one-to-four">
<div class="">
<div style="width: 40vw; position: relative;">
<img src="/static/images/slides/2017performance-2.jpg" class="pic" />
<img src="/static/images/slides/led-glasses.png" class="medium-glasses" style="top: 110%; left: 57%; transform: translate(-50%, 0);"/>
</div>
</div>
<div class="text-center">
<img src="/static/images/slides/blue-arrow.png" />
</div>
<div class="">
<div style="width: 40vw; position: relative;">
<img src="/static/images/slides/2017performance-3.jpg" class="pic" />
<img src="/static/images/slides/led-glasses.png" class="medium-glasses" style="top: 110%; left: 23%; transform: translate(-50%, 0);"/>
<img src="/static/images/slides/led-glasses.png" class="medium-glasses" style="top: 110%; left: 44%; transform: translate(-50%, 0);"/>
<img src="/static/images/slides/led-glasses.png" class="medium-glasses" style="top: 110%; left: 62%; transform: translate(-50%, 0);"/>
<img src="/static/images/slides/led-glasses.png" class="medium-glasses" style="top: 110%; left: 80%; transform: translate(-50%, 0);"/>
</div>
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<img src="/static/images/slides/setup.png" style="width: 90vw; height: 90vh; object-fit: contain;" />
</div>
</div>
<div class="slide" data-video="play">
<div class="center-center">
<video style="width: 100vw; height: 100vh; object-fit: cover;" loop>
<source src="/static/video/slides/clip.mp4" type="video/mp4">
</video>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
the code is ugly,<br />
but the system needs to be stable on stage
</h2>
<p class="p2 pt-5" style="font-weight: 300;">
You might hardcode lots of stuff, or there are copy-pasted code everywhere<br />
in these kind of projects, but...
</p>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
You can predict what might happen on stage,<br />
make sure the system can survive in these situations
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
One set (pair of glasses) might be down<br />
The system should be working no matter how many sets are alive
</h2>
<p class="p2 pt-5 pb-3" style="font-weight: 300;">
Sometimes when you're coding in a hurry,<br />
you assume that the environment is bound.
</p>
<code>ser[0], ser[1], ser[2], ser[3]</code>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
It should also work no matter when I plug the LED glasses
</h2>
<p class="p2 pt-5 pb-3" style="font-weight: 300;">
You might hardcode something like <code>/dev/cu.SLAB_USBtoUART</code>, <code>/dev/cu.SLAB_USBtoUART2</code>...<br />
What happens if it is unplugged, and then re-plugged?
</p>
<p class="p2" style="font-weight: 300;">
Will the device path be the same as before?
</p>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
If all these require a restart of the system?
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
Performing is already intense and stressful
<br /><br />
The system should be a plus rather than<br />
making you more anxious
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h1 class="display-4" style="font-weight: 500;">2018</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
Improvemen time!
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
The USB wires are too long.
</h2>
</div>
</div>
<div class="slide">
<div class="long-wires"></div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
It is very difficult to deploy the system on stage<br />
since we have VERY little time to setup between bands.
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
Is it possible it make it wireless?
</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<img src="/static/images/slides/diagram2018.png" style="width: 90vw; height: 90vh; object-fit: contain;" />
</div>
</div>
<div class="slide">
<div class="center-center">
<img src="/static/images/slides/semi-wireless.png" style="width: 90vw; height: 90vh; object-fit: contain;" />
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 400;">
One afternoon to get all these done
</h2>
</div>
</div>
<div class="slide">
<div class="left-top" style="top: 30%; left: 15%;">
<h2>
Test with one set and prove it works
</h2>
<ol class="p2 mt-5">
<li>Clean Raspbian Installation</li>
<li>Connects to the desired wireless AP on every boot</li>
<li>Fixed IP Address</li>
<li>Python script (pyserial + pyosc) executed after boot (rc.local)</li>
<li>Connects to the serial port whenever it is plugged in</li>
</ol>
</div>
</div>
<div class="slide">
<div class="left-top" style="top: 30%; left: 15%;">
<h2>
Clone it to 4 Raspberry Pis, and test all 4
</h2>
<div class="p2">
(with corresponding fixed IPs)
</div>
</div>
</div>
<div class="slide">
<div class="center-center">
<img src="/static/images/slides/glasses-pi-set.jpg" style="width: 100vw; height: 100vh; object-fit: contain;" />
</div>
<div class="wireless-setup-container">
<div class="notation-block notation-block-1">
<img src="/static/images/slides/blue-arrow.png" />
<div class="notation p2 bold">
Raspberry Pi
</div>
</div>
<div class="notation-block notation-block-2">
<img src="/static/images/slides/blue-arrow.png" />
<div class="notation p2 bold">
Portable Charger
</div>
</div>
</div>
</div>
<div class="slide slide-large-demo" data-change-ruleset="cakewalk" data-console="enable" data-indicators="on" data-shortcut="e">
<div class="center-center">
<h1 class="display-4" style="font-weight: 500;">DEMO</h1>
</div>
</div>
<div class="slide" data-console="disable">
<div class="center-center">
<h1 class="display-4" style="font-weight: 500;">Future Work</h1>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 500;">Wireless solution without Raspberry Pi?</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 500;">More outputs?</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 500;">Open Source?</h2>
</div>
</div>
<div class="slide">
<div class="center-center">
<h2 style="font-weight: 500;">Open Source!</h2>
<a href="https://github.com/yychen/livespring" target="_blank">https://github.com/yychen/livespring</a>
</div>
</div>
<div class="slide">
<div class="d-flex align-items-center justify-content-start last-slide">
<div class="">
<div style="width: 60vw; height: 100vh; position: relative;">
<img src="/static/images/slides/last.jpg" style="width: 100%; height: 100%; object-fit: cover;" />
</div>
</div>
<div class="text-center ml-5 pl-5">
<h1 class="display-4" style="font-weight: 500;">Questions?</h1>
</div>
</div>
</div>
<div class="slide">
<div class="d-flex align-items-center justify-content-start last-slide">
<div class="">
<div style="width: 60vw; height: 100vh; position: relative;">
<img src="/static/images/slides/last.jpg" style="width: 100%; height: 100%; object-fit: cover;" />
</div>
</div>
<div class="text-center ml-5 pl-5">
<h1 class="display-4" style="font-weight: 500;">Thank you.</h1>
<div style="position: relative; top: 100px;">
<a href="https://www.youtube.com/watch?v=K-n_clM9z28" target="_blank">https://www.youtube.com/watch?v=K-n_clM9z28</a><br />
or Youtube search <span class="badge badge-dark">腦抽筋 21樂團</span>
</div>
</div>
</div>
</div>
</div>
<!-- console -->
<div class="notes-canvas">
<div class="notes-block">
<span class="notes">
</span>
</div>
<div class="lyrics-1"></div>
<div class="time-signal"></div>
</div>
<!-- the indicators -->
<div class="indicators">
<span class="badge badge-light" data-indicator="ruleset">(no ruleset)</span>
<span class="badge badge-light" data-indicator="device">(no midi)</span>
<span class="badge badge-light off" data-indicator="console">console</span>
<span class="badge badge-light off" data-indicator="ws">ws</span>
</div>
<script src="/static/3rd_party/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function() {
var consoleMode = false;
var slideRecoverTimeout = null;
// Simple auto-reconnect
// https://stackoverflow.com/questions/22431751/websocket-how-to-automatically-reconnect-after-it-dies/23176223
var ws = null;
var connect = function() {
ws = new WebSocket("ws://" + window.location.host + "/socket");
ws.onopen = function() {
$("[data-indicator='ws']").removeClass("off");
};
ws.onmessage = function(e) {
if (e.data) {
var packet = JSON.parse(e.data);
console.log(packet);
// Handling MIDI signals
if (packet.data.type === 'midi') {
if (packet.data.context.pedal) {
$(".notes").addClass("pedal");
}
else {
$(".notes").removeClass("pedal");
}
// $(".notes").text(packet.data.context.notes.join(", "));
console.log(packet.data.message);
if (packet.data.message.type === "note_on") {
noteOn(packet.data.message.note, packet.data.message.note_display, packet.data.message.velocity);
}
else if (packet.data.message.type === "note_off") {
noteOff(packet.data.message.note);
}
else if (packet.data.message.type === "control_change") {
// Play button, turns the console on (visible)
if (packet.data.message.control === 117 && packet.data.message.value === 0) {
consoleMode = true;
reflectConsoleMode();
}
// Stop button, turns the console off (invisible)
else if (packet.data.message.control === 116 && packet.data.message.value === 0) {
consoleMode = false;
reflectConsoleMode();
}
// Forward button. Make the ruleset to braincramp
else if (packet.data.message.control === 115 && packet.data.message.value === 0) {
changeRuleSet("braincramp");
}
// Backward button. Make the ruleset to cakewalk
else if (packet.data.message.control === 114 && packet.data.message.value === 0) {
changeRuleSet("cakewalk");
}
}
if (packet.data.context.notes.length > 0) {
$($slides[current]).addClass("console-overlaying");
$(".notes-canvas").addClass("front");
if (slideRecoverTimeout !== null) {
clearTimeout(slideRecoverTimeout);
slideRecoverTimeout = null;
}
if (largeDemoState === 'init') {
largeDemoState = 'demo';
}
}
else {
if (slideRecoverTimeout === null) {
slideRecoverTimeout = setTimeout(function() {
if (largeDemoState !== 'demo') {
$(".console-overlaying").removeClass("console-overlaying");
$(".notes-canvas").removeClass("front");
slideRecoverTimeout = null;
$(".lyrics-1").text("").removeClass("word1").removeClass("word2").removeClass("word3");
$(".time-signal").text("");
$(".demo2-time-signal").text("");
if ($($slides[current]).hasClass("slide-large-demo")) {
largeDemoState = 'init';
}
else {
largeDemoState = '';
}
}
}, 1500);
}
}
}
// Handling triggered signals
else if (packet.data.type === 'signal') {
console.log(packet.data.name);
var $signalBlock = $("<div class='signal-block'>" + packet.data.name + "</div>");
$(".notes-canvas").append($signalBlock);
animateSignal($signalBlock);
if (packet.data.name === "led-pattern-1") {
$(".notes-canvas").addClass("inverse");
$(".lyrics-1").text("腦").removeClass("word2").removeClass("word3").addClass("word1");
}
if (packet.data.name === "led-pattern-2") {
$(".notes-canvas").addClass("inverse");
$(".lyrics-1").text("抽").removeClass("word1").removeClass("word3").addClass("word2");
}
if (packet.data.name === "led-pattern-3") {
$(".notes-canvas").addClass("inverse");
$(".lyrics-1").text("筋").removeClass("word1").removeClass("word2").addClass("word3");
}
if (packet.data.name === "led-pattern-4!") {
$(".notes-canvas").removeClass("inverse");
$(".lyrics-1").text("").removeClass("word1").removeClass("word2").removeClass("word3");
if ($("[data-indicator='ruleset']").text() === "braincramp") {
largeDemoState = '';
}
}
if (packet.data.name === "reset") {
$(".time-signal").text("");
$(".demo2-time-signal").text("");
$(".lyrics-1").text("").removeClass("word1").removeClass("word2").removeClass("word3");
}
if (packet.data.name === "coin") {
var $overlay = $(".coins-overlay");
var randomPick = parseInt(Math.random() * 4);
var $coinBlock = $("<div class='coin'></div>");
var $coin = $(coins[randomPick].cloneNode());
$coinBlock.append($coin);
// $coinBlock.addClass("coin").css({top: (parseInt(Math.random() * 50) + 10) + "%", left: (parseInt(Math.random() * 80) + 10) + "%"});
$coinBlock.addClass("coin").css({top: "40%", left: "80%"});
// $coin.css({transform: "rotate(" + parseInt(Math.random() * 180) + "deg)"});
$overlay.append($coinBlock);
setTimeout(function() {
$coin.addClass("flow");
setTimeout(function() {
$coinBlock.remove();
}, 1000);
}, 20);
}
}
// Handling time related signals
else if (packet.data.type === 'timer') {
$(".time-signal").text(packet.data.name);
$(".demo2-time-signal").text(packet.data.name);
if (packet.data.name === "!1.1") {
$(".lyrics-1").text("什麼叫做 R & D").removeClass("word1").removeClass("word2").removeClass("word3");
}
else if (packet.data.name === "!2.1") {
$(".lyrics-1").text("寫 code 寫到腦抽筋");
}
else if (packet.data.name === "!3.1") {
$(".lyrics-1").text("什麼叫做小確幸");
}
else if (packet.data.name === "!4.1") {
$(".lyrics-1").text("今天整天沒會議");
}
else if (packet.data.name === "!5.1") {
$(".lyrics-1").text("今天整天沒會議");
}
else if (packet.data.name === "!6.1") {
$(".lyrics-1").text("寫").addClass("word0");
}
else if (packet.data.name === "!6.2") {
$(".lyrics-1").text("code").addClass("word0");
}
else if (packet.data.name === "!6.3") {
$(".lyrics-1").text("寫").addClass("word0");
}
else if (packet.data.name === "!6.4") {
$(".lyrics-1").text("到").addClass("word0");
}
else if (packet.data.name === "!6.5") {
$(".lyrics-1").text("").removeClass("word0");
}
else if (packet.data.name[packet.data.name.length - 1] === "8" && packet.data.name !== "!6.8") {
$(".lyrics-1").text("");
}
}
// Handling status changes
else if (packet.data.type === 'status') {
if (packet.data.status.device === null) {
$("[data-indicator='device']").text("(no midi)");
$(".midi-not-connected").removeClass("d-none");
$(".midi-connected").addClass("d-none");
}
else {
$("[data-indicator='device']").text(packet.data.status.device);
$(".midi-not-connected").addClass("d-none");
$(".midi-connected").removeClass("d-none");
}
if (packet.data.status.ruleset === null) {
$("[data-indicator='ruleset']").text("(no ruleset)");
$(".ruleset-not-selected").removeClass("d-none");
$(".ruleset-selected").addClass("d-none");
}
else {
$("[data-indicator='ruleset']").text(packet.data.status.ruleset);
$(".ruleset-not-selected").addClass("d-none");
$(".ruleset-selected").removeClass("d-none");
}
}
// Demo2
else if (packet.data.type === 'bars') {
for (var key in packet.data.bars) {
if (packet.data.bars[key]) {
$("[data-bar-demo2='" + key + "'] .timestamp-block").text(packet.data.bars[key]);
}
else {
$("[data-bar-demo2='" + key + "'] .timestamp-block").text("N/A");
}
}
if (packet.data.interval) {
$(".demo2-interval").text(packet.data.interval);
}
else {
$(".demo2-interval").text("N/A ");
}
if (packet.data.eighth) {
$(".demo2-eighth").text(packet.data.eighth);
}
else {
$(".demo2-eighth").text("N/A ");
}
}
}
};
ws.onclose = function() {