Repository navigation
Expand file tree
/
Copy pathwave.html
More file actions
2587 lines (2354 loc) · 113 KB
/
Copy pathwave.html
File metadata and controls
2587 lines (2354 loc) · 113 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="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover" />
<meta name="theme-color" content="#F7F9FD" />
<title>Wave Voice Studio</title>
<style>
@font-face{font-family:'Aicon';src:url('./aicon-semibold.otf') format('opentype');font-weight:600;font-display:swap}
:root{
--bg-0:#F7F9FD; --bg-1:#EDF2F9; --bg-2:#E1E8F4;
--ink:#1E2A52; --ink-mid:#2C3E80; --ink-soft:#4D5DA8; --muted:#8A92BE;
--hair:rgba(0,0,0,.16); --hair-strong:rgba(0,0,0,.30);
--brand:#7C3AED; --brand-light:#A855F7; --brand-deep:#6D28D9;
--aqua:#00B8D4; --cyan:#60D7E8; --mint:#10D9A0; --emerald:#0EA672;
--coral:#FF6B5C; --tangerine:#FFB02E; --amber:#E89A2B; --rose:#E0457B;
--shadow-sm:0 1px 2px rgba(40,60,120,.06), 0 4px 12px rgba(40,60,120,.07);
--shadow-md:0 1px 3px rgba(40,60,120,.07), 0 12px 30px rgba(40,60,120,.10);
}
*{box-sizing:border-box;-webkit-font-smoothing:antialiased}
html,body{margin:0;color:var(--ink-mid)}
body{
font-family:-apple-system,'SF Pro Display',BlinkMacSystemFont,'Inter','Segoe UI',sans-serif;
min-height:100vh;padding:14px;padding-top:calc(24px + env(safe-area-inset-top));
background:
radial-gradient(900px 600px at 12% -10%, rgba(124,58,237,.10), transparent 60%),
radial-gradient(700px 500px at 110% 5%, rgba(0,184,212,.10), transparent 65%),
radial-gradient(800px 600px at 50% 110%, rgba(168,85,247,.07), transparent 60%),
radial-gradient(700px 500px at -5% 80%, rgba(96,215,232,.06), transparent 65%),
linear-gradient(180deg,var(--bg-0) 0%,var(--bg-1) 60%,var(--bg-2) 100%);
background-attachment:fixed;
max-width:720px;margin:0 auto;
}
/* Header */
header{display:flex;align-items:center;justify-content:space-between;padding:2px 6px;margin-bottom:10px;flex-wrap:wrap;gap:10px}
.page-nav{display:flex;gap:6px;padding:0 6px 8px;flex-wrap:wrap}
.page-nav a{font-size:12px;font-weight:600;padding:4px 12px;border-radius:8px;background:var(--bg-2);color:var(--ink-soft);text-decoration:none;transition:all .2s}
.page-nav a:hover{background:var(--brand);color:#fff}
.page-nav a.active{background:var(--brand);color:#fff;pointer-events:none}
.brand-mark{display:flex;align-items:center;gap:14px}
.brand-mark .glyph{
width:72px;height:72px;border-radius:16px;
background:transparent;
display:grid;place-items:center;overflow:visible;
}
.brand-mark .glyph img{
width:110%;height:110%;object-fit:contain;display:block;
filter:drop-shadow(0 4px 12px rgba(124,58,237,.22)) drop-shadow(0 0 8px rgba(0,184,212,.28));
}
.brand-mark h1{
margin:0;font-family:'Aicon',sans-serif;font-size:30px;font-weight:600;letter-spacing:-.02em;
color:transparent;
background:linear-gradient(135deg,#7C3AED 0%,#06B6D4 100%);
-webkit-background-clip:text;background-clip:text;
filter:drop-shadow(0 1px 0 rgba(255,255,255,.60)) drop-shadow(0 2px 6px rgba(124,58,237,.25));
}
.brand-mark .tag{font-size:10px;font-weight:600;color:var(--ink-soft);letter-spacing:.08em;text-transform:uppercase;margin-top:2px}
.crumbs{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.crumb{
font-size:10.5px;font-weight:600;color:var(--ink-soft);
padding:5px 10px;border-radius:99px;
background:rgba(255,255,255,.65);border:1px solid var(--hair);
backdrop-filter:blur(10px);letter-spacing:.02em;
}
.crumb b{color:var(--brand);font-weight:700}
/* Panels */
.panel{
position:relative;padding:16px 18px;border-radius:18px;margin-bottom:12px;
background:linear-gradient(155deg,rgba(255,255,255,.92) 0%,rgba(255,255,255,.74) 100%);
backdrop-filter:blur(40px) saturate(180%);
box-shadow:inset 0 1.5px 0 rgba(255,255,255,1),inset 0 -1px 0 rgba(255,255,255,.4),var(--shadow-sm);
--g1:#7C3AED;--g2:#06B6D4;
}
.panel::after{
content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;
background:radial-gradient(60% 40% at 100% 0%,color-mix(in oklab,var(--g1) 18%,transparent),transparent 70%),
linear-gradient(180deg,rgba(255,255,255,.50) 0%,transparent 28%);
opacity:.85;
}
.panel::before{
content:'';position:absolute;inset:0;border-radius:inherit;padding:1.2px;
background:linear-gradient(135deg,var(--g1),var(--g2));
-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
-webkit-mask-composite:xor;mask-composite:exclude;
pointer-events:none;opacity:.85;
}
h3{
margin:0 0 10px;font-size:11px;font-weight:800;color:var(--ink);
letter-spacing:.10em;text-transform:uppercase;
display:flex;align-items:center;gap:8px;position:relative;z-index:1;
}
h3 .swatch{
width:8px;height:8px;border-radius:99px;
background:linear-gradient(135deg,var(--g1),var(--g2));
box-shadow:0 0 0 3px rgba(255,255,255,.85),0 3px 8px rgba(40,60,120,.22);
}
h3 small{font-size:9.5px;font-weight:600;color:var(--muted);letter-spacing:.05em;text-transform:none;margin-left:auto}
/* Form elements */
select,textarea,input[type=text]{
width:100%;padding:9px 12px;border-radius:10px;
border:1px solid var(--hair);background:rgba(255,255,255,.85);
color:var(--ink-mid);font-size:13px;font-weight:500;font-family:inherit;
outline:none;transition:.15s;box-shadow:inset 0 1px 0 rgba(255,255,255,.95);
}
select:hover,textarea:hover{background:#fff;border-color:var(--hair-strong)}
select:focus,textarea:focus{
border-color:var(--brand);background:#fff;
box-shadow:0 0 0 3px rgba(124,58,237,.13),inset 0 1px 0 rgba(255,255,255,.95);
}
textarea{min-height:120px;resize:vertical;line-height:1.55}
label{font-size:10px;color:var(--ink-soft);font-weight:700;letter-spacing:.06em;text-transform:uppercase;display:block;margin-bottom:5px}
/* Voice chips */
.voice-chip-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:5px;margin-bottom:8px}
.voice-chip{
padding:8px 4px;border-radius:10px;border:1px solid var(--hair);
background:rgba(255,255,255,.85);
color:var(--ink-soft);font-size:11px;
font-weight:700;text-align:center;cursor:pointer;transition:.18s;position:relative;z-index:1;
}
.voice-chip:hover{background:#fff;border-color:var(--hair-strong);transform:translateY(-1px)}
.voice-chip.active{
background:linear-gradient(135deg,var(--brand),var(--brand-light));
color:#fff;border-color:transparent;
box-shadow:0 2px 8px rgba(124,58,237,.30);
}
.voice-chip .gender{font-size:8px;display:block;opacity:.7;margin-top:1px}
.voice-chip{position:relative}
.voice-test-btn{
position:absolute;top:4px;right:4px;width:20px;height:20px;border-radius:50%;
border:1px solid var(--hair);background:rgba(255,255,255,.85);color:var(--ink-soft);
font-size:9px;cursor:pointer;display:grid;place-items:center;padding:0;
opacity:0;transition:opacity .15s,background .15s;line-height:1;
}
.voice-chip:hover .voice-test-btn{opacity:1}
.voice-test-btn:hover{background:#fff;color:var(--brand)}
.voice-test-btn.playing{opacity:1;background:var(--brand);color:#fff;border-color:var(--brand)}
/* Generate button */
button{padding:7px 14px;border:1px solid transparent;border-radius:10px;cursor:pointer;font-weight:700;font-size:11.5px;letter-spacing:.02em;transition:.18s;font-family:inherit}
.btn-go{
background:linear-gradient(180deg,#A855F7 0%,#7C3AED 100%);
color:#fff;border-color:rgba(255,255,255,.20);
box-shadow:inset 0 1px 0 rgba(255,255,255,.40),0 4px 12px rgba(124,58,237,.35);
width:100%;padding:14px;font-size:14px;letter-spacing:.03em;margin-top:8px;
}
.btn-go:hover{transform:translateY(-1px);box-shadow:inset 0 1px 0 rgba(255,255,255,.45),0 8px 18px rgba(124,58,237,.45)}
.btn-go:disabled{opacity:.5;cursor:wait;transform:none}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes pulse-bg{0%,100%{opacity:.7}50%{opacity:1}}
.btn-go.generating{position:relative;pointer-events:none}
.btn-go.generating::after{content:'';position:absolute;right:16px;top:50%;width:18px;height:18px;margin-top:-9px;border:2.5px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .6s linear infinite}
/* Char counter */
.char-counter{font-size:10px;font-weight:600;color:var(--muted);text-align:right;margin-top:4px;transition:color .2s;position:relative;z-index:1}
.char-counter.warn{color:#E89A2B}
.char-counter.over{color:#E0457B}
/* Status */
.status-bar{
padding:8px 12px;border-radius:10px;font-size:11px;font-weight:600;
color:var(--ink-soft);margin-bottom:12px;
background:rgba(255,255,255,.7);border:1px solid var(--hair);
min-height:32px;display:flex;align-items:center;gap:8px;position:relative;z-index:1;
}
.status-bar .badge{padding:3px 8px;border-radius:6px;font-size:9.5px;font-weight:700;color:#fff;background:#FF9800;letter-spacing:.03em}
.status-bar .badge.ok{background:#4CAF50}
/* Progress */
.progress-bar{height:4px;border-radius:99px;background:rgba(124,58,237,.12);overflow:hidden;margin-top:6px;display:none}
.progress-bar.show{display:block}
.progress-fill{height:100%;background:linear-gradient(90deg,var(--brand),var(--aqua));border-radius:99px;width:0%;transition:width .3s ease}
.gen-overlay{display:none;align-items:center;gap:10px;padding:12px 16px;border-radius:12px;background:linear-gradient(135deg,rgba(124,58,237,.10),rgba(0,184,212,.10));border:1px solid rgba(124,58,237,.18);margin-top:10px;font-size:12px;font-weight:700;color:var(--brand);animation:pulse-bg 1.8s ease-in-out infinite}
.gen-overlay.show{display:flex}
.gen-spinner{width:20px;height:20px;border:3px solid rgba(124,58,237,.18);border-top-color:var(--brand);border-radius:50%;animation:spin .6s linear infinite;flex-shrink:0}
.gen-overlay .gen-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Output */
audio{width:100%;margin-top:8px;border-radius:10px;height:36px}
.dl-row{display:flex;gap:7px;margin-top:8px}
.dl-btn{
flex:1;padding:8px 0;border-radius:10px;border:none;
font-weight:700;font-size:12px;cursor:pointer;transition:.15s;letter-spacing:.01em;
display:flex;align-items:center;justify-content:center;gap:5px;
}
.dl-btn-wav{
background:linear-gradient(135deg,#7C3AED,#06B6D4);color:#fff;
box-shadow:0 3px 10px rgba(124,58,237,.30);
}
.dl-btn-wav:hover{filter:brightness(1.10);box-shadow:0 5px 16px rgba(124,58,237,.40);transform:translateY(-1px)}
.dl-btn-mp3{
background:linear-gradient(135deg,#10B981,#059669);color:#fff;
box-shadow:0 3px 10px rgba(16,185,129,.28);
}
.dl-btn-mp3:hover{filter:brightness(1.10);box-shadow:0 5px 16px rgba(16,185,129,.38);transform:translateY(-1px)}
.dl-btn:disabled{opacity:.55;cursor:wait;transform:none!important}
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 20px;color:var(--muted);text-align:center;position:relative;z-index:1}
.empty-state .icon{font-size:42px;margin-bottom:10px;opacity:.5}
.empty-state p{font-size:12px;font-weight:600}
.result-stats{display:flex;gap:12px;margin-top:6px;flex-wrap:wrap;position:relative;z-index:1}
.stat{font-size:10.5px;font-weight:600;color:var(--muted)}
.stat b{color:var(--ink);font-weight:700}
/* Collapsible sections */
.section-toggle{
display:flex;align-items:center;gap:8px;width:100%;padding:10px 14px;
border-radius:12px;border:1px solid var(--hair);
background:rgba(255,255,255,.7);color:var(--ink-soft);
font-size:11px;font-weight:700;cursor:pointer;transition:.18s;
margin-bottom:8px;letter-spacing:.04em;text-transform:uppercase;
}
.section-toggle:hover{background:rgba(255,255,255,.9);border-color:var(--hair-strong)}
.section-toggle.open{background:rgba(124,58,237,.06);border-color:rgba(124,58,237,.2);color:var(--brand)}
.section-toggle .arrow{margin-left:auto;font-size:9px;transition:transform .2s}
.section-toggle.open .arrow{transform:rotate(180deg)}
.section-toggle .badge-count{margin-left:auto;padding:2px 7px;border-radius:5px;font-size:9px;background:rgba(124,58,237,.1);color:var(--brand)}
.collapsible{display:none;animation:fadeIn .2s ease}
.collapsible.open{display:block}
@keyframes fadeIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
/* Slider */
.row{display:flex;gap:8px;align-items:center;margin-bottom:6px;flex-wrap:wrap;position:relative;z-index:1}
.slider-wrap{display:flex;flex:1;gap:8px;align-items:center;min-width:0}
input[type=range]{
flex:1;-webkit-appearance:none;appearance:none;height:4px;border-radius:99px;
background:linear-gradient(90deg,var(--brand) 0%,var(--brand) var(--p,50%),rgba(60,80,140,.14) var(--p,50%));
outline:none;min-width:60px;
}
input[type=range]::-webkit-slider-thumb{
-webkit-appearance:none;width:14px;height:14px;border-radius:50%;
background:#fff;border:2px solid var(--brand);cursor:pointer;margin-top:-5px;
box-shadow:0 2px 6px rgba(124,58,237,.30);transition:transform .15s;
}
input[type=range]::-webkit-slider-thumb:hover{transform:scale(1.2)}
.factor-val{font-family:'SF Mono',ui-monospace,monospace;color:var(--brand);min-width:42px;text-align:right;font-size:11px;font-weight:700;background:rgba(124,58,237,.08);padding:2px 7px;border-radius:6px}
/* Language */
.lang-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(90px,1fr));gap:4px;margin-bottom:8px;position:relative;z-index:1}
.lang-chip{
padding:5px 6px;border-radius:8px;border:1px solid var(--hair);
background:rgba(255,255,255,.85);
color:var(--ink-soft);font-size:10px;
font-weight:600;text-align:center;cursor:pointer;transition:.18s;
}
.lang-chip:hover{background:#fff;border-color:var(--hair-strong)}
.lang-chip.active{background:linear-gradient(135deg,#7C3AED,var(--aqua));color:#fff;border-color:transparent}
/* Voice Library */
.vlib-search{
display:flex;gap:6px;margin-bottom:10px;position:relative;z-index:1;
}
.vlib-search input{
flex:1;padding:8px 12px 8px 32px;border-radius:10px;border:1px solid var(--hair);
background:rgba(255,255,255,.85);color:var(--ink-mid);font-size:12px;font-weight:500;
font-family:inherit;outline:none;transition:.15s;
}
.vlib-search input:focus{border-color:var(--brand);background:#fff;box-shadow:0 0 0 3px rgba(124,58,237,.13)}
.vlib-search .search-icon{
position:absolute;left:10px;top:50%;transform:translateY(-50%);
width:14px;height:14px;color:var(--muted);pointer-events:none;
}
.vlib-grid{
display:grid;grid-template-columns:repeat(3,1fr);gap:5px;
max-height:280px;overflow-y:auto;overflow-x:hidden;
position:relative;z-index:1;padding-right:2px;
scrollbar-width:thin;scrollbar-color:rgba(124,58,237,.2) transparent;
}
.vlib-grid::-webkit-scrollbar{width:4px}
.vlib-grid::-webkit-scrollbar-thumb{background:rgba(124,58,237,.2);border-radius:99px}
.vlib-card{
padding:10px 8px;border-radius:10px;border:1px solid var(--hair);
background:rgba(255,255,255,.85);cursor:pointer;transition:.18s;
text-align:center;position:relative;
}
.vlib-card:hover{background:#fff;border-color:var(--hair-strong);transform:translateY(-1px)}
.vlib-card.active{
background:linear-gradient(135deg,rgba(124,58,237,.12),rgba(6,182,212,.10));
border-color:rgba(124,58,237,.35);
}
.vlib-card.cloning{opacity:.7;pointer-events:none}
.vlib-card .vlib-name{font-size:11px;font-weight:700;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.vlib-card .vlib-tag{font-size:8px;font-weight:600;color:var(--muted);margin-top:2px}
.vlib-card .vlib-gender{font-size:8px;font-weight:700;margin-top:3px}
.vlib-card .vlib-gender.male{color:#3B82F6}
.vlib-card .vlib-gender.female{color:#EC4899}
.vlib-card .vlib-gender.unknown{color:var(--muted)}
.vlib-filters{display:flex;gap:4px;position:relative;z-index:1;margin-bottom:6px;flex-wrap:wrap}
.vlib-filter-btn{padding:3px 10px;border-radius:20px;border:1px solid var(--hair);background:rgba(255,255,255,.85);font-size:10px;font-weight:600;color:var(--ink-mid);cursor:pointer;transition:.15s;font-family:inherit}
.vlib-filter-btn:hover{border-color:var(--hair-strong);background:#fff}
.vlib-filter-btn.active{background:linear-gradient(135deg,rgba(124,58,237,.15),rgba(6,182,212,.12));border-color:rgba(124,58,237,.35);color:var(--ink)}
.vlib-card .vlib-cached{
position:absolute;top:4px;right:4px;width:8px;height:8px;
border-radius:50%;background:var(--mint);
box-shadow:0 0 0 2px rgba(255,255,255,.9);
}
.vlib-card .vlib-spinner{
position:absolute;top:4px;right:4px;width:12px;height:12px;
border:2px solid rgba(124,58,237,.15);border-top-color:var(--brand);
border-radius:50%;animation:spin .6s linear infinite;
}
.vlib-status{font-size:10px;font-weight:600;color:var(--muted);margin-top:6px;min-height:16px;position:relative;z-index:1}
.vlib-count{font-size:9px;font-weight:600;color:var(--muted);position:relative;z-index:1;margin-bottom:6px}
/* Clone panel special */
.panel-clone{--g1:#7C3AED;--g2:#06B6D4}
.clone-drop-zone{
border:2px dashed rgba(124,58,237,.35);border-radius:12px;padding:24px 16px;
text-align:center;cursor:pointer;transition:.18s;background:rgba(124,58,237,.04);
margin-bottom:10px;position:relative;z-index:1;
}
.clone-drop-zone:hover{background:rgba(124,58,237,.08);border-color:rgba(124,58,237,.55)}
.clone-drop-zone.dragover{background:rgba(124,58,237,.12);border-color:var(--brand);transform:scale(1.01)}
.clone-drop-zone .drop-icon{font-size:28px;margin-bottom:4px}
.clone-drop-zone .drop-text{font-size:11px;font-weight:700;color:var(--ink-soft)}
.clone-drop-zone .drop-hint{font-size:9px;color:var(--muted);margin-top:2px}
.clone-actions{display:flex;gap:8px;margin-bottom:10px;align-items:center;position:relative;z-index:1}
.clone-record-btn{
padding:7px 16px;border-radius:9px;border:none;cursor:pointer;
font-size:11px;font-weight:700;
background:linear-gradient(180deg,#E879A0,#D8226C);color:#fff;
box-shadow:inset 0 1px 0 rgba(255,255,255,.35),0 4px 12px rgba(216,34,108,.30);
transition:.18s;
}
.clone-record-btn:hover{transform:translateY(-1px);box-shadow:0 6px 16px rgba(216,34,108,.40)}
.clone-record-btn.recording{
background:linear-gradient(180deg,#FF3030,#CC0000);
animation:pulse-bg 1.2s ease-in-out infinite;
}
.clone-btn{
padding:7px 18px;border-radius:9px;border:none;cursor:pointer;
font-size:11px;font-weight:700;
background:linear-gradient(135deg,#7C3AED,#06B6D4);color:#fff;
box-shadow:0 3px 10px rgba(124,58,237,.30);transition:.18s;
}
.clone-btn:hover{transform:translateY(-1px);box-shadow:0 6px 16px rgba(124,58,237,.40)}
.clone-btn:disabled{opacity:.5;cursor:wait;transform:none}
.clone-status{font-size:10px;color:var(--muted);font-weight:600}
.clone-preview{display:none;margin-bottom:10px;position:relative;z-index:1}
.clone-preview.show{display:block}
.clone-waveform{width:100%;height:48px;border-radius:8px;background:rgba(124,58,237,.06);border:1px solid rgba(124,58,237,.15);display:block}
/* Emotion chips */
.emotion-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:5px;position:relative;z-index:1}
.emotion-chip{
padding:6px 4px;border-radius:10px;border:1px solid var(--hair);
background:rgba(255,255,255,.85);
color:var(--ink-soft);font-size:10px;
font-weight:700;text-align:center;cursor:pointer;transition:.18s;
}
.emotion-chip:hover{background:#fff;border-color:var(--hair-strong);transform:translateY(-1px)}
.emotion-chip.active{border-color:transparent;box-shadow:0 2px 8px rgba(0,0,0,.15)}
.emotion-chip[data-em="happy"].active{background:linear-gradient(135deg,#00E8A0,#10B981);color:#fff}
.emotion-chip[data-em="sad"].active{background:linear-gradient(135deg,#2080FF,#1A4DD9);color:#fff}
.emotion-chip[data-em="excited"].active{background:linear-gradient(135deg,#FF9500,#E07800);color:#fff}
.emotion-chip[data-em="calm"].active{background:linear-gradient(135deg,#9B5EFF,#7C3AED);color:#fff}
.emotion-chip[data-em="angry"].active{background:linear-gradient(135deg,#FF3030,#CC0000);color:#fff}
/* Toggle */
.toggle{display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;padding:7px 10px;background:rgba(255,255,255,.55);border-radius:10px;border:1px solid var(--hair);transition:.15s;position:relative;z-index:1}
.toggle:hover{background:#fff;transform:translateY(-1px)}
.toggle input{display:none}
.toggle .dot{width:28px;height:16px;border-radius:99px;background:rgba(60,80,140,.16);position:relative;flex-shrink:0;transition:.18s;box-shadow:inset 0 1px 2px rgba(40,60,120,.15)}
.toggle .dot::after{content:'';position:absolute;width:12px;height:12px;border-radius:50%;background:#fff;top:2px;left:2px;transition:.18s;box-shadow:0 1px 3px rgba(40,60,120,.30)}
.toggle input:checked + .dot{background:linear-gradient(135deg,var(--brand),var(--aqua))}
.toggle input:checked + .dot::after{transform:translateX(12px)}
.toggle-label{flex:1;min-width:0}
.toggle-label .t-name{font-size:11px;font-weight:700;color:var(--ink-soft);display:block}
.toggle:has(input:checked) .toggle-label .t-name{color:var(--brand)}
/* Multi-speaker */
.ms-script{
width:100%;min-height:100px;resize:vertical;line-height:1.6;padding:10px 12px;
font-size:12px;font-family:'SF Mono',ui-monospace,monospace;
border:1px solid var(--hair);border-radius:9px;
background:rgba(255,255,255,.85);color:var(--ink-mid);
outline:none;transition:.15s;
}
.ms-script:focus{border-color:var(--brand);background:#fff;box-shadow:0 0 0 3px rgba(124,58,237,.13)}
/* Voice Changer */
.vc-drop-zone{
border:2px dashed rgba(124,58,237,.35);border-radius:12px;padding:20px 16px;
text-align:center;cursor:pointer;transition:.18s;background:rgba(124,58,237,.04);
margin-bottom:10px;position:relative;z-index:1;
}
.vc-drop-zone:hover{background:rgba(124,58,237,.08);border-color:rgba(124,58,237,.55)}
/* History */
.history-list{max-height:240px;overflow-y:auto;display:flex;flex-direction:column;gap:4px;position:relative;z-index:1}
.history-item{
display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:8px;
border:1px solid var(--hair);background:rgba(255,255,255,.85);
font-size:10px;font-weight:600;color:var(--ink-soft);cursor:pointer;transition:.15s;
}
.history-item:hover{background:#fff;border-color:var(--hair-strong)}
.history-item .h-voice{color:var(--brand);font-weight:700;min-width:50px}
.history-item .h-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-item .h-play{
width:20px;height:20px;border-radius:5px;border:1px solid rgba(124,58,237,.2);
background:rgba(124,58,237,.08);color:var(--brand);font-size:8px;cursor:pointer;
display:flex;align-items:center;justify-content:center;padding:0;transition:.15s;
}
.history-item .h-play:hover{background:var(--brand);color:#fff}
.history-empty{font-size:10px;color:var(--muted);font-weight:600;font-style:italic;text-align:center;padding:12px}
/* STT mic */
.composer-textarea-wrap{position:relative;display:flex;flex-direction:column;flex:1;min-height:0;z-index:1}
.stt-mic-btn{
position:absolute;bottom:10px;right:10px;z-index:10;
width:36px;height:36px;border-radius:50%;border:none;cursor:pointer;
background:linear-gradient(135deg,var(--brand),var(--aqua));color:#fff;
display:flex;align-items:center;justify-content:center;
box-shadow:0 3px 10px rgba(124,58,237,.30);transition:.2s;
}
.stt-mic-btn:hover{transform:scale(1.10);box-shadow:0 5px 16px rgba(124,58,237,.40)}
.stt-mic-btn.listening{
background:linear-gradient(135deg,#FF3030,#E0457B);
box-shadow:0 0 0 0 rgba(255,48,48,.50);
animation:stt-pulse 1.4s ease-in-out infinite;
}
@keyframes stt-pulse{
0%{box-shadow:0 0 0 0 rgba(255,48,48,.50)}
70%{box-shadow:0 0 0 12px rgba(255,48,48,0)}
100%{box-shadow:0 0 0 0 rgba(255,48,48,0)}
}
.stt-mic-btn svg{width:18px;height:18px;flex-shrink:0}
/* Waveform progress bar */
.waveform-bar{
width:100%;height:40px;border-radius:8px;background:rgba(124,58,237,.06);
border:1px solid rgba(124,58,237,.12);cursor:pointer;position:relative;
overflow:hidden;margin-top:8px;display:none;
}
.waveform-bar.show{display:block}
.waveform-canvas{width:100%;height:100%;display:block}
.waveform-progress{position:absolute;top:0;left:0;height:100%;background:rgba(124,58,237,.12);pointer-events:none;transition:width .1s linear}
/* DSP toggle grid */
.dsp-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;position:relative;z-index:1}
/* Mobile warning */
.mobile-warning{display:none;padding:10px 14px;border-radius:10px;background:linear-gradient(135deg,rgba(124,58,237,.08),rgba(0,184,212,.08));border:1px solid rgba(124,58,237,.20);margin-bottom:12px;font-size:11px;font-weight:600;color:var(--ink-soft);line-height:1.5;text-align:center}
/* ───── tablet (768px) ───── */
@media(max-width:768px){
.mobile-warning{display:block}
body{padding:10px}
header{gap:8px}
.brand-mark .glyph{width:56px;height:56px}
.brand-mark h1{font-size:24px}
.voice-chip-grid{grid-template-columns:repeat(3,1fr)}
.emotion-grid{grid-template-columns:repeat(3,1fr)}
.vlib-grid{grid-template-columns:repeat(3,1fr);max-height:240px}
.dsp-grid{grid-template-columns:1fr}
.panel{padding:14px 14px;border-radius:14px}
.dl-row{flex-wrap:wrap}
.clone-actions{flex-wrap:wrap}
.row label{min-width:50px}
textarea{min-height:100px}
}
/* ───── mobile (480px) ───── */
@media(max-width:480px){
body{padding:8px}
header{flex-direction:column;align-items:flex-start}
.brand-mark .glyph{width:48px;height:48px}
.brand-mark h1{font-size:20px}
.brand-mark .tag{font-size:9px}
.crumbs{width:100%;overflow-x:auto;flex-wrap:nowrap;gap:4px;padding-bottom:2px}
.crumb{font-size:9px;padding:4px 8px;white-space:nowrap;flex-shrink:0}
.voice-chip-grid{grid-template-columns:repeat(2,1fr)}
.emotion-grid{grid-template-columns:repeat(2,1fr)}
.vlib-grid{grid-template-columns:repeat(2,1fr);max-height:220px}
.voice-chip{padding:10px 4px;font-size:10px;min-height:44px}
.panel{padding:12px 10px;border-radius:12px;margin-bottom:10px}
h3{font-size:10px;gap:6px}
.status-bar{font-size:10px;padding:8px 10px}
.btn-go{padding:14px 12px;font-size:13px;min-height:48px}
.section-toggle{padding:12px 14px;font-size:10px;min-height:44px}
.clone-drop-zone{padding:18px 12px}
.clone-drop-zone .drop-text{font-size:10px}
.clone-record-btn{min-height:44px;padding:10px 16px}
.clone-btn{min-height:44px;padding:10px 18px}
.dl-btn{min-height:44px;padding:10px 0}
.toggle{min-height:44px}
.lang-grid{grid-template-columns:repeat(auto-fill,minmax(75px,1fr))}
textarea{min-height:90px;font-size:12px}
.ms-script{min-height:80px;font-size:11px}
}
</style>
</head>
<body>
<header>
<div class="brand-mark">
<div class="glyph"><img src="./logo-color-trans.png?v=2" alt="Wave logo"></div>
<div>
<h1>Wave</h1>
<div class="tag">voice studio</div>
</div>
</div>
<div class="crumbs">
<span class="crumb">Engine <b>Wave</b></span>
<span class="crumb" id="crumbModel">Model <b>100M</b></span>
<span class="crumb" id="crumbChars"><b id="charCrumb">0</b> chars</span>
</div>
</header>
<nav class="page-nav">
<a href="./">Home</a>
<a href="./wave.html" class="active">Wave</a>
<a href="./supertonic.html">Supertonic</a>
<a href="./kokoro/">Kokoro</a>
</nav>
<!-- Status -->
<div class="status-bar" id="statusBar">
<span id="statusText">Ready — load model to begin</span>
<span class="badge" id="runtimeBadge" style="display:none">ONNX</span>
</div>
<div class="mobile-warning">
Wave uses large AI models. For the best experience, use a desktop browser with a stable connection.
</div>
<!-- ===== BUILT-IN VOICES ===== -->
<div class="panel" style="--g1:#06B6D4;--g2:#0891B2">
<h3><span class="swatch"></span> Built-in Voices <small>8 voices</small></h3>
<div class="voice-chip-grid" id="voiceGrid">
<div class="voice-chip active" data-voice="aria">Aria<span class="gender">Female</span><button class="voice-test-btn" data-voice="aria" title="Test voice">▶</button></div>
<div class="voice-chip" data-voice="luna">Luna<span class="gender">Female</span><button class="voice-test-btn" data-voice="luna" title="Test voice">▶</button></div>
<div class="voice-chip" data-voice="nova">Nova<span class="gender">Female</span><button class="voice-test-btn" data-voice="nova" title="Test voice">▶</button></div>
<div class="voice-chip" data-voice="stella">Stella<span class="gender">Female</span><button class="voice-test-btn" data-voice="stella" title="Test voice">▶</button></div>
<div class="voice-chip" data-voice="orion">Orion<span class="gender">Male</span><button class="voice-test-btn" data-voice="orion" title="Test voice">▶</button></div>
<div class="voice-chip" data-voice="atlas">Atlas<span class="gender">Male</span><button class="voice-test-btn" data-voice="atlas" title="Test voice">▶</button></div>
<div class="voice-chip" data-voice="rex">Rex<span class="gender">Male</span><button class="voice-test-btn" data-voice="rex" title="Test voice">▶</button></div>
<div class="voice-chip" data-voice="sage">Sage<span class="gender">Neutral</span><button class="voice-test-btn" data-voice="sage" title="Test voice">▶</button></div>
</div>
</div>
<!-- ===== COMMUNITY VOICE LIBRARY ===== -->
<button class="section-toggle" id="toggleVoiceLib">
🎤 Community Voice Library
<span class="badge-count" id="vlibBadge">voices</span>
<span class="arrow">▼</span>
</button>
<div class="collapsible" id="voicelibSection">
<div class="panel" style="--g1:#A855F7;--g2:#06B6D4">
<h3><span class="swatch"></span> Voice Library <small>Pre-computed · instant activation</small></h3>
<div class="vlib-search">
<svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
<input type="text" id="vlibSearch" placeholder="Search voices...">
</div>
<div class="vlib-filters" id="vlibFilters">
<button class="vlib-filter-btn active" data-filter="all">All</button>
<button class="vlib-filter-btn" data-filter="male">♂ Male</button>
<button class="vlib-filter-btn" data-filter="female">♀ Female</button>
</div>
<div class="vlib-count" id="vlibCount">Loading voice catalog...</div>
<div class="vlib-grid" id="vlibGrid"></div>
<div class="vlib-status" id="vlibStatus"></div>
</div>
</div>
<!-- ===== TEXT INPUT ===== -->
<div class="panel" style="--g1:#4A2D9C;--g2:#005BB3">
<h3><span class="swatch"></span> Text</h3>
<div class="composer-textarea-wrap">
<textarea id="text" placeholder="Type or paste the text you want to hear...">The ocean waves crashed against the shore, carrying whispers of ancient stories told by sailors long forgotten. Each ripple held a memory, and the wind sang their tales anew.</textarea>
<button type="button" class="stt-mic-btn" id="sttMicBtn" title="Dictate with microphone">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="2" width="6" height="11" rx="3"/><path d="M19 10v1a7 7 0 0 1-14 0v-1"/><line x1="12" y1="21" x2="12" y2="18"/></svg>
</button>
</div>
<div class="char-counter" id="charCounter">0 / 5000</div>
</div>
<!-- ===== GENERATE ===== -->
<button class="btn-go" id="goBtn">Generate Speech</button>
<div class="progress-bar" id="progressBar"><div class="progress-fill" id="progressFill"></div></div>
<div class="gen-overlay" id="genOverlay"><div class="gen-spinner"></div><span class="gen-text" id="genText">Generating speech...</span></div>
<!-- ===== OUTPUT ===== -->
<div class="panel" style="margin-top:12px;--g1:#059669;--g2:#10B981">
<h3><span class="swatch"></span> Output</h3>
<div id="outputArea">
<div class="empty-state" id="emptyOutput">
<div class="icon">🎙️</div>
<p>Generated speech will appear here</p>
</div>
<div id="outputResult" style="display:none;position:relative;z-index:1">
<div class="waveform-bar show" id="waveformBar">
<div class="waveform-progress" id="waveformProgress"></div>
<canvas class="waveform-canvas" id="waveformCanvas"></canvas>
</div>
<audio id="player" controls style="display:none"></audio>
<div class="result-stats" id="resultStats"></div>
<div class="dl-row" id="dlRow">
<button class="dl-btn dl-btn-wav" id="dlWav">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
WAV
</button>
<button class="dl-btn dl-btn-mp3" id="dlMp3">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
MP3
</button>
</div>
</div>
</div>
</div>
<!-- ===== MODEL LOADER (auto) ===== -->
<div class="panel" style="--g1:#E89A2B;--g2:#FF6B5C" id="modelPanel">
<h3><span class="swatch"></span> Model</h3>
<div style="position:relative;z-index:1">
<div style="display:flex;gap:8px;align-items:center;margin-bottom:8px;flex-wrap:wrap">
<span id="modelStatus" style="font-size:11px;font-weight:700;color:var(--ink-soft)">Preparing to download...</span>
<span id="modelSize" style="font-size:10px;font-weight:600;color:var(--muted);margin-left:auto">0 / ~146 MB</span>
</div>
<div class="progress-bar show" id="modelProgressBar" style="height:8px;border-radius:6px;background:rgba(0,0,0,.06);overflow:hidden;margin-bottom:6px">
<div class="progress-fill" id="modelProgressFill" style="height:100%;width:0%;border-radius:6px;background:linear-gradient(90deg,#E89A2B,#FF6B5C);transition:width .3s"></div>
</div>
<div id="modelFileList" style="display:none"></div>
<div style="font-size:9px;color:var(--muted);margin-top:6px">INT8 quantized · cached after first download · runs 100% on-device</div>
</div>
</div>
<!-- ===== VOICE CLONING (star feature) ===== -->
<div class="panel panel-clone">
<h3><span class="swatch"></span> Voice Cloning <small>Upload or record a voice sample</small></h3>
<div class="clone-drop-zone" id="cloneDropZone">
<div class="drop-icon">🎙</div>
<div class="drop-text">Drop a voice sample here or click to browse</div>
<div class="drop-hint">.wav .mp3 .ogg · 5-15 seconds of clean speech</div>
<input type="file" id="cloneFileInput" accept=".wav,.mp3,.ogg,audio/wav,audio/mpeg,audio/ogg" style="display:none">
</div>
<div class="clone-actions">
<button class="clone-record-btn" id="cloneRecordBtn">● Record Sample</button>
<button class="clone-btn" id="cloneBtn" disabled>Clone Voice</button>
<span class="clone-status" id="cloneStatus"></span>
</div>
<div class="clone-preview" id="clonePreview">
<div style="font-size:9px;font-weight:700;color:var(--muted);letter-spacing:.10em;text-transform:uppercase;margin-bottom:4px;position:relative;z-index:1">Voice Sample Preview</div>
<canvas class="clone-waveform" id="cloneWaveform"></canvas>
<audio id="clonePlayer" controls style="width:100%;height:32px;border-radius:8px;margin-top:4px"></audio>
</div>
<div id="clonedVoiceChip" style="display:none;position:relative;z-index:1">
<div style="display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:10px;background:linear-gradient(135deg,rgba(124,58,237,.10),rgba(6,182,212,.08));border:1px solid rgba(124,58,237,.25)">
<span style="font-size:16px">🧬</span>
<span style="font-size:11px;font-weight:700;color:var(--brand)">Cloned Voice Active</span>
<button id="clearCloneBtn" style="margin-left:auto;padding:3px 8px;border-radius:6px;border:1px solid var(--hair);background:rgba(255,255,255,.8);color:var(--ink-soft);font-size:9px;font-weight:700;cursor:pointer">Clear</button>
</div>
</div>
<div style="font-size:8.5px;color:var(--muted);line-height:1.4;margin-top:6px;position:relative;z-index:1">By using voice cloning you confirm you have consent from the speaker. You are solely responsible for how you use generated audio.</div>
</div>
<!-- ===== ADVANCED SETTINGS (collapsed) ===== -->
<button class="section-toggle" id="toggleAdvanced">
⚙ Advanced Settings
<span class="arrow">▼</span>
</button>
<div class="collapsible" id="advancedSection">
<!-- Language -->
<div class="panel" style="--g1:#3D7BC9;--g2:#B2DAE4">
<h3><span class="swatch"></span> Language</h3>
<div class="lang-grid" id="langGrid">
<div class="lang-chip active" data-lang="en">English</div>
<div class="lang-chip" data-lang="fr">French</div>
<div class="lang-chip" data-lang="de">German</div>
<div class="lang-chip" data-lang="pt">Portuguese</div>
<div class="lang-chip" data-lang="it">Italian</div>
<div class="lang-chip" data-lang="es">Spanish</div>
</div>
</div>
<!-- Speed & Temperature -->
<div class="panel" style="--g1:#029456;--g2:#B2DAE4">
<h3><span class="swatch"></span> Controls</h3>
<div class="row">
<label style="min-width:80px">Speed</label>
<div class="slider-wrap">
<input type="range" id="speed" min="0.5" max="2.0" step="0.05" value="1.0">
<span class="factor-val" id="speedVal">1.00x</span>
</div>
</div>
<div class="row">
<label style="min-width:80px">Temperature</label>
<div class="slider-wrap">
<input type="range" id="temperature" min="0" max="1.5" step="0.05" value="0.7">
<span class="factor-val" id="tempVal">0.70</span>
</div>
</div>
</div>
<!-- Speech-to-Text config -->
<div class="panel" style="--g1:#2563FF;--g2:#00B8D4">
<h3><span class="swatch"></span> Speech-to-Text</h3>
<div class="row" style="position:relative;z-index:1">
<label style="min-width:80px">STT Lang</label>
<select id="sttLang" style="flex:1">
<option value="en-US">English (US)</option>
<option value="fr-FR">French</option>
<option value="de-DE">German</option>
<option value="pt-BR">Portuguese</option>
<option value="it-IT">Italian</option>
<option value="es-ES">Spanish</option>
</select>
</div>
</div>
</div>
<!-- ===== PRO FEATURES (collapsed) ===== -->
<button class="section-toggle" id="togglePro">
⚡ Pro Features
<span class="arrow">▼</span>
</button>
<div class="collapsible" id="proSection">
<!-- Voice Mixer -->
<div class="panel" style="--g1:#A020F0;--g2:#7C3AED">
<h3><span class="swatch"></span> Voice Mixer</h3>
<div class="row">
<label style="min-width:60px">Voice A</label>
<select id="mixVoiceA" style="flex:1;position:relative;z-index:1"></select>
</div>
<div class="row">
<label style="min-width:60px">Voice B</label>
<select id="mixVoiceB" style="flex:1;position:relative;z-index:1"></select>
</div>
<div class="row">
<label style="min-width:60px">Blend</label>
<div class="slider-wrap">
<span style="font-size:9px;color:var(--muted);font-weight:700">A</span>
<input type="range" id="mixBlend" min="0" max="1" step="0.05" value="0.5">
<span style="font-size:9px;color:var(--muted);font-weight:700">B</span>
<span class="factor-val" id="mixBlendVal">50%</span>
</div>
</div>
</div>
<!-- DSP Controls -->
<div class="panel" style="--g1:#F86A38;--g2:#D8226C">
<h3><span class="swatch"></span> DSP Controls</h3>
<div class="row">
<label style="min-width:60px">Pitch</label>
<div class="slider-wrap">
<input type="range" id="dspPitch" min="-12" max="12" step="0.5" value="0">
<span class="factor-val" id="dspPitchVal">0 st</span>
</div>
</div>
<div class="row">
<label style="min-width:60px">Reverb</label>
<div class="slider-wrap">
<input type="range" id="dspReverb" min="0" max="1" step="0.05" value="0">
<span class="factor-val" id="dspReverbVal">0%</span>
</div>
</div>
<div class="row">
<label style="min-width:60px">Bass</label>
<div class="slider-wrap">
<input type="range" id="dspBass" min="-12" max="12" step="0.5" value="0">
<span class="factor-val" id="dspBassVal">0 dB</span>
</div>
</div>
<div class="row">
<label style="min-width:60px">Treble</label>
<div class="slider-wrap">
<input type="range" id="dspTreble" min="-12" max="12" step="0.5" value="0">
<span class="factor-val" id="dspTrebleVal">0 dB</span>
</div>
</div>
<div class="dsp-grid" style="margin-top:6px">
<label class="toggle"><input type="checkbox" id="dspCompressor"><span class="dot"></span><span class="toggle-label"><span class="t-name">Compressor</span></span></label>
<label class="toggle"><input type="checkbox" id="dspLimiter"><span class="dot"></span><span class="toggle-label"><span class="t-name">Limiter</span></span></label>
</div>
</div>
<!-- Emotion Presets -->
<div class="panel" style="--g1:#E89A2B;--g2:#FF6B5C">
<h3><span class="swatch"></span> Emotion Presets</h3>
<div class="emotion-grid" id="emotionGrid">
<div class="emotion-chip" data-em="happy">😊 Happy</div>
<div class="emotion-chip" data-em="sad">😢 Sad</div>
<div class="emotion-chip" data-em="excited">🤩 Excited</div>
<div class="emotion-chip" data-em="calm">😌 Calm</div>
<div class="emotion-chip" data-em="angry">😡 Angry</div>
</div>
<div id="emotionDesc" style="font-size:9px;color:var(--muted);font-weight:600;margin-top:6px;position:relative;z-index:1">Select an emotion preset to adjust speed, pitch, and energy automatically.</div>
</div>
</div>
<!-- ===== TOOLS (collapsed) ===== -->
<button class="section-toggle" id="toggleTools">
🔧 Tools
<span class="arrow">▼</span>
</button>
<div class="collapsible" id="toolsSection">
<!-- Multi-Speaker Editor -->
<div class="panel" style="--g1:#0891B2;--g2:#06B6D4">
<h3><span class="swatch"></span> Multi-Speaker Editor</h3>
<div style="font-size:9px;color:var(--muted);font-weight:600;margin-bottom:6px;position:relative;z-index:1">Format: <b>Speaker:</b> text — each line becomes a speaker segment</div>
<textarea class="ms-script" id="msScript" placeholder="Aria: Hello, welcome to Wave Voice Studio! Orion: Thanks! This multi-speaker mode is incredible. Aria: Let's create something amazing together."></textarea>
<div id="msSpeakers" style="margin-top:8px;position:relative;z-index:1"></div>
<button class="btn-go" id="msGenerateBtn" style="margin-top:8px;background:linear-gradient(180deg,#06B6D4,#0891B2);box-shadow:inset 0 1px 0 rgba(255,255,255,.40),0 4px 12px rgba(6,182,212,.35)">Generate Multi-Speaker</button>
</div>
<!-- Voice Changer -->
<div class="panel" style="--g1:#D8226C;--g2:#E879A0">
<h3><span class="swatch"></span> Voice Changer</h3>
<div class="vc-drop-zone" id="vcDropZone">
<div style="font-size:22px;margin-bottom:4px">🎵</div>
<div style="font-size:11px;font-weight:700;color:var(--ink-soft)">Drop audio to transform, or click to browse</div>
<div style="font-size:9px;color:var(--muted);margin-top:2px">.wav .mp3 .ogg</div>
<input type="file" id="vcFileInput" accept=".wav,.mp3,.ogg,audio/wav,audio/mpeg,audio/ogg" style="display:none">
</div>
<div id="vcFileName" style="display:none;font-size:10px;font-weight:600;color:var(--ink-soft);margin-bottom:8px;padding:4px 8px;border-radius:6px;background:rgba(216,34,108,.08);position:relative;z-index:1"></div>
<div id="vcControls" style="display:none;position:relative;z-index:1">
<div class="row">
<label style="min-width:60px">Pitch</label>
<div class="slider-wrap">
<input type="range" id="vcPitch" min="-12" max="12" step="0.5" value="0">
<span class="factor-val" id="vcPitchVal">0 st</span>
</div>
</div>
<div class="row">
<label style="min-width:60px">Speed</label>
<div class="slider-wrap">
<input type="range" id="vcSpeed" min="0.5" max="2" step="0.05" value="1">
<span class="factor-val" id="vcSpeedVal">1.00x</span>
</div>
</div>
<div class="row">
<label style="min-width:60px">Reverb</label>
<div class="slider-wrap">
<input type="range" id="vcReverb" min="0" max="1" step="0.05" value="0">
<span class="factor-val" id="vcReverbVal">0%</span>
</div>
</div>
<button class="btn-go" id="vcApplyBtn" style="background:linear-gradient(180deg,#E879A0,#D8226C);box-shadow:inset 0 1px 0 rgba(255,255,255,.35),0 4px 12px rgba(216,34,108,.35)">Apply Transform</button>
<audio id="vcPlayer" controls style="width:100%;height:32px;border-radius:8px;margin-top:8px;display:none"></audio>
</div>
</div>
<!-- History -->
<div class="panel" style="--g1:#10B981;--g2:#059669">
<h3><span class="swatch"></span> History <small id="historyCountLabel">0 items</small></h3>
<div class="history-list" id="historyList">
<div class="history-empty" id="historyEmpty">No generations yet</div>
</div>
<button id="clearHistoryBtn" style="margin-top:6px;padding:5px 12px;border-radius:7px;border:1px solid var(--hair);background:rgba(255,255,255,.85);color:var(--ink-soft);font-size:9.5px;font-weight:700;cursor:pointer;transition:.15s;position:relative;z-index:1">Clear History</button>
</div>
</div>
<div style="text-align:center;padding:12px 16px;font-size:8.5px;color:#8A92BE;line-height:1.5;max-width:600px;margin:10px auto 0">By using this tool you agree not to clone or misuse generated voices without the speaker's consent. You are solely responsible for how you use generated audio.</div>
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js"></script>
<script>
(function(){
'use strict';
/* ───────── State ───────── */
const state = {
voice: 'aria',
clonedEmbedding: null,
cloneFile: null,
useClone: false,
lang: 'en',
speed: 1.0,
temperature: 0.7,
emotion: null,
modelLoaded: false,
generating: false,
audioBuffer: null,
audioCtx: null,
history: JSON.parse(localStorage.getItem('wave-history') || '[]'),
recording: false,
mediaRecorder: null,
recordedChunks: [],
sttListening: false,
sttRecognition: null,
vcAudioBuffer: null
};
/* ───────── Model config ───────── */
const MODEL_BASE = 'https://huggingface.co/KevinAHM/pocket-tts-onnx/resolve/main/onnx/english_2026-04/';
const MODEL_FILES = [
{ name: 'flow_lm_main', file: 'flow_lm_main_int8.onnx', bytes: 80000000, onnx: true },
{ name: 'flow_lm_flow', file: 'flow_lm_flow_int8.onnx', bytes: 10440000, onnx: true },
{ name: 'mimi_decoder', file: 'mimi_decoder_int8.onnx', bytes: 23800000, onnx: true },
{ name: 'mimi_encoder', file: 'mimi_encoder_int8.onnx', bytes: 21800000, onnx: true },
{ name: 'text_conditioner', file: 'text_conditioner_int8.onnx', bytes: 17200000, onnx: true },
{ name: 'bundle', file: 'bundle.json', bytes: 15000 },
{ name: 'bos_embedding', file: 'bos_before_voice.npy', bytes: 5000 }
];
const VOICES_BIN_URL = 'https://huggingface.co/spaces/KevinAHM/pocket-tts-web/resolve/main/onnx/english_2026-04/voices.bin';
const SPM_VOCAB_URL = '/spm_vocab.json';
const TOTAL_BYTES = MODEL_FILES.reduce((s, m) => s + m.bytes, 0);
window.__waveTTS = { models: {}, sessions: {}, ready: false };
const VOICES = [
{ id: 'aria', name: 'Aria', gender: 'F' },
{ id: 'luna', name: 'Luna', gender: 'F' },
{ id: 'nova', name: 'Nova', gender: 'F' },
{ id: 'stella', name: 'Stella', gender: 'F' },
{ id: 'orion', name: 'Orion', gender: 'M' },
{ id: 'atlas', name: 'Atlas', gender: 'M' },
{ id: 'rex', name: 'Rex', gender: 'M' },
{ id: 'sage', name: 'Sage', gender: 'X' }
];
const VOICE_MAP = {
aria: 'alba',
luna: 'cosette',
nova: 'eponine',
stella: 'fantine',
orion: 'javert',
atlas: 'jean',
rex: 'marius',
sage: 'azelma'
};
/* ───────── Inference Engine ───────── */
// NPY parser (float32 only)
function parseNpyF32(buf) {
const dv = new DataView(buf);
const headerLen = dv.getUint16(8, true);
const header = new TextDecoder().decode(new Uint8Array(buf, 10, headerLen));
const shape = header.match(/\(([^)]*)\)/)[1].split(',').map(s => parseInt(s)).filter(n => !isNaN(n));
return { shape, data: new Float32Array(buf, 10 + headerLen) };
}
// Parse voices.bin binary format (PTVB1)
function parseVoiceStatesBin(buffer) {
const view = new DataView(buffer);
let offset = 0;
const magic = new TextDecoder().decode(new Uint8Array(buffer, offset, 5));
offset += 5;
if (magic !== 'PTVB1') throw new Error('Invalid voices.bin header');
const voices = {};
const voiceCount = view.getUint32(offset, true); offset += 4;
for (let vi = 0; vi < voiceCount; vi++) {
const nameLen = view.getUint16(offset, true); offset += 2;
const name = new TextDecoder().decode(new Uint8Array(buffer, offset, nameLen)); offset += nameLen;
const tensorCount = view.getUint16(offset, true); offset += 2;
const tensors = {};
for (let ti = 0; ti < tensorCount; ti++) {
const keyLen = view.getUint16(offset, true); offset += 2;
const key = new TextDecoder().decode(new Uint8Array(buffer, offset, keyLen)); offset += keyLen;
const dtypeCode = view.getUint8(offset); offset += 1;
const rank = view.getUint8(offset); offset += 1;
const shape = [];
for (let d = 0; d < rank; d++) { shape.push(view.getUint32(offset, true)); offset += 4; }
const byteLength = view.getUint32(offset, true); offset += 4;
let data;
if (dtypeCode === 0) data = new Float32Array(buffer.slice(offset, offset + byteLength));
else if (dtypeCode === 1) data = new BigInt64Array(buffer.slice(offset, offset + byteLength));
else data = new Uint8Array(buffer.slice(offset, offset + byteLength));
offset += byteLength;
tensors[key] = { data, shape, dtype: dtypeCode === 0 ? 'float32' : dtypeCode === 1 ? 'int64' : 'bool' };
}
voices[name] = tensors;
}
return voices;
}
// Convert a voice record from voices.bin into a StateRunner-compatible snapshot (Map<string, ort.Tensor>)
function voiceRecordToSnapshot(record, manifest) {
// Group tensors by module name
const grouped = {};
for (const [key, value] of Object.entries(record)) {
const slash = key.indexOf('/');
if (slash === -1) continue;
const mod = key.slice(0, slash), tk = key.slice(slash + 1);
if (!grouped[mod]) grouped[mod] = {};
grouped[mod][tk] = value;
}
const snap = new Map();
for (const entry of manifest) {
const moduleState = grouped[entry.module] || {};
let source = moduleState[entry.key];
// Derive step from offset or current_end if missing
if (!source && entry.key === 'step') {
if (moduleState.step) source = { data: BigInt64Array.from([BigInt(moduleState.step.data[0])]), shape: [1] };
else if (moduleState.offset) source = { data: BigInt64Array.from([BigInt(moduleState.offset.data[0])]), shape: [1] };
else if (moduleState.current_end) source = { data: BigInt64Array.from([BigInt(moduleState.current_end.shape[0])]), shape: [1] };
else source = { data: BigInt64Array.from([0n]), shape: [1] };
}
const targetShape = entry.shape.slice();