baouws commited on
Commit
91a5c20
·
verified ·
1 Parent(s): f33f093

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +829 -0
index.html ADDED
@@ -0,0 +1,829 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>MATRIX MUSIC HACKER v2.1</title>
7
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/strudel/1.0.0/strudel.umd.js"></script>
8
+ <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Courier+Prime:wght@400;700&display=swap" rel="stylesheet">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Courier+Prime:wght@400;700&display=swap');
11
+
12
+ * {
13
+ margin: 0;
14
+ padding: 0;
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ body {
19
+ font-family: 'Orbitron', monospace;
20
+ background: #000;
21
+ color: #00ff00;
22
+ min-height: 100vh;
23
+ overflow-x: hidden;
24
+ position: relative;
25
+ }
26
+
27
+ /* Matrix rain background */
28
+ .matrix-bg {
29
+ position: fixed;
30
+ top: 0;
31
+ left: 0;
32
+ width: 100%;
33
+ height: 100%;
34
+ pointer-events: none;
35
+ z-index: 1;
36
+ opacity: 0.1;
37
+ }
38
+
39
+ .matrix-bg canvas {
40
+ width: 100%;
41
+ height: 100%;
42
+ }
43
+
44
+ .container {
45
+ position: relative;
46
+ z-index: 10;
47
+ max-width: 1400px;
48
+ margin: 0 auto;
49
+ padding: 20px;
50
+ }
51
+
52
+ .header {
53
+ text-align: center;
54
+ margin-bottom: 40px;
55
+ padding: 20px;
56
+ border: 2px solid #00ff00;
57
+ background: rgba(0, 255, 0, 0.03);
58
+ border-radius: 0;
59
+ position: relative;
60
+ overflow: hidden;
61
+ }
62
+
63
+ .header::before {
64
+ content: '';
65
+ position: absolute;
66
+ top: 0;
67
+ left: -100%;
68
+ width: 100%;
69
+ height: 100%;
70
+ background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.1), transparent);
71
+ animation: scan 3s infinite;
72
+ }
73
+
74
+ .header h1 {
75
+ font-size: 2.8rem;
76
+ font-weight: 900;
77
+ margin-bottom: 10px;
78
+ text-shadow: 0 0 20px #00ff00, 0 0 40px #00ff00;
79
+ letter-spacing: 3px;
80
+ animation: flicker 2s infinite alternate;
81
+ }
82
+
83
+ .header .subtitle {
84
+ font-size: 1.2rem;
85
+ color: #00cccc;
86
+ font-family: 'Courier Prime', monospace;
87
+ text-transform: uppercase;
88
+ letter-spacing: 2px;
89
+ }
90
+
91
+ .system-info {
92
+ display: flex;
93
+ justify-content: space-between;
94
+ margin-top: 15px;
95
+ font-size: 0.9rem;
96
+ color: #00ff00;
97
+ font-family: 'Courier Prime', monospace;
98
+ }
99
+
100
+ .controls {
101
+ display: grid;
102
+ grid-template-columns: 1fr 1fr;
103
+ gap: 30px;
104
+ margin-bottom: 30px;
105
+ }
106
+
107
+ .terminal {
108
+ background: rgba(0, 0, 0, 0.8);
109
+ border: 2px solid #00ff00;
110
+ border-radius: 0;
111
+ padding: 20px;
112
+ position: relative;
113
+ box-shadow:
114
+ 0 0 20px rgba(0, 255, 0, 0.3),
115
+ inset 0 0 20px rgba(0, 255, 0, 0.1);
116
+ }
117
+
118
+ .terminal::before {
119
+ content: '';
120
+ position: absolute;
121
+ top: 0;
122
+ left: 0;
123
+ right: 0;
124
+ height: 2px;
125
+ background: linear-gradient(90deg, transparent, #00ff00, transparent);
126
+ animation: sweep 2s infinite;
127
+ }
128
+
129
+ .terminal-header {
130
+ display: flex;
131
+ justify-content: between;
132
+ align-items: center;
133
+ margin-bottom: 20px;
134
+ padding-bottom: 10px;
135
+ border-bottom: 1px solid #00ff00;
136
+ }
137
+
138
+ .terminal-title {
139
+ font-size: 1.4rem;
140
+ font-weight: 700;
141
+ color: #00ff00;
142
+ text-transform: uppercase;
143
+ letter-spacing: 1px;
144
+ }
145
+
146
+ .terminal-status {
147
+ font-size: 0.8rem;
148
+ color: #00cccc;
149
+ font-family: 'Courier Prime', monospace;
150
+ }
151
+
152
+ .voice-controls {
153
+ display: flex;
154
+ flex-direction: column;
155
+ gap: 15px;
156
+ }
157
+
158
+ .hack-btn {
159
+ padding: 15px 30px;
160
+ border: 2px solid #00ff00;
161
+ background: rgba(0, 255, 0, 0.1);
162
+ color: #00ff00;
163
+ font-family: 'Orbitron', monospace;
164
+ font-size: 1rem;
165
+ font-weight: 700;
166
+ cursor: pointer;
167
+ transition: all 0.3s ease;
168
+ text-transform: uppercase;
169
+ letter-spacing: 2px;
170
+ position: relative;
171
+ overflow: hidden;
172
+ }
173
+
174
+ .hack-btn::before {
175
+ content: '';
176
+ position: absolute;
177
+ top: 0;
178
+ left: -100%;
179
+ width: 100%;
180
+ height: 100%;
181
+ background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.3), transparent);
182
+ transition: left 0.5s;
183
+ }
184
+
185
+ .hack-btn:hover::before {
186
+ left: 100%;
187
+ }
188
+
189
+ .hack-btn:hover {
190
+ background: rgba(0, 255, 0, 0.2);
191
+ box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
192
+ text-shadow: 0 0 10px #00ff00;
193
+ }
194
+
195
+ .hack-btn:disabled {
196
+ opacity: 0.5;
197
+ cursor: not-allowed;
198
+ }
199
+
200
+ .hack-btn.active {
201
+ background: rgba(255, 0, 0, 0.2);
202
+ border-color: #ff0000;
203
+ color: #ff0000;
204
+ animation: pulse-red 1s infinite;
205
+ }
206
+
207
+ .status-display {
208
+ padding: 15px;
209
+ border: 1px solid #00ff00;
210
+ background: rgba(0, 0, 0, 0.8);
211
+ margin: 15px 0;
212
+ font-family: 'Courier Prime', monospace;
213
+ font-size: 1rem;
214
+ position: relative;
215
+ }
216
+
217
+ .status-display::before {
218
+ content: '> ';
219
+ color: #00cccc;
220
+ }
221
+
222
+ .status-display.listening {
223
+ border-color: #ff0000;
224
+ color: #ff0000;
225
+ animation: pulse-red 1s infinite;
226
+ }
227
+
228
+ .status-display.processing {
229
+ border-color: #ffff00;
230
+ color: #ffff00;
231
+ animation: pulse-yellow 1s infinite;
232
+ }
233
+
234
+ .status-display.success {
235
+ border-color: #00ff00;
236
+ color: #00ff00;
237
+ animation: pulse-green 1s infinite;
238
+ }
239
+
240
+ .transcript-display {
241
+ margin-top: 15px;
242
+ padding: 10px;
243
+ background: rgba(0, 255, 0, 0.05);
244
+ border-left: 4px solid #00ff00;
245
+ font-family: 'Courier Prime', monospace;
246
+ font-style: italic;
247
+ min-height: 40px;
248
+ color: #00cccc;
249
+ }
250
+
251
+ .code-matrix {
252
+ width: 100%;
253
+ height: 200px;
254
+ background: rgba(0, 0, 0, 0.9);
255
+ border: 2px solid #00ff00;
256
+ padding: 15px;
257
+ color: #00ff00;
258
+ font-family: 'Courier Prime', monospace;
259
+ font-size: 14px;
260
+ resize: vertical;
261
+ box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.1);
262
+ }
263
+
264
+ .code-matrix:focus {
265
+ outline: none;
266
+ box-shadow:
267
+ inset 0 0 20px rgba(0, 255, 0, 0.2),
268
+ 0 0 20px rgba(0, 255, 0, 0.3);
269
+ }
270
+
271
+ .hack-commands {
272
+ display: flex;
273
+ gap: 15px;
274
+ margin-top: 15px;
275
+ }
276
+
277
+ .visualization-matrix {
278
+ grid-column: 1 / -1;
279
+ height: 400px;
280
+ border: 2px solid #00ff00;
281
+ overflow: hidden;
282
+ position: relative;
283
+ background: rgba(0, 0, 0, 0.9);
284
+ box-shadow:
285
+ 0 0 30px rgba(0, 255, 0, 0.3),
286
+ inset 0 0 30px rgba(0, 255, 0, 0.1);
287
+ }
288
+
289
+ .viz-header {
290
+ position: absolute;
291
+ top: 0;
292
+ left: 0;
293
+ right: 0;
294
+ padding: 10px 20px;
295
+ background: rgba(0, 0, 0, 0.8);
296
+ border-bottom: 1px solid #00ff00;
297
+ font-family: 'Courier Prime', monospace;
298
+ font-size: 0.9rem;
299
+ z-index: 5;
300
+ }
301
+
302
+ .canvas-matrix {
303
+ width: 100%;
304
+ height: 100%;
305
+ background: radial-gradient(circle at center, #001100 0%, #000000 100%);
306
+ }
307
+
308
+ .examples-matrix {
309
+ margin-top: 20px;
310
+ padding: 15px;
311
+ background: rgba(0, 255, 0, 0.05);
312
+ border: 1px solid #00ff00;
313
+ }
314
+
315
+ .examples-matrix h4 {
316
+ margin-bottom: 15px;
317
+ color: #00cccc;
318
+ font-family: 'Courier Prime', monospace;
319
+ text-transform: uppercase;
320
+ letter-spacing: 1px;
321
+ }
322
+
323
+ .command-list {
324
+ list-style: none;
325
+ padding: 0;
326
+ }
327
+
328
+ .command-list li {
329
+ padding: 8px 0;
330
+ color: #00ff00;
331
+ cursor: pointer;
332
+ font-family: 'Courier Prime', monospace;
333
+ border-left: 4px solid transparent;
334
+ padding-left: 10px;
335
+ transition: all 0.3s ease;
336
+ }
337
+
338
+ .command-list li::before {
339
+ content: '$ ';
340
+ color: #00cccc;
341
+ }
342
+
343
+ .command-list li:hover {
344
+ border-left-color: #00ff00;
345
+ background: rgba(0, 255, 0, 0.1);
346
+ text-shadow: 0 0 5px #00ff00;
347
+ }
348
+
349
+ /* Animations */
350
+ @keyframes flicker {
351
+ 0%, 100% { opacity: 1; }
352
+ 50% { opacity: 0.8; }
353
+ }
354
+
355
+ @keyframes scan {
356
+ 0% { left: -100%; }
357
+ 100% { left: 100%; }
358
+ }
359
+
360
+ @keyframes sweep {
361
+ 0% { transform: translateX(-100%); }
362
+ 100% { transform: translateX(100%); }
363
+ }
364
+
365
+ @keyframes pulse-red {
366
+ 0%, 100% { opacity: 1; }
367
+ 50% { opacity: 0.7; }
368
+ }
369
+
370
+ @keyframes pulse-yellow {
371
+ 0%, 100% { opacity: 1; }
372
+ 50% { opacity: 0.7; }
373
+ }
374
+
375
+ @keyframes pulse-green {
376
+ 0%, 100% { opacity: 1; }
377
+ 50% { opacity: 0.7; }
378
+ }
379
+
380
+ @keyframes matrix-fall {
381
+ 0% { transform: translateY(-100vh); }
382
+ 100% { transform: translateY(100vh); }
383
+ }
384
+
385
+ /* Responsive design */
386
+ @media (max-width: 768px) {
387
+ .controls {
388
+ grid-template-columns: 1fr;
389
+ }
390
+
391
+ .header h1 {
392
+ font-size: 2rem;
393
+ }
394
+
395
+ .hack-commands {
396
+ flex-direction: column;
397
+ }
398
+ }
399
+
400
+ /* Glitch effect for active states */
401
+ .glitch {
402
+ position: relative;
403
+ }
404
+
405
+ .glitch::before,
406
+ .glitch::after {
407
+ content: attr(data-text);
408
+ position: absolute;
409
+ top: 0;
410
+ left: 0;
411
+ width: 100%;
412
+ height: 100%;
413
+ }
414
+
415
+ .glitch::before {
416
+ animation: glitch-anim-1 0.3s infinite linear alternate-reverse;
417
+ color: #ff0000;
418
+ z-index: -1;
419
+ }
420
+
421
+ .glitch::after {
422
+ animation: glitch-anim-2 0.3s infinite linear alternate-reverse;
423
+ color: #00ffff;
424
+ z-index: -2;
425
+ }
426
+
427
+ @keyframes glitch-anim-1 {
428
+ 0% { clip: rect(42px, 9999px, 44px, 0); }
429
+ 25% { clip: rect(12px, 9999px, 59px, 0); }
430
+ 50% { clip: rect(25px, 9999px, 33px, 0); }
431
+ 75% { clip: rect(91px, 9999px, 94px, 0); }
432
+ 100% { clip: rect(65px, 9999px, 75px, 0); }
433
+ }
434
+
435
+ @keyframes glitch-anim-2 {
436
+ 0% { clip: rect(65px, 9999px, 119px, 0); }
437
+ 25% { clip: rect(52px, 9999px, 74px, 0); }
438
+ 50% { clip: rect(79px, 9999px, 85px, 0); }
439
+ 75% { clip: rect(29px, 9999px, 95px, 0); }
440
+ 100% { clip: rect(55px, 9999px, 87px, 0); }
441
+ }
442
+ </style>
443
+ </head>
444
+ <body>
445
+ <div class="matrix-bg">
446
+ <canvas id="matrixCanvas"></canvas>
447
+ </div>
448
+
449
+ <div class="container">
450
+ <div class="header">
451
+ <h1 class="glitch" data-text="MATRIX MUSIC HACKER">MATRIX MUSIC HACKER</h1>
452
+ <div class="subtitle">Voice-Controlled Beat Synthesis Protocol v2.1</div>
453
+ <div class="system-info">
454
+ <span>CONNECTION: SECURE</span>
455
+ <span>STATUS: ONLINE</span>
456
+ <span>PROTOCOL: STRUDEL.CC</span>
457
+ </div>
458
+ </div>
459
+
460
+ <div class="controls">
461
+ <div class="terminal">
462
+ <div class="terminal-header">
463
+ <div class="terminal-title">🎤 VOICE INPUT MODULE</div>
464
+ <div class="terminal-status">READY</div>
465
+ </div>
466
+ <div class="voice-controls">
467
+ <button id="startBtn" class="hack-btn">INITIATE VOICE HACK</button>
468
+ <button id="stopBtn" class="hack-btn" disabled>TERMINATE CONNECTION</button>
469
+ <div id="status" class="status-display">AWAITING VOICE COMMAND...</div>
470
+ <div id="transcript" class="transcript-display"></div>
471
+ </div>
472
+
473
+ <div class="examples-matrix">
474
+ <h4>AVAILABLE HACK COMMANDS:</h4>
475
+ <ul class="command-list">
476
+ <li onclick="useExample(this)">execute drum_sequence --deep-house</li>
477
+ <li onclick="useExample(this)">generate bass_matrix --underground</li>
478
+ <li onclick="useExample(this)">deploy synth_wave --cyberpunk</li>
479
+ <li onclick="useExample(this)">create ambient_hack --matrix</li>
480
+ <li onclick="useExample(this)">launch breakbeat --rave</li>
481
+ </ul>
482
+ </div>
483
+ </div>
484
+
485
+ <div class="terminal">
486
+ <div class="terminal-header">
487
+ <div class="terminal-title">💻 CODE MATRIX</div>
488
+ <div class="terminal-status">COMPILING</div>
489
+ </div>
490
+ <textarea id="codeArea" class="code-matrix" placeholder="// STRUDEL CODE WILL MATERIALIZE HERE...
491
+ // READY TO HACK THE MATRIX OF SOUND..."></textarea>
492
+ <div class="hack-commands">
493
+ <button id="playBtn" class="hack-btn">EXECUTE HACK</button>
494
+ <button id="stopMusicBtn" class="hack-btn">KILL PROCESS</button>
495
+ </div>
496
+ </div>
497
+ </div>
498
+
499
+ <div class="terminal visualization-matrix">
500
+ <div class="viz-header">
501
+ <span>🌊 AUDIO VISUALIZATION MATRIX - REAL-TIME FREQUENCY ANALYSIS</span>
502
+ <span style="float: right;">FPS: 60 | SAMPLES: 1024</span>
503
+ </div>
504
+ <canvas id="visualCanvas" class="canvas-matrix"></canvas>
505
+ </div>
506
+ </div>
507
+
508
+ <script>
509
+ // Global variables
510
+ let recognition;
511
+ let isListening = false;
512
+ let audioContext;
513
+ let analyzer;
514
+ let canvas;
515
+ let ctx;
516
+ let animationId;
517
+ let currentPattern;
518
+ let matrixCanvas;
519
+ let matrixCtx;
520
+ let matrixColumns = [];
521
+
522
+ // Initialize everything when page loads
523
+ window.addEventListener('load', function() {
524
+ initSpeechRecognition();
525
+ initVisualization();
526
+ initMatrixBackground();
527
+ });
528
+
529
+ // Matrix rain background
530
+ function initMatrixBackground() {
531
+ matrixCanvas = document.getElementById('matrixCanvas');
532
+ matrixCtx = matrixCanvas.getContext('2d');
533
+
534
+ function resizeMatrix() {
535
+ matrixCanvas.width = window.innerWidth;
536
+ matrixCanvas.height = window.innerHeight;
537
+
538
+ const columnCount = Math.floor(matrixCanvas.width / 20);
539
+ matrixColumns = [];
540
+ for (let i = 0; i < columnCount; i++) {
541
+ matrixColumns[i] = Math.random() * matrixCanvas.height;
542
+ }
543
+ }
544
+
545
+ resizeMatrix();
546
+ window.addEventListener('resize', resizeMatrix);
547
+
548
+ function drawMatrix() {
549
+ matrixCtx.fillStyle = 'rgba(0, 0, 0, 0.05)';
550
+ matrixCtx.fillRect(0, 0, matrixCanvas.width, matrixCanvas.height);
551
+
552
+ matrixCtx.fillStyle = '#00ff00';
553
+ matrixCtx.font = '15px monospace';
554
+
555
+ for (let i = 0; i < matrixColumns.length; i++) {
556
+ const text = String.fromCharCode(Math.random() * 128);
557
+ const x = i * 20;
558
+ const y = matrixColumns[i] * 20;
559
+
560
+ matrixCtx.fillText(text, x, y);
561
+
562
+ if (y > matrixCanvas.height && Math.random() > 0.975) {
563
+ matrixColumns[i] = 0;
564
+ }
565
+ matrixColumns[i]++;
566
+ }
567
+
568
+ requestAnimationFrame(drawMatrix);
569
+ }
570
+
571
+ drawMatrix();
572
+ }
573
+
574
+ // Speech Recognition Setup
575
+ function initSpeechRecognition() {
576
+ if (!('webkitSpeechRecognition' in window) && !('SpeechRecognition' in window)) {
577
+ document.getElementById('status').textContent = 'ERROR: VOICE RECOGNITION MODULE NOT FOUND';
578
+ return;
579
+ }
580
+
581
+ const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
582
+ recognition = new SpeechRecognition();
583
+
584
+ recognition.continuous = true;
585
+ recognition.interimResults = true;
586
+ recognition.lang = 'en-US';
587
+
588
+ recognition.onstart = function() {
589
+ isListening = true;
590
+ updateUI();
591
+ document.getElementById('status').textContent = 'VOICE HACK INITIATED... LISTENING FOR COMMANDS';
592
+ document.getElementById('status').className = 'status-display listening';
593
+ };
594
+
595
+ recognition.onresult = function(event) {
596
+ let transcript = '';
597
+ for (let i = event.resultIndex; i < event.results.length; i++) {
598
+ transcript += event.results[i][0].transcript;
599
+ }
600
+ document.getElementById('transcript').textContent = '> ' + transcript;
601
+
602
+ if (event.results[event.results.length - 1].isFinal) {
603
+ processVoiceHack(transcript);
604
+ }
605
+ };
606
+
607
+ recognition.onerror = function(event) {
608
+ document.getElementById('status').textContent = 'HACK FAILED: ' + event.error.toUpperCase();
609
+ document.getElementById('status').className = 'status-display';
610
+ isListening = false;
611
+ updateUI();
612
+ };
613
+
614
+ recognition.onend = function() {
615
+ isListening = false;
616
+ updateUI();
617
+ if (document.getElementById('status').textContent.includes('LISTENING')) {
618
+ document.getElementById('status').textContent = 'VOICE HACK TERMINATED... READY FOR NEW COMMAND';
619
+ document.getElementById('status').className = 'status-display';
620
+ }
621
+ };
622
+ }
623
+
624
+ // UI Event Handlers
625
+ document.getElementById('startBtn').addEventListener('click', function() {
626
+ if (recognition) {
627
+ recognition.start();
628
+ this.classList.add('active');
629
+ }
630
+ });
631
+
632
+ document.getElementById('stopBtn').addEventListener('click', function() {
633
+ if (recognition) {
634
+ recognition.stop();
635
+ document.getElementById('startBtn').classList.remove('active');
636
+ }
637
+ });
638
+
639
+ document.getElementById('playBtn').addEventListener('click', function() {
640
+ const code = document.getElementById('codeArea').value;
641
+ if (code.trim()) {
642
+ executeHack(code);
643
+ }
644
+ });
645
+
646
+ document.getElementById('stopMusicBtn').addEventListener('click', function() {
647
+ killProcess();
648
+ });
649
+
650
+ function updateUI() {
651
+ document.getElementById('startBtn').disabled = isListening;
652
+ document.getElementById('stopBtn').disabled = !isListening;
653
+
654
+ if (isListening) {
655
+ document.getElementById('startBtn').textContent = 'HACKING IN PROGRESS...';
656
+ } else {
657
+ document.getElementById('startBtn').textContent = 'INITIATE VOICE HACK';
658
+ document.getElementById('startBtn').classList.remove('active');
659
+ }
660
+ }
661
+
662
+ // Process voice input and convert to Strudel code
663
+ function processVoiceHack(transcript) {
664
+ document.getElementById('status').textContent = 'PROCESSING VOICE HACK... COMPILING AUDIO MATRIX';
665
+ document.getElementById('status').className = 'status-display processing';
666
+
667
+ const strudelCode = hackTheMatrix(transcript.toLowerCase());
668
+
669
+ document.getElementById('codeArea').value = strudelCode;
670
+ document.getElementById('status').textContent = 'HACK COMPILED SUCCESSFULLY... READY TO EXECUTE';
671
+ document.getElementById('status').className = 'status-display success';
672
+
673
+ // Auto-execute the hack
674
+ setTimeout(() => {
675
+ executeHack(strudelCode);
676
+ }, 1000);
677
+ }
678
+
679
+ // Enhanced cyberpunk conversion to Strudel code
680
+ function hackTheMatrix(input) {
681
+ const hackPatterns = [
682
+ {
683
+ keywords: ['drum', 'beat', 'kick', 'deep house', 'house'],
684
+ code: `// DEEP HOUSE MATRIX HACK
685
+ stack(
686
+ s("bd*4").gain(0.8).lpf(1000),
687
+ s("~ hh ~ hh").gain(0.6).hpf(8000),
688
+ s("~ ~ sd ~").gain(0.7).room(0.3)
689
+ ).slow(2)`
690
+ },
691
+ {
692
+ keywords: ['bass', 'underground', 'sub'],
693
+ code: `// UNDERGROUND BASS MATRIX
694
+ stack(
695
+ note("c1 ~ c1 ~").s('sawtooth').lpf(200).gain(0.9),
696
+ note("c2 eb2 f2 g2").s('sawtooth').lpf(400).delay(0.125),
697
+ s("bd ~ ~ ~").gain(0.8)
698
+ ).slow(2)`
699
+ },
700
+ {
701
+ keywords: ['synth', 'cyberpunk', 'wave', 'cyber'],
702
+ code: `// CYBERPUNK SYNTH WAVE
703
+ stack(
704
+ note("c4 eb4 g4 bb4").s('sawtooth').lpf(800).delay(0.25).room(0.5),
705
+ note("c3 ~ eb3 ~").s('square').lpf(400).gain(0.7),
706
+ s("bd hh sd hh").gain(0.6).room(0.2)
707
+ ).slow(1.5)`
708
+ },
709
+ {
710
+ keywords: ['ambient', 'matrix', 'atmospheric'],
711
+ code: `// MATRIX AMBIENT HACK
712
+ stack(
713
+ note("c3 eb3 g3 bb3").s('sawtooth').lpf(300).delay(0.5).room(0.9).slow(4),
714
+ note("c4 ~ ~ ~").s('sine').lpf(200).gain(0.5).slow(8),
715
+ s("~ ~ ~ bd").gain(0.3).room(0.8)
716
+ ).slow(2)`
717
+ },
718
+ {
719
+ keywords: ['breakbeat', 'rave', 'break', 'jungle'],
720
+ code: `// UNDERGROUND RAVE BREAKBEAT
721
+ stack(
722
+ s("bd*2 ~ sd bd").gain(0.8).speed(1.2),
723
+ s("~ hh*4 ~ hh*2").gain(0.4).hpf(10000),
724
+ note("c2 ~ f2 g2").s('sawtooth').lpf(600).gain(0.7)
725
+ ).fast(2)`
726
+ },
727
+ {
728
+ keywords: ['techno', 'industrial', 'machine'],
729
+ code: `// INDUSTRIAL TECHNO MATRIX
730
+ stack(
731
+ s("bd*4").gain(0.9).distort(0.3),
732
+ s("~ ~ sd ~").gain(0.7).room(0.1),
733
+ s("hh*8").gain(0.3).hpf(12000),
734
+ note("c2 ~ ~ c2").s('sawtooth').lpf(300).gain(0.6)
735
+ )`
736
+ }
737
+ ];
738
+
739
+ // Find the best matching hack pattern
740
+ for (const pattern of hackPatterns) {
741
+ if (pattern.keywords.some(keyword => input.includes(keyword))) {
742
+ return pattern.code;
743
+ }
744
+ }
745
+
746
+ // Default matrix hack if no match
747
+ return `// DEFAULT MATRIX HACK
748
+ stack(
749
+ s("bd ~ sd ~").gain(0.8).room(0.2),
750
+ s("~ hh ~ hh").gain(0.5).hpf(8000),
751
+ note("c2 ~ e2 ~").s('sawtooth').lpf(500)
752
+ )`;
753
+ }
754
+
755
+ // Execute the hack (play music)
756
+ function executeHack(code) {
757
+ try {
758
+ document.getElementById('status').textContent = 'HACK EXECUTED... INJECTING AUDIO INTO MATRIX';
759
+ document.getElementById('status').className = 'status-display success';
760
+
761
+ // Start visualization
762
+ startMatrixVisualization();
763
+
764
+ currentPattern = {
765
+ code: code,
766
+ playing: true,
767
+ startTime: Date.now()
768
+ };
769
+
770
+ } catch (error) {
771
+ console.error('Hack execution failed:', error);
772
+ document.getElementById('status').textContent = 'HACK EXECUTION FAILED... SYSTEM COMPROMISED';
773
+ }
774
+ }
775
+
776
+ function killProcess() {
777
+ if (currentPattern) {
778
+ currentPattern.playing = false;
779
+ currentPattern = null;
780
+ }
781
+ stopMatrixVisualization();
782
+ document.getElementById('status').textContent = 'PROCESS TERMINATED... MATRIX RESTORED';
783
+ document.getElementById('status').className = 'status-display';
784
+ }
785
+
786
+ // Visualization
787
+ function initVisualization() {
788
+ canvas = document.getElementById('visualCanvas');
789
+ ctx = canvas.getContext('2d');
790
+ resizeCanvas();
791
+
792
+ window.addEventListener('resize', resizeCanvas);
793
+ }
794
+
795
+ function resizeCanvas() {
796
+ const rect = canvas.getBoundingClientRect();
797
+ canvas.width = rect.width;
798
+ canvas.height = rect.height;
799
+ }
800
+
801
+ function startMatrixVisualization() {
802
+ if (animationId) return;
803
+
804
+ function animate() {
805
+ if (!currentPattern || !currentPattern.playing) {
806
+ stopMatrixVisualization();
807
+ return;
808
+ }
809
+
810
+ const width = canvas.width;
811
+ const height = canvas.height;
812
+ const time = (Date.now() - currentPattern.startTime) * 0.001;
813
+
814
+ // Clear with matrix-style fade
815
+ ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
816
+ ctx.fillRect(0, 0, width, height);
817
+
818
+ // Draw central matrix core
819
+ const centerX = width / 2;
820
+ const centerY = height / 2;
821
+
822
+ // Pulsing core
823
+ const coreRadius = 50 + Math.sin(time * 4) * 20;
824
+ const gradient = ctx.createRadialGradient(centerX, centerY, 0, centerX, centerY, coreRadius);
825
+ gradient.addColorStop(0, 'rgba(0, 255, 0, 0.8)');
826
+ gradient.addColorStop(0.5, 'rgba(0, 255, 0, 0.3)');
827
+ gradient.addColorStop(1, 'rgba(0, 255, 0, 0)');
828
+
829
+ ctx.fillStyle = gradient;