-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1155 lines (1004 loc) · 56.9 KB
/
Copy pathindex.html
File metadata and controls
1155 lines (1004 loc) · 56.9 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 lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aural Flux Synth</title>
<!-- Carga de Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Carga de Font Awesome para íconos de redes sociales -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<!-- Carga de Tone.js para manejo de audio -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.min.js"></script>
<!-- Configuración de Tailwind para usar la fuente Space Mono -->
<script>
tailwind.config = {
theme: {
extend: {
colors: {
'bg-dark': '#000000', /* Fondo negro sólido */
'panel-dark': '#0D1117',
'neon-glow': '#f472b6', /* Rosa primario */
'neon-accent': '#34d399', /* Verde acento */
'neon-yellow': '#facc15',
'midi-active': '#6366f1',
'fader-gray': '#a0aec0', /* Gris claro para el thumb/barra */
},
fontFamily: {
sans: ['"Space Mono"', 'monospace'],
},
}
}
}
</script>
<style>
/* Importamos la fuente Space Mono */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');
/* Variables y estilos base inspirados en el look retro-tech */
:root {
--glow-color: #f472b6;
--accent-color: #34d399;
--dark-background: #000000;
--border-color: #2f343a;
--fader-bar-color: #4a5568; /* Gris oscuro para la barra del fader */
}
body {
background-color: var(--dark-background);
color: #ffffff;
font-family: 'Space Mono', monospace;
text-shadow: 0 0 1px rgba(255, 255, 255, 0.2);
font-size: 0.8rem;
}
/* FIX: Todo texto blanco y sin negritas */
h1, h2, h3, h4, span, button, select, label {
font-weight: normal !important;
color: #ffffff !important;
}
/* FIX: Panel principal sin bordes visibles, solo un glow sutil */
.control-panel {
background-color: rgba(13, 17, 23, 0.9);
border: none;
box-shadow: 0 0 10px rgba(244, 114, 182, 0.2);
}
/* FIX: Títulos centrados */
.module-title {
text-align: center !important;
}
/* FIX: Títulos de sección (neon-title) */
.neon-title {
color: #ffffff !important; /* Título principal blanco, solo el SYNTH brilla */
text-shadow: none;
border-bottom: none;
}
.neon-title span {
color: var(--glow-color) !important;
text-shadow: 0 0 8px var(--glow-color), 0 0 15px rgba(244, 114, 182, 0.5);
}
/* FIX: Títulos de módulo (neon-text) */
.neon-text {
color: #ffffff !important;
text-shadow: none;
}
.key-dial {
width: 150px;
height: 150px;
border: 4px solid var(--glow-color);
background: rgba(13, 17, 23, 0.7);
transition: all 0.5s ease-out;
box-shadow: 0 0 20px var(--glow-color);
}
.key-text {
color: #fff !important;
text-shadow: 0 0 8px #fff;
}
@keyframes pulse-led {
0%, 100% { box-shadow: 0 0 5px currentColor, 0 0 10px currentColor; }
50% { box-shadow: 0 0 25px currentColor, 0 0 35px currentColor; }
}
.is-playing .pulse-indicator { animation: pulse-led 1.5s infinite alternate; }
/* --- Estilo para Faders Verticales --- */
input[type=range].vertical-fader {
-webkit-appearance: slider-vertical;
writing-mode: bt-lr;
width: 10px;
height: 90px;
margin: 0 8px;
cursor: pointer;
background: var(--fader-bar-color); /* FIX: Barra gris oscuro */
border-radius: 2px;
box-shadow: none;
}
input[type=range].large-fader {
height: 120px;
}
input[type=range].vertical-fader::-webkit-slider-thumb {
-webkit-appearance: none;
width: 24px;
height: 14px;
border-radius: 2px;
background: var(--fader-gray); /* FIX: Thumb gris claro */
cursor: pointer;
box-shadow: 0 0 8px rgba(160, 174, 190, 0.5);
border: 1px solid white;
}
/* FIX: Quitamos el contorno de todos los contenedores de faders */
.fader-group.vertical,
.control-panel > div {
background-color: transparent !important;
border: none !important;
box-shadow: none !important;
}
.fader-group.vertical .fader-label-text {
color: var(--accent-color) !important;
text-shadow: 0 0 3px var(--accent-color);
}
.fader-group.vertical .fader-value-text {
color: #fff !important;
text-shadow: 0 0 5px #fff;
min-width: 50px;
text-align: center;
font-size: 0.75rem;
}
.master-btn {
background-color: var(--accent-color);
color: var(--dark-background);
box-shadow: 0 0 10px var(--accent-color);
transition: all 0.1s;
}
.master-btn:hover {
background-color: #6ee7b7;
box-shadow: 0 0 15px var(--accent-color), 0 0 25px rgba(52, 211, 153, 0.5);
}
/* FIX: Footer y Redes Sociales */
footer {
font-size: 0.9rem !important;
}
.social-btn {
font-size: 1.5rem;
color: var(--neon-glow);
text-shadow: 0 0 5px var(--neon-glow);
transition: all 0.2s;
}
.social-btn:hover {
color: #ffffff;
text-shadow: 0 0 15px #ffffff;
}
</style>
</head>
<body class="font-sans min-h-screen p-4 md:p-8 flex flex-col items-center">
<header class="text-center mb-10">
<h1 class="text-3xl md:text-5xl text-white tracking-widest text-center">
AURAL FLUX <span class="neon-title text-3xl md:text-5xl ml-1">SYNTH</span>
</h1>
</header>
<!-- Módulo Unificado de Emulación -->
<main id="control-panel" class="control-panel rounded-lg p-6 md:p-10 w-full max-w-7xl flex flex-col lg:flex-row gap-4">
<!-- Columna Izquierda: Tonalidad, Master Vol y Chord Slots -->
<div class="lg:w-1/4 w-full space-y-5 p-4 rounded-lg">
<h3 class="text-xl neon-text border-b border-gray-700 pb-2 module-title">ENTRADA DE TONO</h3>
<!-- Indicador de Tonalidad Activa (Dial/Planeta) -->
<div id="active-key-dial" class="key-dial mx-auto rounded-full flex flex-col items-center justify-center pulse-indicator mb-4">
<span class="text-slate-400 text-xs">KEY ACTIVA</span>
<div class="key-text text-4xl" id="app-key-display">C</div>
<div class="text-base text-slate-300" id="app-scale-display">NEUTRAL</div>
</div>
<!-- Controles de Tonalidad (Key/Scale) -->
<div class="flex justify-around items-center p-2 rounded-lg" style="background-color: rgba(1, 4, 9, 0.7);">
<select id="key-select" class="bg-gray-800 text-white p-2 text-sm rounded-md focus:ring-neon-glow focus:border-neon-glow w-1/2 text-center border-2 border-transparent hover:border-neon-glow">
<!-- Notas se llenarán con JS -->
</select>
<select id="scale-select" class="bg-gray-800 text-white p-2 text-sm rounded-md focus:ring-neon-glow focus:border-neon-glow w-1/2 text-center ml-2 border-2 border-transparent hover:border-neon-glow">
<option value="Minor">MENOR</option>
<option value="Major">MAYOR</option>
<option value="Neutral">NEUTRAL</option>
</select>
</div>
<!-- Selector de Octava PAD -->
<div class="space-y-2 p-2 rounded-lg" style="background-color: rgba(1, 4, 9, 0.7);">
<h4 class="text-base text-white text-center">OCTAVA BASE</h4>
<div class="flex justify-center items-center">
<input type="range" id="octave-select" min="1" max="6" value="4" step="1" class="w-full h-2 rounded-lg appearance-none cursor-pointer bg-gray-700">
</div>
<span class="text-white block text-center text-sm" id="octave-label">4</span>
</div>
<hr class="border-gray-700">
<!-- MASTER VOLUMEN -->
<div class="flex flex-col items-center space-y-3">
<h4 class="text-xl neon-title border-b border-gray-800 pb-1 module-title">MASTER VOL</h4>
<div class="fader-group vertical h-32 w-1/2">
<input type="range" id="global-mix-slider" min="-60" max="0" value="-5" step="0.5" class="vertical-fader large-fader">
<span class="fader-value-text text-base" id="volume-label">-5.0 dB</span>
</div>
</div>
<hr class="border-gray-700">
<!-- Control de Progresión -->
<div class="space-y-3 p-4 rounded-lg" style="background-color: rgba(1, 4, 9, 0.7);">
<h4 class="text-xl neon-glow border-b border-gray-800 pb-2 module-title">PROGRESIÓN</h4>
<div id="note-slots" class="grid grid-cols-5 gap-2 text-center text-xs font-mono">
<!-- Slot 0 (Tónica base) -->
<div class="flex flex-col items-center">
<input type="checkbox" id="slot-0" class="w-4 h-4 accent-neon-yellow" checked>
<span class="text-slate-400 mt-1 progression-label text-xs">I</span>
</div>
<!-- Slots 1-4 (Notas relativas) -->
<div class="flex flex-col items-center">
<input type="checkbox" id="slot-1" class="w-4 h-4 accent-neon-glow" data-step="3" checked>
<span class="text-slate-400 mt-1 progression-label text-xs" id="slot-1-label">III</span>
</div>
<div class="flex flex-col items-center">
<input type="checkbox" id="slot-2" class="w-4 h-4 accent-neon-glow" data-step="7" checked>
<span class="text-slate-400 mt-1 progression-label text-xs" id="slot-2-label">V</span>
</div>
<div class="flex flex-col items-center">
<input type="checkbox" id="slot-3" class="w-4 h-4 accent-neon-glow" data-step="12">
<span class="text-slate-400 mt-1 progression-label text-xs" id="slot-3-label">VIII</span>
</div>
<div class="flex flex-col items-center">
<input type="checkbox" id="slot-4" class="w-4 h-4 accent-neon-glow" data-step="16">
<span class="text-slate-400 mt-1 progression-label text-xs" id="slot-4-label">IX</span>
</div>
</div>
<p class="text-xs text-gray-500 mt-2">Activa las notas para crear un acorde.</p>
</div>
</div>
<!-- Columna Central: ADSR, Filtro, Tremolo (Faders Verticales) -->
<div class="lg:w-1/3 w-full space-y-5 p-4 rounded-lg">
<h3 class="text-xl neon-title border-b border-gray-700 pb-2 module-title">SYNTH & MODULATION</h3>
<!-- Controles ADSR (Faders) -->
<div class="space-y-2">
<h4 class="text-lg text-white text-center border-b border-gray-800 pb-1 module-title">ADSR ENVELOPE</h4>
<div class="flex justify-around items-end p-2 rounded-lg" style="background-color: rgba(13, 17, 23, 0.9);">
<!-- Attack -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">ATTACK</span>
<input type="range" id="adsr-attack" min="0.01" max="5.0" value="2.0" step="0.01" class="vertical-fader">
<span class="fader-value-text text-xs" id="adsr-attack-label">2.00 s</span>
</div>
<!-- Decay -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">DECAY</span>
<input type="range" id="adsr-decay" min="0.01" max="5.0" value="0.5" step="0.01" class="vertical-fader">
<span class="fader-value-text text-xs" id="adsr-decay-label">0.50 s</span>
</div>
<!-- Sustain -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">SUSTAIN</span>
<input type="range" id="adsr-sustain" min="0.0" max="1.0" value="0.8" step="0.01" class="vertical-fader">
<span class="fader-value-text text-xs" id="adsr-sustain-label">0.80</span>
</div>
<!-- Release -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">RELEASE</span>
<input type="range" id="adsr-release" min="0.1" max="10.0" value="5.0" step="0.1" class="vertical-fader">
<span class="fader-value-text text-xs" id="adsr-release-label">5.0 s</span>
</div>
</div>
</div>
<hr class="border-gray-700">
<!-- Filtro (HP/LP) y Tremolo -->
<div class="space-y-3">
<h4 class="text-lg text-white text-center border-b border-gray-800 pb-1 module-title">FILTER & LFO</h4>
<div class="flex justify-around items-end p-2 rounded-lg" style="background-color: rgba(13, 17, 23, 0.9);">
<!-- Filtro Freq -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">FILT FREQ</span>
<input type="range" id="filter-freq" min="100" max="10000" value="1500" step="10" class="vertical-fader">
<span class="fader-value-text text-xs" id="filter-freq-label">1500 Hz</span>
</div>
<!-- Filtro Q -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">RES Q</span>
<input type="range" id="filter-q" min="0.1" max="20" value="1.0" step="0.1" class="vertical-fader">
<span class="fader-value-text text-xs" id="filter-q-label">1.0</span>
</div>
<!-- Tremolo Rate -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">LFO RATE</span>
<input type="range" id="tremolo-rate" min="0.1" max="10.0" value="1.0" step="0.1" class="vertical-fader">
<span class="fader-value-text text-xs" id="tremolo-rate-label">1.0 Hz</span>
</div>
<!-- Tremolo Depth -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">LFO DEPTH</span>
<input type="range" id="tremolo-depth" min="0.0" max="1.0" value="0.5" step="0.05" class="vertical-fader">
<span class="fader-value-text text-xs" id="tremolo-depth-label">0.50</span>
</div>
</div>
<div class="flex justify-around mt-2 text-xs">
<select id="filter-type" class="w-1/3 bg-gray-800 text-white p-1 text-xs rounded-md text-center border-2 border-transparent hover:border-neon-accent">
<option value="lowpass">LOWPASS</option>
<option value="highpass">HIGHPASS</option>
</select>
<select id="tremolo-type" class="w-1/3 bg-gray-800 text-white p-1 text-xs rounded-md text-center ml-2 border-2 border-transparent hover:border-neon-accent">
<option value="sine">SENO</option>
<option value="square">CUADRADA</option>
<option value="triangle">TRIÁNGULO</option>
</select>
<!-- BOTÓN ON/OFF TREMOLO -->
<button id="tremolo-bypass-btn" class="w-1/3 p-1 text-xs rounded-md ml-2 bg-gray-700 text-white transition duration-150 border border-gray-500 hover:border-white">
TREMOLO OFF
</button>
</div>
</div>
</div>
<!-- Columna Derecha: Efectos (EQ, Delay, Reverb) y Arpegiador -->
<div class="lg:w-1/3 w-full space-y-5 p-4 rounded-lg">
<h3 class="text-xl neon-title border-b border-gray-700 pb-2 module-title">FX & ARP</h3>
<!-- EQ de 3 Bandas (Faders) -->
<div class="space-y-2">
<h4 class="text-lg text-white text-center border-b border-gray-800 pb-1 module-title">ECUALIZADOR</h4>
<div class="flex justify-around items-end p-2 rounded-lg" style="background-color: rgba(13, 17, 23, 0.9);">
<!-- Low -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">LOW</span>
<input type="range" id="eq-low" min="-12" max="12" value="0" step="0.5" class="vertical-fader">
<span class="fader-value-text text-xs" id="eq-low-label">0.0 dB</span>
</div>
<!-- Mid -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">MID</span>
<input type="range" id="eq-mid" min="-12" max="12" value="0" step="0.5" class="vertical-fader">
<span class="fader-value-text text-xs" id="eq-mid-label">0.0 dB</span>
</div>
<!-- High -->
<div class="fader-group vertical">
<span class="fader-label-text text-xs">HIGH</span>
<input type="range" id="eq-high" min="-12" max="12" value="0" step="0.5" class="vertical-fader">
<span class="fader-value-text text-xs" id="eq-high-label">0.0 dB</span>
</div>
</div>
</div>
<hr class="border-gray-700">
<!-- Delay / Reverb / Arp Mix -->
<div class="space-y-2">
<h4 class="text-lg text-white text-center border-b border-gray-800 pb-1 module-title">SPACE EFFECTS</h4>
<div class="flex justify-around items-end p-2 rounded-lg" style="background-color: rgba(13, 17, 23, 0.9);">
<!-- Reverb Mix -->
<div class="fader-group vertical w-1/4">
<span class="fader-label-text text-xs">RVB MIX</span>
<input type="range" id="reverb-mix" min="0.0" max="1.0" value="0.3" step="0.01" class="vertical-fader">
<span class="fader-value-text text-xs" id="reverb-mix-label">0.30</span>
</div>
<!-- Delay Mix -->
<div class="fader-group vertical w-1/4">
<span class="fader-label-text text-xs">DLY MIX</span>
<input type="range" id="delay-mix" min="0.0" max="1.0" value="0.4" step="0.01" class="vertical-fader">
<span class="fader-value-text text-xs" id="delay-mix-label">0.40</span>
</div>
<!-- Delay Feedback -->
<div class="fader-group vertical w-1/4">
<span class="fader-label-text text-xs">DLY FBACK</span>
<input type="range" id="delay-feedback" min="0.0" max="0.9" value="0.6" step="0.05" class="vertical-fader">
<span class="fader-value-text text-xs" id="delay-feedback-label">0.60</span>
</div>
<!-- ARP VOL fader (pequeño) -->
<div class="fader-group vertical w-1/4">
<h4 class="fader-label-text text-xs text-white border-b border-gray-800 pb-1">ARP VOL</h4>
<input type="range" id="arp-mix" min="0.0" max="1.0" value="0.0" step="0.01" class="vertical-fader">
<span class="fader-value-text text-xs" id="arp-mix-label">0.00</span>
</div>
</div>
<!-- Delay/Reverb Selects (Horizontal) -->
<div class="flex justify-between gap-3 mt-2 text-xs">
<select id="delay-type" class="w-1/2 bg-gray-800 text-white p-1 text-xs rounded-md border-2 border-transparent hover:border-neon-glow">
<option value="digital">DLY: DIGITAL</option>
<option value="pingpong">DLY: PING PONG</option>
<option value="analog">DLY: TAPE</option>
</select>
<select id="delay-time" class="w-1/2 bg-gray-800 text-white p-1 text-xs rounded-md ml-2 border-2 border-transparent hover:border-neon-glow">
<option value="4n">TIME: 1/4 NOTA</option>
<option value="8n">TIME: 1/8 NOTA</option>
<option value="8t">TIME: 1/8 TRIPLE</option>
<option value="16n">TIME: 1/16 NOTA</option>
</select>
</div>
</div>
<hr class="border-gray-700">
<!-- Arpegiador Rate/Pattern y Master -->
<div class="flex justify-between items-center space-x-4">
<!-- Arp Controls -->
<div class="w-full space-y-2">
<h4 class="text-xl neon-text module-title">ARP CONTROL</h4>
<!-- Selector de Octava ARP -->
<div class="space-y-2 p-1 rounded-lg" style="background-color: rgba(1, 4, 9, 0.7);">
<h4 class="text-base text-white text-center">ARP OCTAVA</h4>
<div class="flex justify-center items-center">
<input type="range" id="arp-octave-select" min="-2" max="2" value="0" step="1" class="w-full h-2 rounded-lg appearance-none cursor-pointer bg-gray-700">
</div>
<span class="text-white block text-center text-sm" id="arp-octave-label">0</span>
</div>
<select id="arp-rate" class="w-full bg-gray-800 text-white p-1 text-xs rounded-md border-2 border-transparent hover:border-neon-accent">
<option value="120">120 BPM</option>
<option value="90">90 BPM</option>
<option value="60">60 BPM</option>
</select>
<select id="arp-pattern" class="w-full bg-gray-800 text-white p-1 text-xs rounded-md border-2 border-transparent hover:border-neon-accent">
<option value="up">UP</option>
<option value="down">DOWN</option>
<option value="upDown">UP/DOWN</option>
<option value="random">RANDOM</option>
</select>
<!-- Random Chance Fader -->
<div class="fader-group vertical h-16 w-full">
<span class="fader-label-text !relative top-0 text-xs">CHANCE (%)</span>
<input type="range" id="arp-random-chance" min="0" max="100" value="0" step="1" class="w-full h-2 rounded-lg appearance-none cursor-pointer bg-gray-700">
<span class="fader-value-text text-xs" id="arp-random-chance-label">0 %</span>
</div>
</div>
</div>
<!-- MIDI Status Indicator -->
<div id="midi-status" class="text-center p-2 rounded-lg text-xs bg-gray-900 border border-red-500 text-red-400">
MIDI: DESCONECTADO
</div>
<hr class="border-gray-700">
<!-- Botones de Control Maestro -->
<div class="flex space-x-4">
<button id="engage-btn" class="w-1/2 p-4 rounded-lg master-btn transition transform active:scale-98">
<span class="text-base" id="engage-label">ENGAGE (PLAY)</span>
</button>
<button id="abort-btn" class="w-1/2 p-4 rounded-lg bg-red-800 hover:bg-red-700 text-white shadow-2xl transition transform active:scale-98" style="box-shadow: 0 0 10px rgba(220, 38, 38, 0.7);">
ABORT
</button>
</div>
</div>
</main>
<!-- Footer -->
<footer class="mt-8 p-4 w-full max-w-7xl text-center text-xs text-gray-500 border-t border-gray-800 flex justify-between items-center">
<div class="flex items-center space-x-4">
<span class="text-white !text-sm">Aural Flux ©</span>
<span class="text-white !text-sm">Desarrollado por JuCa Noiz</span>
</div>
<div class="flex space-x-4">
<a href="https://www.tiktok.com/@juca.noiz" target="_blank" class="social-btn" title="TikTok">
<i class="fab fa-tiktok"></i>
</a>
<a href="https://www.instagram.com/jucanoiz/" target="_blank" class="social-btn" title="Instagram">
<i class="fab fa-instagram"></i>
</a>
<a href="https://www.facebook.com/juca.noiz.2025" target="_blank" class="social-btn" title="Facebook">
<i class="fab fa-facebook"></i>
</a>
</div>
</footer>
<script>
// --- Setup de Tone.js y variables globales ---
let isPlaying = false;
let audioContextReady = false;
let currentSynth = null;
let arpSynth = null;
let arpLoop = null;
let arpNotes = [];
let currentPadOctave = 4; // Octava base del Pad
let currentArpOctaveShift = 0; // Desplazamiento de octava del Arp
// Nodos Globales de FX y Ganancia
let arpMixerNode = null;
let arpFilter = null;
let rolandChorus = null;
let lpFilterPad = null;
let masterGain = null;
let tremolo = null;
let reverb = null;
let delay = null;
let pingPongDelay = null;
let chorus = null;
let activeDelayNode = null;
let eq3 = null;
let filter = null;
const chromaticNotes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
// --- Elementos del DOM y Controles (Abreviado) ---
const controlPanel = document.getElementById('control-panel');
const engageBtn = document.getElementById('engage-btn');
const keySelect = document.getElementById('key-select');
const scaleSelect = document.getElementById('scale-select');
const octaveSelect = document.getElementById('octave-select'); // Pad Octave
const arpOctaveSelect = document.getElementById('arp-octave-select'); // Arp Octave
const noteSlots = Array.from(document.querySelectorAll('#note-slots input[type="checkbox"]'));
const tremoloBypassBtn = document.getElementById('tremolo-bypass-btn');
const midiStatus = document.getElementById('midi-status');
const masterVolumeSlider = document.getElementById('global-mix-slider');
// Agrupación de controles para fácil acceso
const adsrControls = { attack: document.getElementById('adsr-attack'), decay: document.getElementById('adsr-decay'), sustain: document.getElementById('adsr-sustain'), release: document.getElementById('adsr-release') };
const tremoloControls = { type: document.getElementById('tremolo-type'), rate: document.getElementById('tremolo-rate'), depth: document.getElementById('tremolo-depth') };
const filterControls = { type: document.getElementById('filter-type'), freq: document.getElementById('filter-freq'), q: document.getElementById('filter-q') };
const eqControls = { low: document.getElementById('eq-low'), mid: document.getElementById('eq-mid'), high: document.getElementById('eq-high') };
const reverbControls = { mix: document.getElementById('reverb-mix'), decay: document.getElementById('reverb-decay') };
const delayControls = { type: document.getElementById('delay-type'), time: document.getElementById('delay-time'), mix: document.getElementById('delay-mix'), feedback: document.getElementById('delay-feedback') };
const arpControls = { rate: document.getElementById('arp-rate'), pattern: document.getElementById('arp-pattern'), mix: document.getElementById('arp-mix'), chance: document.getElementById('arp-random-chance') };
// Mapeo MIDI: Asignar CCs comunes a IDs de faders
const midiMap = {
1: 'global-mix-slider', // CC 1: Mod Wheel -> Master Vol
20: 'adsr-attack', // CC 20: Attack
21: 'adsr-decay', // CC 21: Decay
22: 'adsr-sustain', // CC 22: Sustain
23: 'adsr-release', // CC 23: Release
24: 'filter-freq', // CC 24: Filter Freq
25: 'filter-q', // CC 25: Filter Q
26: 'tremolo-rate', // CC 26: Tremolo Rate
27: 'tremolo-depth', // CC 27: Tremolo Depth
28: 'delay-mix', // CC 28: Delay Mix
29: 'reverb-mix', // CC 29: Reverb Mix
30: 'eq-mid', // CC 30: EQ Mid
31: 'arp-mix', // CC 31: ARP Mix
};
// --- Funciones de Utilidad ---
/** Actualiza el texto de la etiqueta de un fader. */
function updateKnobLabel(id, value, suffix = '') {
const targetId = id.endsWith('-label') ? id : id + '-label';
const targetLabel = document.getElementById(targetId);
if (targetLabel) {
const fixedValue = parseFloat(value).toFixed(Math.abs(value) < 1.0 && value.toString().includes('.') ? 2 : 1);
targetLabel.textContent = `${fixedValue}${suffix}`;
}
}
/** Calcula el set de notas. */
function getPadChord(baseNote, scale) {
const baseNoteName = baseNote.slice(0, -1);
// Usamos la octava del PAD para la nota base
const baseMidi = Tone.Midi(baseNoteName + currentPadOctave).toMidi();
let chordMidi = [];
noteSlots.forEach((slot, index) => {
if (slot.checked) {
let step = parseInt(slot.dataset.step || 0);
if (index === 0) {
// Tónica y las dos octavas inferiores
chordMidi.push(baseMidi);
chordMidi.push(baseMidi - 12);
chordMidi.push(baseMidi - 24);
} else {
chordMidi.push(baseMidi + step);
}
}
});
let uniqueMidi = [...new Set(chordMidi)].sort((a, b) => a - b);
// Arp Notes: Aplicamos el desplazamiento de octava (currentArpOctaveShift * 12 semitonos)
arpNotes = uniqueMidi
.filter(midi => Tone.Midi(midi).toNote().match(/\d/)?.[0] && Tone.Midi(midi).toNote().match(/\d/)?.[0] >= 3)
.map(midi => Tone.Midi(midi + (currentArpOctaveShift * 12)).toNote());
return uniqueMidi.map(midi => Tone.Midi(midi).toNote());
}
// --- Lógica de Audio (Tone.js) ---
/** Inicializa el Contexto de Audio y la cadena de efectos. */
async function initializeAudio() {
if (audioContextReady) return;
try {
// FIX: Iniciar el contexto de audio en el primer gesto del usuario
await Tone.start();
audioContextReady = true;
// 0. Transporte
Tone.Transport.start();
Tone.Transport.bpm.value = parseFloat(arpControls.rate.value);
// 1. Master Gain
masterGain = new Tone.Gain(Tone.dbToGain(parseFloat(masterVolumeSlider.value))).toDestination();
// FIX: HPF Sutil para limpiar ruido de sub-bajos del PAD
lpFilterPad = new Tone.Filter(30, 'highpass').connect(masterGain);
// Filtros y EQ del PAD principal
filter = new Tone.Filter(parseFloat(filterControls.freq.value), filterControls.type.value, -24);
filter.Q.value = parseFloat(filterControls.q.value);
eq3 = new Tone.EQ3(eqControls.low.value, eqControls.mid.value, eqControls.high.value);
// Tremolo (LFO)
tremolo = new Tone.Tremolo({
frequency: parseFloat(tremoloControls.rate.value),
depth: parseFloat(tremoloControls.depth.value),
type: tremoloControls.type.value,
wet: 1
}).start();
tremolo.wet.value = 0;
// Reverb
reverb = new Tone.Reverb({ decay: 4.0, preDelay: 0.01 }).connect(lpFilterPad);
reverb.wet.value = parseFloat(reverbControls.mix.value);
// Chorus estilo Roland
rolandChorus = new Tone.Chorus({
frequency: 1.5,
delayTime: 3.5,
depth: 0.7,
type: "triangle",
spread: 180,
wet: 0.3
}).connect(lpFilterPad);
// 2. Delays
delay = new Tone.FeedbackDelay(delayControls.time.value, parseFloat(delayControls.feedback.value)).set({ wet: parseFloat(delayControls.mix.value) });
pingPongDelay = new Tone.PingPongDelay(delayControls.time.value, parseFloat(delayControls.feedback.value)).set({ wet: parseFloat(delayControls.mix.value) });
chorus = new Tone.Chorus(4, 2.5, 0.5).set({ wet: parseFloat(delayControls.mix.value) });
activeDelayNode = delay;
// 3. Conexión de la cadena del Pad: Tremolo -> Filter -> EQ -> RolandChorus -> Delay -> Reverb -> HPF -> Master
tremolo.chain(filter, eq3, rolandChorus);
rolandChorus.chain(activeDelayNode);
activeDelayNode.connect(reverb);
// 4. Sintetizador Pad Atmosférico (Polifónico)
currentSynth = new Tone.PolySynth(Tone.FMSynth, {
volume: -10, // Bajamos un poco más la ganancia inicial del sinte
oscillator: { type: "sine" },
envelope: {
attack: parseFloat(adsrControls.attack.value),
decay: parseFloat(adsrControls.decay.value),
sustain: parseFloat(adsrControls.sustain.value),
release: parseFloat(adsrControls.release.value)
},
modulation: { type: "square" },
modulationEnvelope: { attack: 3, decay: 0.2, sustain: 1, release: 3 }
}).connect(tremolo);
// 5. Sintetizador y Loop de Arpegiador (Stranger Things Vibe)
arpFilter = new Tone.Filter(parseFloat(filterControls.freq.value), 'lowpass', -24);
arpFilter.Q.value = parseFloat(filterControls.q.value);
arpMixerNode = new Tone.Gain(parseFloat(arpControls.mix.value)).connect(lpFilterPad); // Conectado a HPF antes de Master
arpSynth = new Tone.Synth({
oscillator: { type: "pulse", width: 0.4 },
envelope: {
attack: parseFloat(adsrControls.attack.value),
decay: parseFloat(adsrControls.decay.value),
sustain: parseFloat(adsrControls.sustain.value),
release: parseFloat(adsrControls.release.value)
},
}).chain(arpFilter, arpMixerNode);
arpLoop = new Tone.Loop(time => {
if (arpNotes.length === 0 || !isPlaying) return;
const chance = parseFloat(arpControls.chance.value) / 100;
if (chance > 0 && Math.random() > chance) return;
const stepDuration = arpLoop.interval;
const totalSteps = arpNotes.length;
let noteIndex;
if (arpControls.pattern.value === 'random') {
noteIndex = Math.floor(Math.random() * totalSteps);
} else {
let index = Math.floor(Tone.Transport.getSecondsAtTime(time) / Tone.Time(stepDuration).toSeconds());
noteIndex = index % totalSteps;
if (arpControls.pattern.value === 'upDown') {
const cycleLength = totalSteps * 2 - 2;
let cycleStep = index % cycleLength;
noteIndex = cycleStep < totalSteps ? cycleStep : cycleLength - cycleStep;
}
}
arpSynth.triggerAttackRelease(arpNotes[noteIndex % totalSteps], stepDuration, time);
}, "8n").start(0);
setupMidiMapping();
applyControlListeners();
} catch (error) {
console.error("Error al inicializar Tone.js:", error);
}
}
/** Inicializa la escucha MIDI. */
function setupMidiMapping() {
if (!navigator.requestMIDIAccess) {
midiStatus.textContent = "MIDI: API NO SOPORTADA";
midiStatus.classList.replace('border-red-500', 'border-yellow-500');
midiStatus.classList.replace('text-red-400', 'text-yellow-400');
return;
}
navigator.requestMIDIAccess()
.then(midiAccess => {
const inputs = midiAccess.inputs.values();
let connected = false;
for (let input of inputs) {
input.onmidimessage = onMidiMessage;
connected = true;
}
if (connected) {
midiStatus.textContent = "MIDI: CONECTADO. CONTROLADORES LISTOS.";
midiStatus.classList.replace('border-red-500', 'border-midi-active');
midiStatus.classList.replace('text-red-400', 'text-neon-accent');
midiStatus.classList.add('connected');
} else {
midiStatus.textContent = "MIDI: DESCONECTADO. (NO HAY DISPOSITIVOS)";
midiStatus.classList.remove('connected');
}
midiAccess.onstatechange = () => setupMidiMapping();
})
.catch(e => {
midiStatus.textContent = `MIDI: ERROR DE ACCESO: ${e.message}`;
});
}
/** Manejador de mensajes MIDI. */
function onMidiMessage(event) {
const [status, data1, data2] = event.data;
const messageType = status & 0xF0;
if (messageType === 0xB0) {
const ccNumber = data1;
const inputElement = document.getElementById(midiMap[ccNumber]);
if (inputElement) {
const min = parseFloat(inputElement.min);
const max = parseFloat(inputElement.max);
const mappedValue = min + (max - min) * (data2 / 127);
inputElement.value = mappedValue;
inputElement.dispatchEvent(new Event('input'));
inputElement.style.boxShadow = `0 0 10px 2px var(--midi-active)`;
setTimeout(() => inputElement.style.boxShadow = 'none', 100);
}
}
}
/** Actualiza el set de notas del arpegiador y el BPM. */
function updateArpSettings() {
if (!arpLoop || !audioContextReady) return;
getPadChord(keySelect.value, scaleSelect.value);
Tone.Transport.bpm.value = parseFloat(arpControls.rate.value);
const arpMixValue = parseFloat(arpControls.mix.value);
if(arpMixerNode){
arpMixerNode.gain.rampTo(arpMixValue, 0.1);
}
updateKnobLabel('arp-mix', arpMixValue);
}
/** Actualiza el tipo de delay y reconecta. */
function updateDelayType(type) {
if (!tremolo || !reverb || !filter || !eq3 || !rolandChorus) return;
tremolo.disconnect();
filter.disconnect();
eq3.disconnect();
rolandChorus.disconnect();
activeDelayNode.disconnect(reverb);
switch (type) {
case 'pingpong': activeDelayNode = pingPongDelay; break;
case 'analog': activeDelayNode = chorus; break;
case 'digital': default: activeDelayNode = delay;
}
tremolo.chain(filter, eq3, rolandChorus);
rolandChorus.chain(activeDelayNode);
activeDelayNode.connect(reverb);
activeDelayNode.wet.value = parseFloat(delayControls.mix.value);
if (activeDelayNode.feedback) activeDelayNode.feedback.value = parseFloat(delayControls.feedback.value);
if (activeDelayNode.delayTime) activeDelayNode.delayTime.value = delayControls.time.value;
}
/** Reproduce o actualiza el pad de manera inmediata. */
function playPad(note, scale, forceTrigger = false) {
if (!audioContextReady || !currentSynth || !arpSynth) return;
const notes = getPadChord(note, scale);
updateArpSettings();
if (notes.length === 0) {
stopPad();
return;
}
const envelopeSettings = {
attack: parseFloat(adsrControls.attack.value),
decay: parseFloat(adsrControls.decay.value),
sustain: parseFloat(adsrControls.sustain.value),
release: parseFloat(adsrControls.release.value)
};
currentSynth.set({ envelope: envelopeSettings });
arpSynth.set({ envelope: envelopeSettings });
if (isPlaying && !forceTrigger) {
if (currentSynth.activeSources && currentSynth.activeSources.length > 0) {
currentSynth.releaseAll(Tone.now());
}
currentSynth.triggerAttack(notes, Tone.now());
isPlaying = true;
} else if (!isPlaying || forceTrigger) {
if (currentSynth.activeSources && currentSynth.activeSources.length > 0) {
currentSynth.releaseAll(Tone.now());
}
currentSynth.triggerAttack(notes, Tone.now());
isPlaying = true;
updateVisualsPlaying(true);
}
}
/** Detiene el pad. */
function stopPad() {
if (!isPlaying || !currentSynth) return;
if (currentSynth.activeSources && currentSynth.activeSources.length > 0) {
currentSynth.triggerRelease(currentSynth.activeSources.map(s => s.note), Tone.now());
}
isPlaying = false;
updateVisualsPlaying(false);
}
/** Detiene el pad de forma inmediata (ABORT). */
function abortPad() {
if (!currentSynth) return;
currentSynth.releaseAll(Tone.now());
isPlaying = false;
updateVisualsPlaying(false);
}
// --- Lógica de Interfaz y Eventos ---
/** Inicializa UI y listeners. */
function initializeUI() {
chromaticNotes.forEach(note => {
const opt = document.createElement('option');
opt.value = note + '4';
opt.textContent = note;
keySelect.appendChild(opt);
});
const initialKey = keySelect.value;
const initialScale = scaleSelect.value;
updateAppDisplay({ key: initialKey, scale: initialScale, color: 'neon-glow' });
// Inicializar las etiquetas de las octavas
document.getElementById('octave-label').textContent = octaveSelect.value;
document.getElementById('arp-octave-label').textContent = arpOctaveSelect.value;
document.querySelectorAll('input[type="range"]').forEach(fader => {
const id = fader.id;
const value = fader.value;
let suffix = '';
if (id === 'global-mix-slider' || id.includes('eq')) {
suffix = ' dB';
} else if (id.includes('mix') || id.includes('depth') || id.includes('sustain') || id.includes('feedback') || id.includes('q')) {
suffix = '';
} else if (id.includes('rate') || id.includes('freq')) {
suffix = ' Hz';
} else if (id.includes('decay') || id.includes('attack') || id.includes('release')) {
suffix = ' s';
} else if (id.includes('chance')) {
suffix = ' %';
}
updateKnobLabel(id, value, suffix);
});
noteSlots.forEach(slot => {
slot.addEventListener('change', () => {
updateSlotLabels(keySelect.value, scaleSelect.value);
if (isPlaying) playPad(keySelect.value, scaleSelect.value);
});
});
updateSlotLabels(keySelect.value, scaleSelect.value);
tremoloBypassBtn.textContent = 'TREMOLO OFF';
tremoloBypassBtn.classList.replace('bg-red-800', 'bg-gray-700');
tremoloBypassBtn.classList.remove('bg-slate-500');
}
/** Actualiza las etiquetas de los slots de notas (ahora en Romanos). */
function updateSlotLabels(baseNote, scale) {
const isMajor = scale === 'Major';
const slotData = [
{ step: 0, label: 'I' },
{ step: (isMajor ? 4 : 3), label: 'III' },
{ step: 7, label: 'V' },
{ step: 12, label: 'VIII' },
{ step: (isMajor ? 14 : 10), label: (isMajor ? 'IX' : 'VII') },
];
slotData.slice(1).forEach((data, index) => {
const slotIndex = index + 1;
const slotElement = document.getElementById(`slot-${slotIndex}`);
const labelElement = document.getElementById(`slot-${slotIndex}-label`);
if (slotElement) {
slotElement.dataset.step = data.step;
labelElement.textContent = data.label;
}
});
}
/** Actualiza el indicador central de Tonalidad. */
function updateAppDisplay(patch) {
const note = patch.key.slice(0, -1);
const scale = patch.scale;
document.getElementById('app-key-display').textContent = note;
document.getElementById('app-scale-display').textContent = scale.toUpperCase();
const colorMap = { 'neon-glow': '#f472b6', 'neon-accent': '#34d399', 'neon-yellow': '#facc15' };
const colorCode = colorMap[patch.color] || colorMap['neon-glow'];
document.getElementById('active-key-dial').style.borderColor = colorCode;
document.getElementById('active-key-dial').style.color = colorCode;
}
/** Actualiza los indicadores visuales. */
function updateVisualsPlaying(playing) {
if (playing) {
controlPanel.classList.add('is-playing');
document.getElementById('engage-label').textContent = 'ENGAGED';
engageBtn.style.backgroundColor = 'var(--glow-color)';
engageBtn.style.boxShadow = `0 0 15px var(--glow-color)`;
Tone.Transport.scheduleOnce(time => Tone.Transport.bpm.value = parseFloat(arpControls.rate.value), 0);
} else {
controlPanel.classList.remove('is-playing');
document.getElementById('engage-label').textContent = 'ENGAGE (PLAY)';
engageBtn.style.backgroundColor = 'var(--accent-color)';