-
Notifications
You must be signed in to change notification settings - Fork 6
/
script.js
4128 lines (3652 loc) · 154 KB
/
script.js
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
const _version = "0.1.0";
document.querySelector("div#_version").textContent = `v${_version}`;
let SpeechRecognition = null;
try {
SpeechRecognition = SpeechRecognition || webkitSpeechRecognition || mozSpeechRecognition || msSpeechRecognition;
} catch (err) {
console.error(err);
$('div#speechRecognitionUnsupportedNag').nag({
storageMethod: null,
persist: true
}).nag('show');
}
// let SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList || mozSpeechGrammarList || msSpeechGrammarList;
// let SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSpeechRecognitionEvent || mozSpeechGrammarList || msSpeechGrammarList;
// StorageItems
function setStorageItem(cname, cvalue) {
window.localStorage.setItem(cname, cvalue);
}
function getNumericStorageItem(cname, cdefault) {
let result = parseFloat(window.localStorage.getItem(cname));
return result == null || isNaN(result) ? cdefault : result;
}
function getBooleanStorageItem(cname, cdefault) {
let result = window.localStorage.getItem(cname);
return result == null ? cdefault : result === "true";
}
function getStringStorageItem(cname, cdefault) {
let result = window.localStorage.getItem(cname);
return result == null ? cdefault : result;
}
// Target elements
const outputSpeechStatus = document.querySelector('label#outputSpeechStatus');
// const outputConfidence = document.querySelector('label#outputConfidence');
const outputStatus = document.querySelector('label#outputStatus');
const statusBar = document.querySelector('p#statusBar');
const startButtonInfo = document.querySelector('p#startButtonInfo');
const startButton = document.querySelector('button#startButton');
const outputDeviceText = document.querySelector('p#outputDeviceText');
const tabSettings = document.querySelector('div#tabSettings');
const tabReplacements = document.querySelector('div#tabReplacements');
const $tabSettingsButton = $('a#tabSettingsButton');
const $tabReplacementsButton = $('a#tabReplacementsButton');
const $tabAboutButton = $('a#tabAboutButton');
const $optionsButton = $('button#optionsButton');
const $optionsContainer = $('div#optionsContainer');
const $optionsModal = $('div#optionsModal');
const $uiMenuButton = $('button#uiMenuButton');
const $uiMenuModal = $('div#uiMenuModal');
const $socketMenuButton = $('button#socketMenuButton');
const $socketMenuModal = $('div#socketMenuModal');
const $resetOptionsButton = $('i#resetOptionsButton');
const $resetSettingsModal = $('div#resetSettingsModal');
const $resetSettingsNag = $('div#resetSettingsNag');
const $resetReplacementsModal = $('div#resetReplacementsModal');
const $resetReplacementsNag = $('div#resetReplacementsNag');
const $clearTranscriptModal = $('div#clearTranscriptModal');
const $clearTranscriptNag = $('div#clearTranscriptNag');
const $uploadReplacementsModal = $('div#uploadReplacementsModal');
const $ttsInput = $('input#ttsInput');
const $transcriptButton = $('input#transcriptCheckbox');
const $transcriptDropdown = $('div#transcriptDropdown');
const $transcriptCopy = $('i#transcriptCopy');
const $timestampsButton = $('div#timestampsCheckbox');
const $translationsButton = $('div#translationsCheckbox');
const $clearTranscriptButton = $('div#clearTranscriptButton');
const $extraVoiceOptions = $('#extraVoiceOptions');
const $pitchOption = $('#pitchOption');
const $preservePitchOption = $('#preservePitchOption');
const $socketInputButton = $('input#socketInputCheckbox');
const $socketOutputButton = $('input#socketOutputCheckbox');
const $ttsButton = $('input#ttsCheckbox');
const $statusButton = $('input#statusCheckbox');
const $lowlatencyButton = $('input#lowlatencyCheckbox');
const $latencyContainer = $('div#latencyContainer');
const $translateButton = $('input#translateCheckbox');
const $speakInputButton = $('input#speakInputCheckbox');
const latencyInput = document.querySelector('input#latencyInput');
const socketAddressInput = document.querySelector('input#socketAddressInput');
const socketPortInput = document.querySelector('input#socketPortInput');
const transcriptHeader = document.querySelector('div#transcriptHeader');
const transcript = document.querySelector('div#transcript');
const ttsHeader = document.querySelector('div#ttsHeader');
const ttsArea = document.querySelector('div#ttsArea');
const inputDeviceSelect = document.querySelector('select#inputDevice');
const outputDeviceSelect = document.querySelector('select#outputDevice');
const deviceSelectors = [inputDeviceSelect, outputDeviceSelect];
const inputLangSelect = document.querySelector('select#searchSelectInputLang');
const outputVoiceSelect = document.querySelector('select#searchSelectOutputVoice');
const outputLangSelect = document.querySelector('select#searchSelectOutputLang');
const $syncLanguageButton = $('div#syncLanguageButton');
const $syncLanguageIcon = $('i#syncLanguageIcon');
const $syncLanguageIconOutline = $('i#syncLanguageIconOutline');
const $syncLanguageErrorPopup = $('div#syncLanguageErrorPopup');
const $templates = document.querySelector('div#templates');
const $replacementsTable = document.querySelector('table#replacementsTable');
const $replacementEntries = document.querySelector('tbody#replacementEntries');
const $replacementEntryTemplate = document.querySelector('table#replacementEntryTemplate').firstElementChild.firstElementChild;
const $replacementsTableClone = document.querySelector('table#replacementsTableClone');
const $replacementsTableCloneRowContainer = document.querySelector('table#replacementsTableCloneRowContainer');
const $importReplacementsDropdown = $('div#importReplacementsDropdown');
const $exportReplacementsDropdown = $('div#exportReplacementsDropdown');
const importReplacementsButton = document.querySelector('div#importReplacementsButton');
const replacementsFileInput = document.querySelector('input#replacementsFileInput');
$templates.remove();
const $muteButton = $('#muteButton');
const $volumeSlider = $('#volumeSlider');
const $volumeFill = $('#volumeFill');
const $volumeThumb = $('#volumeThumb');
const $pitchSlider = $('#pitchSlider');
const $pitchThumb = $('#pitchThumb');
const $preservePitchButton = $('#preservePitchButton');
const $rateSlider = $('#rateSlider');
const $rateThumb = $('#rateThumb');
const $pitchSliderSS = $('#pitchSliderSS');
const $pitchThumbSS = $('#pitchThumbSS');
const $rateSliderSS = $('#rateSliderSS');
const $rateThumbSS = $('#rateThumbSS');
const voiceSetMapping = {
voiceSetA: "a",
voiceSetB: "b",
voiceSetC: "c",
voiceSetD: "d",
voiceSetE: "e",
voiceSetS: "s"
}
const storageItemKeys = {
socketAddress: 'vts-socketAddress',
socketPort: 'vts-socketPort',
inputLangSelect: 'vts-inputLangSelect',
outputVoiceSelect: 'vts-outputVoiceSelect',
outputLangSelect: 'vts-outputLangSelect',
outputDeviceSelect: 'vts-outputDeviceSelect',
latency: 'vts-latency',
transcriptEnabled: 'vts-transcriptEnabled',
socketInputEnabled: 'vts-socketInputEnabled',
socketOutputEnabled: 'vts-socketOutputEnabled',
ttsEnabled: 'vts-ttsEnabled',
statusEnabled: 'vts-statusEnabled',
lowlatencyEnabled: 'vts-lowlatencyEnabled',
syncLanguageEnabled: 'vts-syncLanguageEnabled',
translateEnabled: 'vts-translateEnabled',
speakInputEnabled: 'vts-speakInputEnabled',
timestampsEnabled: 'vts-timestampsEnabled',
translationsEnabled: 'vts-translationsEnabled',
muteEnabled: 'vts-muteEnabled',
preservePitchEnabled: 'vts-preservePitchEnabled',
volume: 'vts-volume',
rate: 'vts-rate',
pitch: 'vts-pitch',
replacements: 'vts-replacements',
}
function getMuteEnabled() { return $muteButton.hasClass('mute'); }
function getPreservePitchEnabled() { return $preservePitchButton.prop('checked'); }
function getTranscriptEnabled() { return $transcriptButton.prop('checked'); }
function getSocketInputEnabled() { return $socketInputButton.prop('checked'); }
function getSocketOutputEnabled() { return $socketOutputButton.prop('checked'); }
function getTtsEnabled() { return $ttsButton.prop('checked'); }
function getStatusEnabled() { return $statusButton.prop('checked'); }
function getLowlatencyEnabled() { return $lowlatencyButton.prop('checked'); }
function getSyncLanguageEnabled() { return $syncLanguageIcon.hasClass('inverted'); }
function getTranslateEnabled() { return $translateButton.prop('checked'); }
function getSpeakInputEnabled() { return $speakInputButton.prop('checked'); }
function getTimestampsEnabled() { return $timestampsButton.checkbox('is checked'); }
function getTranslationsEnabled() { return $translationsButton.checkbox('is checked'); }
const defaultVtsState = {
socketAddress: "localhost",
socketPort: 3000,
inputLangSelect: "en-US",
outputVoiceSelect: voiceSetMapping.voiceSetA + "en-US",
outputLangSelect: "en",
outputDeviceSelect: "default",
latency: 1000,
transcriptEnabled: getTranscriptEnabled(),
socketInputEnabled: getSocketInputEnabled(),
socketOutputEnabled: getSocketOutputEnabled(),
ttsEnabled: getTtsEnabled(),
statusEnabled: getStatusEnabled(),
lowlatencyEnabled: getLowlatencyEnabled(),
syncLanguageEnabled: getSyncLanguageEnabled(),
translateEnabled: getTranslateEnabled(),
speakInputEnabled: getSpeakInputEnabled(),
timestampsEnabled: getTimestampsEnabled(),
translationsEnabled: getTranslationsEnabled(),
muteEnabled: getMuteEnabled(),
volume: 100,
rate: 1.0,
pitch: 1.0,
preservePitchEnabled: getPreservePitchEnabled(),
}
let vtsState = {...defaultVtsState};
let buttonState = 0;
let translateApi = 0;
const inputDeviceSelectionDisabled = true;
let audio = new Audio();
let soundTouch = null;
let audioDestination;
let speechPlaying = false;
let speechBuffer = [];
let timeoutTimes = 0;
let ranGotDevices = false;
let recognition = null;
try {
recognition = new SpeechRecognition();
} catch (err) {}
let socket = null;
function setupSocket() {
if (socket !== null) {
socket.disconnect();
socket.close();
}
socket = io.connect(`http://${vtsState.socketAddress}:${vtsState.socketPort}`);
socket.on('connect_error', () => {
console.info(
'SOCKET: Restart to reconnect socket if using a personal server.',
);
socket.disconnect();
});
socket.on('text', (...args) => {
if (vtsState.socketInputEnabled) {
let text = args[0];
if (text != null) {
playTTS([text], true, false, true);
}
}
});
socket.connect();
}
// Make microphone icon appear in browser
async function triggerMicrophone() {
await recognition.start();
await recognition.stop();
}
triggerMicrophone();
// Languages that don't use spaces for dividing words
// chinese, japanaese, indonesian, thai, javanese, khmer,
// lao, burmese, sundanese, vietnamese, tibetan, dzongkha, tai lu
const nonSpacedLangs = [
['km-KH', 'Khmer (Cambodia)', 'ភាសាខ្មែរ (កម្ពុជា)'],
['lo-LA', 'Lao (Laos)', 'ລາວ (ລາວ)'],
['jv-ID', 'Javanese (Indonesia)', 'Jawa (Indonesia)'],
['su-ID', 'Sundanese (Indonesia)', 'Urang (Indonesia)'],
['th-TH', 'Thai (Thailand)', 'ไทย (ประเทศไทย)'],
['vi-VN', 'Vietnamese (Vietnam)', 'Tiếng Việt (Việt Nam)'],
['zh-TW', 'Chinese, Mandarin (Traditional, Taiwan)', '國語 (台灣)'],
['yue-Hant-HK', 'Chinese, Cantonese (Traditional, Hong Kong)', '廣東話 (香港)'],
['ja-JP', 'Japanese (Japan)', '日本語(日本)'],
['zh-HK', 'Chinese, Mandarin (Simplified, Hong Kong)', '普通話 (香港)'],
['zh-CN', 'Chinese, Mandarin (Simplified, China)', '普通话 (中国大陆)'],
];
// If you modify this array, also update default language / dialect below
const inputLangs = [
['af-ZA', 'Afrikaans (South Africa)', 'Afrikaans (Suid-Afrika)'],
['am-ET', 'Amharic (Ethiopia)', 'አማርኛ (ኢትዮጵያ)'],
['hy-AM', 'Armenian (Armenia)', 'Հայ (Հայաստան)'],
['az-AZ', 'Azerbaijani (Azerbaijan)', 'Azərbaycan (Azərbaycan)'],
['id-ID', 'Indonesian (Indonesia)', 'Bahasa Indonesia (Indonesia)'],
['ms-MY', 'Malay (Malaysia)', 'Bahasa Melayu (Malaysia)'],
['bn-BD', 'Bengali (Bangladesh)', 'বাংলা (বাংলাদেশ)'],
['bn-IN', 'Bengali (India)', 'বাংলা (ভারত)'],
['ca-ES', 'Catalan (Spain)', 'Català (Espanya)'],
['cs-CZ', 'Czech (Czech Republic)', 'Čeština (Česká republika)'],
['da-DK', 'Danish (Denmark)', 'Dansk (Danmark)'],
['de-DE', 'German (Germany)', 'Deutsch (Deutschland)'],
['en-AU', 'English (Australia)', 'English (Australia)'],
['en-CA', 'English (Canada)', 'English (Canada)'],
['en-GH', 'English (Ghana)', 'English (Ghana)'],
['en-GB', 'English (United Kingdom)', 'English (Great Britain)'],
['en-IN', 'English (India)', 'English (India)'],
['en-IE', 'English (Ireland)', 'English (Ireland)'],
['en-KE', 'English (Kenya)', 'English (Kenya)'],
['en-NZ', 'English (New Zealand)', 'English (New Zealand)'],
['en-NG', 'English (Nigeria)', 'English (Nigeria)'],
['en-PH', 'English (Philippines)', 'English (Philippines)'],
['en-SG', 'English (Singapore)', 'English (Singapore)'],
['en-ZA', 'English (South Africa)', 'English (South Africa)'],
['en-TZ', 'English (Tanzania)', 'English (Tanzania)'],
['en-US', 'English (United States)', 'English (United States)'],
['es-AR', 'Spanish (Argentina)', 'Español (Argentina)'],
['es-BO', 'Spanish (Bolivia)', 'Español (Bolivia)'],
['es-CL', 'Spanish (Chile)', 'Español (Chile)'],
['es-CO', 'Spanish (Colombia)', 'Español (Colombia)'],
['es-CR', 'Spanish (Costa Rica)', 'Español (Costa Rica)'],
['es-EC', 'Spanish (Ecuador)', 'Español (Ecuador)'],
['es-SV', 'Spanish (El Salvador)', 'Español (El Salvador)'],
['es-ES', 'Spanish (Spain)', 'Español (España)'],
['es-US', 'Spanish (United States)', 'Español (Estados Unidos)'],
['es-GT', 'Spanish (Guatemala)', 'Español (Guatemala)'],
['es-HN', 'Spanish (Honduras)', 'Español (Honduras)'],
['es-MX', 'Spanish (Mexico)', 'Español (México)'],
['es-NI', 'Spanish (Nicaragua)', 'Español (Nicaragua)'],
['es-PA', 'Spanish (Panama)', 'Español (Panamá)'],
['es-PY', 'Spanish (Paraguay)', 'Español (Paraguay)'],
['es-PE', 'Spanish (Peru)', 'Español (Perú)'],
['es-PR', 'Spanish (Puerto Rico)', 'Español (Puerto Rico)'],
['es-DO', 'Spanish (Dominican Republic)', 'Español (República Dominicana)'],
['es-UY', 'Spanish (Uruguay)', 'Español (Uruguay)'],
['es-VE', 'Spanish (Venezuela)', 'Español (Venezuela)'],
['eu-ES', 'Basque (Spain)', 'Euskara (Espainia)'],
['fil-PH', 'Filipino (Philippines)', 'Filipino (Pilipinas)'],
['fr-CA', 'French (Canada)', 'Français (Canada)'],
['fr-FR', 'French (France)', 'Français (France)'],
['gl-ES', 'Galician (Spain)', 'Galego (España)'],
['ka-GE', 'Georgian (Georgia)', 'ქართული (საქართველო)'],
['gu-IN', 'Gujarati (India)', 'ગુજરાતી (ભારત)'],
['hr-HR', 'Croatian (Croatia)', 'Hrvatski (Hrvatska)'],
['zu-ZA', 'Zulu (South Africa)', 'IsiZulu (Ningizimu Afrika)'],
['is-IS', 'Icelandic (Iceland)', 'Íslenska (Ísland)'],
['it-IT', 'Italian (Italy)', 'Italiano (Italia)'],
['it-CH', 'Italian (Switzerland)', 'Italiano (Svizzera)'],
['jv-ID', 'Javanese (Indonesia)', 'Jawa (Indonesia)'],
['kn-IN', 'Kannada (India)', 'ಕನ್ನಡ (ಭಾರತ)'],
['km-KH', 'Khmer (Cambodia)', 'ភាសាខ្មែរ (កម្ពុជា)'],
['lo-LA', 'Lao (Laos)', 'ລາວ (ລາວ)'],
['lv-LV', 'Latvian (Latvia)', 'Latviešu (latviešu)'],
['lt-LT', 'Lithuanian (Lithuania)', 'Lietuvių (Lietuva)'],
['hu-HU', 'Hungarian (Hungary)', 'Magyar (Magyarország)'],
['ml-IN', 'Malayalam (India)', 'മലയാളം (ഇന്ത്യ)'],
['mr-IN', 'Marathi (India)', 'मराठी (भारत)'],
['nl-NL', 'Dutch (Netherlands)', 'Nederlands (Nederland)'],
['ne-NP', 'Nepali (Nepal)', 'नेपाली (नेपाल)'],
['nb-NO', 'Norwegian Bokmål (Norway)', 'Norsk bokmål (Norge)'],
['pl-PL', 'Polish (Poland)', 'Polski (Polska)'],
['pt-BR', 'Portuguese (Brazil)', 'Português (Brasil)'],
['pt-PT', 'Portuguese (Portugal)', 'Português (Portugal)'],
['ro-RO', 'Romanian (Romania)', 'Română (România)'],
['si-LK', 'Sinhala (Sri Lanka)', 'සිංහල (ශ්රී ලංකාව)'],
['sk-SK', 'Slovak (Slovakia)', 'Slovenčina (Slovensko)'],
['sl-SI', 'Slovenian (Slovenia)', 'Slovenščina (Slovenija)'],
['su-ID', 'Sundanese (Indonesia)', 'Urang (Indonesia)'],
['sw-TZ', 'Swahili (Tanzania)', 'Swahili (Tanzania)'],
['sw-KE', 'Swahili (Kenya)', 'Swahili (Kenya)'],
['fi-FI', 'Finnish (Finland)', 'Suomi (Suomi)'],
['sv-SE', 'Swedish (Sweden)', 'Svenska (Sverige)'],
['ta-IN', 'Tamil (India)', 'தமிழ் (இந்தியா)'],
['ta-SG', 'Tamil (Singapore)', 'தமிழ் (சிங்கப்பூர்)'],
['ta-LK', 'Tamil (Sri Lanka)', 'தமிழ் (இலங்கை)'],
['ta-MY', 'Tamil (Malaysia)', 'தமிழ் (மலேசியா)'],
['te-IN', 'Telugu (India)', 'తెలుగు (భారతదేశం)'],
['vi-VN', 'Vietnamese (Vietnam)', 'Tiếng Việt (Việt Nam)'],
['tr-TR', 'Turkish (Turkey)', 'Türkçe (Türkiye)'],
['ur-PK', 'Urdu (Pakistan)', 'اردو (پاکستان)'],
['ur-IN', 'Urdu (India)', 'اردو (بھارت)'],
['el-GR', 'Greek (Greece)', 'Ελληνικά (Ελλάδα)'],
['bg-BG', 'Bulgarian (Bulgaria)', 'Български (България)'],
['ru-RU', 'Russian (Russia)', 'Русский (Россия)'],
['sr-RS', 'Serbian (Serbia)', 'Српски (Србија)'],
['uk-UA', 'Ukrainian (Ukraine)', 'Українська (Україна)'],
['he-IL', 'Hebrew (Israel)', 'עברית (ישראל)'],
['ar-IL', 'Arabic (Israel)', 'العربية (إسرائيل)'],
['ar-JO', 'Arabic (Jordan)', 'العربية (الأردن)'],
['ar-AE', 'Arabic (United Arab Emirates)', 'العربية (الإمارات)'],
['ar-BH', 'Arabic (Bahrain)', 'العربية (البحرين)'],
['ar-DZ', 'Arabic (Algeria)', 'العربية (الجزائر)'],
['ar-SA', 'Arabic (Saudi Arabia)', 'العربية (السعودية)'],
['ar-IQ', 'Arabic (Iraq)', 'العربية (العراق)'],
['ar-KW', 'Arabic (Kuwait)', 'العربية (الكويت)'],
['ar-MA', 'Arabic (Morocco)', 'العربية (المغرب)'],
['ar-TN', 'Arabic (Tunisia)', 'العربية (تونس)'],
['ar-OM', 'Arabic (Oman)', 'العربية (عُمان)'],
['ar-PS', 'Arabic (State of Palestine)', 'العربية (فلسطين)'],
['ar-QA', 'Arabic (Qatar)', 'العربية (قطر)'],
['ar-LB', 'Arabic (Lebanon)', 'العربية (لبنان)'],
['ar-EG', 'Arabic (Egypt)', 'العربية (مصر)'],
['fa-IR', 'Persian (Iran)', 'فارسی (ایران)'],
['hi-IN', 'Hindi (India)', 'हिन्दी (भारत)'],
['th-TH', 'Thai (Thailand)', 'ไทย (ประเทศไทย)'],
['ko-KR', 'Korean (South Korea)', '한국어 (대한민국)'],
['zh-TW', 'Chinese, Mandarin (Traditional, Taiwan)', '國語 (台灣)'],
['yue-Hant-HK', 'Chinese, Cantonese (Traditional, Hong Kong)', '廣東話 (香港)'],
['ja-JP', 'Japanese (Japan)', '日本語(日本)'],
['zh-HK', 'Chinese, Mandarin (Simplified, Hong Kong)', '普通話 (香港)'],
['zh-CN', 'Chinese, Mandarin (Simplified, China)', '普通话 (中国大陆)'],
];
const outputVoices = [
['af-ZA', 'Afrikaans (South Africa)', 'Afrikaans (Suid-Afrika)'],
['sq-AL', 'Albanian (Albania)', 'Shqip (Shqipëria)'],
// ['am-ET', 'Amharic (Ethiopia)', 'አማርኛ (ኢትዮጵያ)'],
// ['ar-XA', 'Arabic', 'العربية'],
['ar-SA', 'Arabic (Saudi Arabia)', 'العربية (السعودية)'],
// ['hy-AM', 'Armenian (Armenia)', 'Հայերեն (Հայաստան)'],
// ['as-IN', 'Assamese (India)', 'অসমীয়া (ভাৰত)'],
// ['az-AZ', 'Azerbaijani (Azerbaijan)', 'Azərbaycan (Azərbaycan)'],
['id-ID', 'Indonesian (Indonesia)', 'Bahasa Indonesia (Indonesia)'],
['ms-MY', 'Malay (Malaysia)', 'Bahasa Melayu (Malaysia)'],
['bn-BD', 'Bengali (Bangladesh)', 'বাংলা (বাংলাদেশ)'],
['bn-IN', 'Bengali (India)', 'বাংলা (ভারত)'],
['bs-Latn-BA', 'Bosnian (Bosnia)', 'bosanski (Bosna)'],
['bg-BG', 'Bulgarian (Bulgaria)', 'Български (България)'],
['ca-ES', 'Catalan (Spain)', 'Català (Espanya)'],
['cs-CZ', 'Czech (Czech Republic)', 'Čeština (Česká republika)'],
['da-DK', 'Danish (Denmark)', 'Dansk (Danmark)'],
['de-DE', 'German (Germany)', 'Deutsch (Deutschland)'],
['en-AU', 'English (Australia)', 'English (Australia)'],
['en-GB', 'English (United Kingdom)', 'English (Great Britain)'],
['en-IN', 'English (India)', 'English (India)'],
['en-NZ', 'English (New Zealand)', 'English (New Zealand)'],
['en-US', 'English (United States)', 'English (United States)'],
['es-ES', 'Spanish (Spain)', 'Español (España)'],
['es-US', 'Spanish (United States)', 'Español (Estados Unidos)'],
['et-EE', 'Estonian (Estonia)', 'Eesti (Eesti)'],
['fil-PH', 'Filipino (Philippines)', 'Filipino (Pilipinas)'],
['fr-CA', 'French (Canada)', 'Français (Canada)'],
['fr-FR', 'French (France)', 'Français (France)'],
// ['gl-ES', 'Galician (Spain)', 'Galego (España)'],
// ['ka-GE', 'Georgian (Georgia)', 'ქართული (საქართველო)'],
['gu-IN', 'Gujarati (India)', 'ગુજરાતી (ભારત)'],
['he-IL', 'Hebrew (Israel)', 'עברית (ישראל)'],
['hr-HR', 'Croatian (Croatia)', 'Hrvatski (Hrvatska)'],
// ['zu-ZA', 'Zulu (South Africa)', 'IsiZulu (Ningizimu Afrika)'],
['is-IS', 'Icelandic (Iceland)', 'Íslenska (Ísland)'],
['it-IT', 'Italian (Italy)', 'Italiano (Italia)'],
['jv-ID', 'Javanese (Indonesia)', 'Jawa (Indonesia)'],
['kn-IN', 'Kannada (India)', 'ಕನ್ನಡ (ಭಾರತ)'],
['km-KH', 'Khmer (Cambodia)', 'ភាសាខ្មែរ (កម្ពុជា)'],
// ['lo-LA', 'Lao (Laos)', 'ລາວ (ລາວ)'],
['la-VA', 'Latin (Vatican City)', 'Latina (Civitas Vaticana)'],
['lv-LV', 'Latvian (Latvia)', 'Latviešu (latviešu)'],
// ['lt-LT', 'Lithuanian (Lithuania)', 'Lietuvių (Lietuva)'],
['hu-HU', 'Hungarian (Hungary)', 'Magyar (Magyarország)'],
['ml-IN', 'Malayalam (India)', 'മലയാളം (ഇന്ത്യ)'],
['mr-IN', 'Marathi (India)', 'मराठी (भारत)'],
['my-MM', 'Burmese (Myanmar)', 'မြန်မာ (မြန်မာ)'],
['nl-NL', 'Dutch (Netherlands)', 'Nederlands (Nederland)'],
['ne-NP', 'Nepali (Nepal)', 'नेपाली (नेपाल)'],
['nb-NO', 'Norwegian Bokmål (Norway)', 'Norsk bokmål (Norge)'],
['pl-PL', 'Polish (Poland)', 'Polski (Polska)'],
['pt-BR', 'Portuguese (Brazil)', 'Português (Brasil)'],
['pt-PT', 'Portuguese (Portugal)', 'Português (Portugal)'],
['ro-RO', 'Romanian (Romania)', 'Română (România)'],
['si-LK', 'Sinhala (Sri Lanka)', 'සිංහල (ශ්රී ලංකාව)'],
['sk-SK', 'Slovak (Slovakia)', 'Slovenčina (Slovensko)'],
// ['sl-SI', 'Slovenian (Slovenia)', 'Slovenščina (Slovenija)'],
['su-ID', 'Sundanese (Indonesia)', 'Urang (Indonesia)'],
['sw-TZ', 'Swahili (Tanzania)', 'Swahili (Tanzania)'],
['fi-FI', 'Finnish (Finland)', 'Suomi (Suomi)'],
['sv-SE', 'Swedish (Sweden)', 'Svenska (Sverige)'],
['tl-PH', 'Tagalog (Philippines)', 'Tagalog (Pilipinas)'],
['ta-IN', 'Tamil (India)', 'தமிழ் (இந்தியா)'],
['te-IN', 'Telugu (India)', 'తెలుగు (భారతదేశం)'],
['vi-VN', 'Vietnamese (Vietnam)', 'Tiếng Việt (Việt Nam)'],
['tr-TR', 'Turkish (Turkey)', 'Türkçe (Türkiye)'],
['el-GR', 'Greek (Greece)', 'Ελληνικά (Ελλάδα)'],
['bg-BG', 'Bulgarian (Bulgaria)', 'Български (България)'],
['ru-RU', 'Russian (Russia)', 'Русский (Россия)'],
['sr-RS', 'Serbian (Serbia)', 'Српски (Србија)'],
['uk-UA', 'Ukrainian (Ukraine)', 'Українська (Україна)'],
['ur-IN', 'Urdu (India)', 'اردو (بھارت)'],
['ur-PK', 'Urdu (Pakistan)', 'اردو (پاکستان)'],
// ['fa-IR', 'Persian (Iran)', 'فارسی (ایران)'],
['hi-IN', 'Hindi (India)', 'हिन्दी (भारत)'],
['th-TH', 'Thai (Thailand)', 'ไทย (ประเทศไทย)'],
['ko-KR', 'Korean (South Korea)', '한국어 (대한민국)'],
['zh-TW', 'Chinese, Mandarin (Traditional, Taiwan)', '國語 (台灣)'],
['ja-JP', 'Japanese (Japan)', '日本語(日本)'],
['zh-HK', 'Chinese, Mandarin (Simplified, Hong Kong)', '普通話 (香港)'],
['zh-CN', 'Chinese, Mandarin (Simplified, China)', '普通话 (中国大陆)'],
];
const rvVoicesEnabled = true;
const rvVoices = [
['en-GB&gender=female', 'English UK Female'],
['en-GB&gender=male', 'English UK Male'],
['en-US&gender=female', 'English US Female'],
['en-US&gender=male', 'English US Male'],
['ar-SA&gender=male', 'Arabic Male'],
['ar-SA&gender=female', 'Arabic Female'],
['hy-AM&gender=male', 'Armenian Male'],
['en-AU&gender=female', 'Australian Female'],
['en-AU&gender=male', 'Australian Male'],
['bn-BD&gender=female', 'Bangla Bangladesh Female'],
['bn-BD&gender=male', 'Bangla Bangladesh Male'],
['bn-IN&gender=female', 'Bangla India Female'],
['bn-IN&gender=male', 'Bangla India Male'],
['pt-BR&gender=female', 'Brazilian Portuguese Female'],
['pt-BR&gender=male', 'Brazilian Portuguese Male'],
['zh&gender=female', 'Chinese Female'],
['zh&gender=male', 'Chinese Male'],
['zh-HK&gender=female', 'Chinese (Hong Kong) Female'],
['zh-HK&gender=male', 'Chinese (Hong Kong) Male'],
['zh-TW&gender=female', 'Chinese Taiwan Female'],
['zh-TW&gender=male', 'Chinese Taiwan Male'],
['cs-CZ&gender=female', 'Czech Female'],
['cs-CZ&gender=male', 'Czech Male'],
['da-DK&gender=female', 'Danish Female'],
['da-DK&gender=male', 'Danish Male'],
['de-DE&gender=female', 'Deutsch Female'],
['de-DE&gender=male', 'Deutsch Male'],
['nl-NL&gender=female', 'Dutch Female'],
['nl-NL&gender=male', 'Dutch Male'],
['et&gender=male', 'Estonian Male'],
['fil-PH&gender=female', 'Filipino Female'],
['fi-FI&gender=female', 'Finnish Female'],
['fi-FI&gender=male', 'Finnish Male'],
['fr-CA&gender=female', 'French Female'],
['fr-CA&gender=male', 'French Male'],
['fr-CA&gender=female', 'French Canadian Female'],
['fr-CA&gender=male', 'French Canadian Male'],
['el-GR&gender=female', 'Greek Female'],
['el-GR&gender=male', 'Greek Male'],
['hi-IN&gender=female', 'Hindi Female'],
['hi-IN&gender=male', 'Hindi Male'],
['hu-HU&gender=female', 'Hungarian Female'],
['hu-HU&gender=male', 'Hungarian Male'],
['id-ID&gender=female', 'Indonesian Female'],
['id-ID&gender=male', 'Indonesian Male'],
['it-IT&gender=female', 'Italian Female'],
['it-IT&gender=male', 'Italian Male'],
['ja-JP&gender=female', 'Japanese Female'],
['ja-JP&gender=male', 'Japanese Male'],
['ko-KR&gender=female', 'Korean Female'],
['ko-KR&gender=male', 'Korean Male'],
['la&gender=male', 'Latin Male'],
['ne-NP&gender=female', 'Nepali'],
['nb-NO&gender=female', 'Norwegian Female'],
['nb-NO&gender=male', 'Norwegian Male'],
['pl-PL&gender=female', 'Polish Female'],
['pl-PL&gender=male', 'Polish Male'],
['pt-BR&gender=female', 'Portuguese Female'],
['pt-BR&gender=male', 'Portuguese Male'],
['ro-RO&gender=female', 'Romanian Female'],
['ru-RU&gender=female', 'Russian Female'],
['ru-RU&gender=male', 'Russian Male'],
['si-LK&gender=female', 'Sinhala'],
['sk-SK&gender=female', 'Slovak Female'],
['sk-SK&gender=male', 'Slovak Male'],
['es-ES&gender=female', 'Spanish Female'],
['es-ES&gender=male', 'Spanish Male'],
['es-US&gender=female', 'Spanish Latin American Female'],
['es-US&gender=male', 'Spanish Latin American Male'],
['sv-SE&gender=female', 'Swedish Female'],
['sv-SE&gender=male', 'Swedish Male'],
['ta-IN&gender=female', 'Tamil Female'],
['ta-IN&gender=male', 'Tamil Male'],
['th-TH&gender=female', 'Thai Female'],
['th-TH&gender=male', 'Thai Male'],
['tr-TR&gender=female', 'Turkish Female'],
['tr-TR&gender=male', 'Turkish Male'],
['uk-UA&gender=female', 'Ukrainian Female'],
['vi-VN&gender=female', 'Vietnamese Female'],
['vi-VN&gender=male', 'Vietnamese Male'],
['af-ZA&gender=male', 'Afrikaans Male'],
['sq&gender=male', 'Albanian Male'],
['sr-BA&gender=male', 'Bosnian Male'],
['ca-ES&gender=male', 'Catalan Male'],
['hr-HR&gender=male', 'Croatian Male'],
['eo&gender=male', 'Esperanto Male'],
['is-IS&gender=male', 'Icelandic Male'],
['lv-LV&gender=male', 'Latvian Male'],
['mk&gender=male', 'Macedonian Male'],
['sr-RS&gender=male', 'Serbian Male'],
['hr-HR&gender=male', 'Serbo-Croatian Male'],
['sw-TZ&gender=male', 'Swahili Male'],
['cy&gender=male', 'Welsh Male'],
];
const seVoices = [
['tr-TR:Filiz', 'Filiz (Turkish Female)'],
['sv-SE:Astrid', 'Astrid (Swedish Female)'],
['ru-RU:Tatyana', 'Tatyana (Russian Female)'],
['ru-RU:Maxim', 'Maxim (Russian Male)'],
['ro-RO:Carmen', 'Carmen (Romanian Female)'],
['pt-PT:Ines', 'Ines (Portuguese Female)'],
['pt-PT:Cristiano', 'Cristiano (Portuguese Male)'],
['pt-BR:Vitoria', 'Vitoria (Brazilian Portuguese Female)'],
['pt-BR:Ricardo', 'Ricardo (Brazilian Portuguese Male)'],
['pl-PL:Maja', 'Maja (Polish Female)'],
['pl-PL:Jan', 'Jan (Polish Male)'],
['pl-PL:Jacek', 'Jacek (Polish Male)'],
['pl-PL:Ewa', 'Ewa (Polish Female)'],
['nl-NL:Ruben', 'Ruben (Dutch Male)'],
['nl-NL:Lotte', 'Lotte (Dutch Female)'],
['nb-NO:Liv', 'Liv (Norwegian Female)'],
['ko-KR:Seoyeon', 'Seoyeon (Korean Female)'],
['ja-JP:Takumi', 'Takumi (Japanese Male)'],
['ja-JP:Mizuki', 'Mizuki (Japanese Female)'],
['it-IT:Giorgio', 'Giorgio (Italian Male)'],
['it-IT:Carla', 'Carla (Italian Female)'],
['it-IT:Bianca', 'Bianca (Italian Female)'],
['is-IS:Karl', 'Karl (Icelandic Male)'],
['is-IS:Dora', 'Dora (Icelandic Female)'],
['fr-FR:Mathieu', 'Mathieu (French Male)'],
['fr-FR:Celine', 'Celine (French Female)'],
['fr-CA:Chantal', 'Chantal (Canadian French Female)'],
['es-US:Penelope', 'Penelope (US Spanish Female)'],
['es-US:Miguel', 'Miguel (US Spanish Male)'],
['es-MX:Mia', 'Mia (Mexican Spanish Female)'],
['es-ES:Enrique', 'Enrique (Spanish Male)'],
['es-ES:Conchita', 'Conchita (Spanish Female)'],
['en-GB:Geraint', 'Geraint (Welsh English Male)'],
['en-US:Salli', 'Salli (US English Female)'],
['en-US:Matthew', 'Matthew (US English Male)'],
['en-US:Kimberly', 'Kimberly (US English Female)'],
['en-US:Kendra', 'Kendra (US English Female)'],
['en-US:Justin', 'Justin (US English Male Child)'],
['en-US:Joey', 'Joey (US English Male)'],
['en-US:Joanna', 'Joanna (US English Female)'],
['en-US:Ivy', 'Ivy (US English Female Child)'],
['en-IN:Raveena', 'Raveena (Indian English Female)'],
['en-IN:Aditi', 'Aditi (Indian English Male)'],
['en-GB:Emma', 'Emma (British English Female)'],
['en-GB:Brian', 'Brian (British English Male)'],
['en-GB:Amy', 'Amy (British English Female)'],
['en-AU:Russell', 'Russell (Australian English Male)'],
['en-AU:Nicole', 'Nicole (Australian English Female)'],
['de-DE:Vicki', 'Vicki (Deutsch Female)'],
['de-DE:Marlene', 'Marlene (Deutsch Female)'],
['de-DE:Hans', 'Hans (Deutsch Male)'],
['da-DK:Naja', 'Naja (Danish Female)'],
['da-DK:Mads', 'Mads (Danish Male)'],
['cy-GB:Gwyneth', 'Gwyneth (Welsh Female)'],
['zh-CN:Zhiyu', 'Zhiyu (Mandarin Chinese Female)'],
// ['zh-HK:Tracy', 'Tracy (Hong Kong Chinese Female)'],
// ['zh-HK:Danny', 'Danny (Hong Kong Chinese Male)'],
// ['zh-CN:Huihui', 'Huihui (Mandarin Chinese Female)'],
// ['zh-CN:Yaoyao', 'Yaoyao (Mandarin Chinese Female)'],
// ['zh-CN:Kangkang', 'Kangkang (Mandarin Chinese Male)'],
// ['zh-TW:HanHan', 'HanHan (Taiwan Chinese Female)'],
// ['zh-TW:Zhiwei', 'Zhiwei (Taiwan Chinese Male)'],
// ['he-IL:Asaf', 'Asaf (Hebrew Male)'],
// ['vi-VN:An', 'An (Vietnamese Male)'],
// ['el-GR:Stefanos', 'Stefanos (Greek Male)'],
// ['sk-SK:Filip', 'Filip (Slovak Male)'],
// ['bg-BG:Ivan', 'Ivan (Bulgarian Male)'],
// ['fi-FI:Heidi', 'Heidi (Finnish Female)'],
// ['ca-ES:Herena', 'Herena (Catalan Female)'],
// ['hi-IN:Kalpana', 'Kalpana (Hindi Female)'],
// ['hi-IN:Hemant', 'Hemant (Hindi Male)'],
// ['hr-HR:Matej', 'Matej (Croatian Male)'],
// ['id-ID:Andika', 'Andika (Indonesian Male)'],
// ['ms-MY:Rizwan', 'Rizwan (Malaysian Male)'],
// ['sl-SI:Lado', 'Lado (Slovenian Male)'],
// ['ta-IN:Valluvar', 'Valluvar (Tamil Male)'],
// ['en-CA:Linda', 'Linda (Canadian English Female)'],
// ['en-CA:Heather', 'Heather (Canadian English Female)'],
// ['en-IE:Sean', 'Sean (Irish English Male)'],
// ['de-AT:Michael', 'Michael (Austrian German Male)'],
// ['de-CH:Karsten', 'Karsten (Swiss German Male)'],
// ['fr-CH:Guillaume', 'Guillaume (Swiss French Male)'],
// ['th-TH:Pattara', 'Pattara (Thai Male)'],
// ['cs-CZ:Jakub', 'Jakub (Czech Male)'],
// ['hu-HU:Szabolcs', 'Szabolcs (Hungarian Male)'],
// ['ar-EG:Hoda', 'Hoda (Arabic Female)'],
// ['ar-SA:Naayf', 'Naayf (Saudi Arabian Arabic Male)'],
];
const seVoices2 = [
// ['es-LA:es-LA_SofiaVoice', 'es-LA_SofiaVoice (Spanish)'],
// ['pt-BR:pt-BR_IsabelaVoice', 'pt-BR_IsabelaVoice (Brazilian Portuguese)'],
// ['en-US:en-US_MichaelVoice', 'en-US_MichaelVoice (US English)'],
// ['ja-JP:ja-JP_EmiVoice', 'ja-JP_EmiVoice (Japanese)'],
// ['en-US:en-US_AllisonVoice', 'en-US_AllisonVoice (US English)'],
// ['fr-FR:fr-FR_ReneeVoice', 'fr-FR_ReneeVoice (French)'],
// ['it-IT:it-IT_FrancescaVoice', 'it-IT_FrancescaVoice (Italian)'],
// ['es-ES:es-ES_LauraVoice', 'es-ES_LauraVoice (Spanish)'],
// ['de-DE:de-DE_BirgitVoice', 'de-DE_BirgitVoice (Deutsch)'],
// ['es-ES:es-ES_EnriqueVoice', 'es-ES_EnriqueVoice (Spanish)'],
// ['de-DE:de-DE_DieterVoice', 'de-DE_DieterVoice (Deutsch)'],
// ['en-US:en-US_LisaVoice', 'en-US_LisaVoice (US English)'],
// ['en-GB:en-GB_KateVoice', 'en-GB_KateVoice (British English)'],
// ['es-US:es-US_SofiaVoice', 'es-US_SofiaVoice (US Spanish)'],
['es-ES:es-ES-Standard-A', 'es-ES-Standard-A (Spanish)'],
['it-IT:it-IT-Standard-A', 'it-IT-Standard-A (Italian)'],
['it-IT:it-IT-Wavenet-A', 'it-IT-Wavenet-A (Italian)'],
['ja-JP:ja-JP-Standard-A', 'ja-JP-Standard-A (Japanese)'],
['ja-JP:ja-JP-Wavenet-A', 'ja-JP-Wavenet-A (Japanese)'],
['ko-KR:ko-KR-Standard-A', 'ko-KR-Standard-A (Korean)'],
['ko-KR:ko-KR-Wavenet-A', 'ko-KR-Wavenet-A (Korean)'],
['pt-BR:pt-BR-Standard-A', 'pt-BR-Standard-A (Brazilian Portuguese)'],
['tr-TR:tr-TR-Standard-A', 'tr-TR-Standard-A (Turkish)'],
['sv-SE:sv-SE-Standard-A', 'sv-SE-Standard-A (Swedish)'],
['nl-NL:nl-NL-Standard-A', 'nl-NL-Standard-A (Dutch)'],
['nl-NL:nl-NL-Wavenet-A', 'nl-NL-Wavenet-A (Dutch)'],
['en-US:en-US-Wavenet-A', 'en-US-Wavenet-A (US English)'],
['en-US:en-US-Wavenet-B', 'en-US-Wavenet-B (US English)'],
['en-US:en-US-Wavenet-C', 'en-US-Wavenet-C (US English)'],
['en-US:en-US-Wavenet-D', 'en-US-Wavenet-D (US English)'],
['en-US:en-US-Wavenet-E', 'en-US-Wavenet-E (US English)'],
['en-US:en-US-Wavenet-F', 'en-US-Wavenet-F (US English)'],
['en-GB:en-GB-Standard-A', 'en-GB-Standard-A (British English)'],
['en-GB:en-GB-Standard-B', 'en-GB-Standard-B (British English)'],
['en-GB:en-GB-Standard-C', 'en-GB-Standard-C (British English)'],
['en-GB:en-GB-Standard-D', 'en-GB-Standard-D (British English)'],
['en-GB:en-GB-Wavenet-A', 'en-GB-Wavenet-A (British English)'],
['en-GB:en-GB-Wavenet-B', 'en-GB-Wavenet-B (British English)'],
['en-GB:en-GB-Wavenet-C', 'en-GB-Wavenet-C (British English)'],
['en-GB:en-GB-Wavenet-D', 'en-GB-Wavenet-D (British English)'],
['en-US:en-US-Standard-B', 'en-US-Standard-B (US English)'],
['en-US:en-US-Standard-C', 'en-US-Standard-C (US English)'],
['en-US:en-US-Standard-D', 'en-US-Standard-D (US English)'],
['en-US:en-US-Standard-E', 'en-US-Standard-E (US English)'],
['de-DE:de-DE-Standard-A', 'de-DE-Standard-A (Deutsch)'],
['de-DE:de-DE-Standard-B', 'de-DE-Standard-B (Deutsch)'],
['de-DE:de-DE-Wavenet-A', 'de-DE-Wavenet-A (Deutsch)'],
['de-DE:de-DE-Wavenet-B', 'de-DE-Wavenet-B (Deutsch)'],
['de-DE:de-DE-Wavenet-C', 'de-DE-Wavenet-C (Deutsch)'],
['de-DE:de-DE-Wavenet-D', 'de-DE-Wavenet-D (Deutsch)'],
['en-AU:en-AU-Standard-A', 'en-AU-Standard-A (Australian English)'],
['en-AU:en-AU-Standard-B', 'en-AU-Standard-B (Australian English)'],
['en-AU:en-AU-Wavenet-A', 'en-AU-Wavenet-A (Australian English)'],
['en-AU:en-AU-Wavenet-B', 'en-AU-Wavenet-B (Australian English)'],
['en-AU:en-AU-Wavenet-C', 'en-AU-Wavenet-C (Australian English)'],
['en-AU:en-AU-Wavenet-D', 'en-AU-Wavenet-D (Australian English)'],
['en-AU:en-AU-Standard-C', 'en-AU-Standard-C (Australian English)'],
['en-AU:en-AU-Standard-D', 'en-AU-Standard-D (Australian English)'],
['fr-CA:fr-CA-Standard-A', 'fr-CA-Standard-A (Canadian French)'],
['fr-CA:fr-CA-Standard-B', 'fr-CA-Standard-B (Canadian French)'],
['fr-CA:fr-CA-Standard-C', 'fr-CA-Standard-C (Canadian French)'],
['fr-CA:fr-CA-Standard-D', 'fr-CA-Standard-D (Canadian French)'],
['fr-FR:fr-FR-Standard-C', 'fr-FR-Standard-C (French)'],
['fr-FR:fr-FR-Standard-D', 'fr-FR-Standard-D (French)'],
['fr-FR:fr-FR-Wavenet-A', 'fr-FR-Wavenet-A (French)'],
['fr-FR:fr-FR-Wavenet-B', 'fr-FR-Wavenet-B (French)'],
['fr-FR:fr-FR-Wavenet-C', 'fr-FR-Wavenet-C (French)'],
['fr-FR:fr-FR-Wavenet-D', 'fr-FR-Wavenet-D (French)'],
['da-DK:da-DK-Wavenet-A', 'da-DK-Wavenet-A (Danish)'],
['pl-PL:pl-PL-Wavenet-A', 'pl-PL-Wavenet-A (Polish)'],
['pl-PL:pl-PL-Wavenet-B', 'pl-PL-Wavenet-B (Polish)'],
['pl-PL:pl-PL-Wavenet-C', 'pl-PL-Wavenet-C (Polish)'],
['pl-PL:pl-PL-Wavenet-D', 'pl-PL-Wavenet-D (Polish)'],
['pt-PT:pt-PT-Wavenet-A', 'pt-PT-Wavenet-A (Portuguese)'],
['pt-PT:pt-PT-Wavenet-B', 'pt-PT-Wavenet-B (Portuguese)'],
['pt-PT:pt-PT-Wavenet-C', 'pt-PT-Wavenet-C (Portuguese)'],
['pt-PT:pt-PT-Wavenet-D', 'pt-PT-Wavenet-D (Portuguese)'],
['ru-RU:ru-RU-Wavenet-A', 'ru-RU-Wavenet-A (Russian)'],
['ru-RU:ru-RU-Wavenet-B', 'ru-RU-Wavenet-B (Russian)'],
['ru-RU:ru-RU-Wavenet-C', 'ru-RU-Wavenet-C (Russian)'],
['ru-RU:ru-RU-Wavenet-D', 'ru-RU-Wavenet-D (Russian)'],
['sk-SK:sk-SK-Wavenet-A', 'sk-SK-Wavenet-A (Slovak)'],
['tr-TR:tr-TR-Wavenet-A', 'tr-TR-Wavenet-A (Turkish)'],
['tr-TR:tr-TR-Wavenet-B', 'tr-TR-Wavenet-B (Turkish)'],
['tr-TR:tr-TR-Wavenet-C', 'tr-TR-Wavenet-C (Turkish)'],
['tr-TR:tr-TR-Wavenet-D', 'tr-TR-Wavenet-D (Turkish)'],
['tr-TR:tr-TR-Wavenet-E', 'tr-TR-Wavenet-E (Turkish)'],
['uk-UA:uk-UA-Wavenet-A', 'uk-UA-Wavenet-A (Ukrainian)'],
['ar-XA:ar-XA-Wavenet-A', 'ar-XA-Wavenet-A (Arabic)'],
['ar-XA:ar-XA-Wavenet-B', 'ar-XA-Wavenet-B (Arabic)'],
['ar-XA:ar-XA-Wavenet-C', 'ar-XA-Wavenet-C (Arabic)'],
['cs-CZ:cs-CZ-Wavenet-A', 'cs-CZ-Wavenet-A (Czech)'],
['nl-NL:nl-NL-Wavenet-B', 'nl-NL-Wavenet-B (Dutch)'],
['nl-NL:nl-NL-Wavenet-C', 'nl-NL-Wavenet-C (Dutch)'],
['nl-NL:nl-NL-Wavenet-D', 'nl-NL-Wavenet-D (Dutch)'],
['nl-NL:nl-NL-Wavenet-E', 'nl-NL-Wavenet-E (Dutch)'],
['en-IN:en-IN-Wavenet-A', 'en-IN-Wavenet-A (Indian English)'],
['en-IN:en-IN-Wavenet-B', 'en-IN-Wavenet-B (Indian English)'],
['en-IN:en-IN-Wavenet-C', 'en-IN-Wavenet-C (Indian English)'],
['fil-PH:fil-PH-Wavenet-A', 'fil-PH-Wavenet-A (Filipino)'],
['fi-FI:fi-FI-Wavenet-A', 'fi-FI-Wavenet-A (Finnish)'],
['el-GR:el-GR-Wavenet-A', 'el-GR-Wavenet-A (Greek)'],
['hi-IN:hi-IN-Wavenet-A', 'hi-IN-Wavenet-A (Hindi)'],
['hi-IN:hi-IN-Wavenet-B', 'hi-IN-Wavenet-B (Hindi)'],
['hi-IN:hi-IN-Wavenet-C', 'hi-IN-Wavenet-C (Hindi)'],
['hu-HU:hu-HU-Wavenet-A', 'hu-HU-Wavenet-A (Hungarian)'],
['id-ID:id-ID-Wavenet-A', 'id-ID-Wavenet-A (Indonesian)'],
['id-ID:id-ID-Wavenet-B', 'id-ID-Wavenet-B (Indonesian)'],
['id-ID:id-ID-Wavenet-C', 'id-ID-Wavenet-C (Indonesian)'],
['it-IT:it-IT-Wavenet-B', 'it-IT-Wavenet-B (Italian)'],
['it-IT:it-IT-Wavenet-C', 'it-IT-Wavenet-C (Italian)'],
['it-IT:it-IT-Wavenet-D', 'it-IT-Wavenet-D (Italian)'],
['ja-JP:ja-JP-Wavenet-B', 'ja-JP-Wavenet-B (Japanese)'],
['ja-JP:ja-JP-Wavenet-C', 'ja-JP-Wavenet-C (Japanese)'],
['ja-JP:ja-JP-Wavenet-D', 'ja-JP-Wavenet-D (Japanese)'],
['zh-CN:cmn-CN-Wavenet-A', 'cmn-CN-Wavenet-A (Mandarin Chinese)'],
['zh-CN:cmn-CN-Wavenet-B', 'cmn-CN-Wavenet-B (Mandarin Chinese)'],
['zh-CN:cmn-CN-Wavenet-C', 'cmn-CN-Wavenet-C (Mandarin Chinese)'],
['zh-CN:cmn-CN-Wavenet-D', 'cmn-CN-Wavenet-D (Mandarin Chinese)'],
['nb-NO:nb-no-Wavenet-E', 'nb-no-Wavenet-E (Norwegian)'],
['nb-NO:nb-no-Wavenet-A', 'nb-no-Wavenet-A (Norwegian)'],
['nb-NO:nb-no-Wavenet-B', 'nb-no-Wavenet-B (Norwegian)'],
['nb-NO:nb-no-Wavenet-C', 'nb-no-Wavenet-C (Norwegian)'],
['nb-NO:nb-no-Wavenet-D', 'nb-no-Wavenet-D (Norwegian)'],
['vi-VN:vi-VN-Wavenet-A', 'vi-VN-Wavenet-A (Vietnamese)'],
['vi-VN:vi-VN-Wavenet-B', 'vi-VN-Wavenet-B (Vietnamese)'],
['vi-VN:vi-VN-Wavenet-C', 'vi-VN-Wavenet-C (Vietnamese)'],
['vi-VN:vi-VN-Wavenet-D', 'vi-VN-Wavenet-D (Vietnamese)'],
];
const ttVoices = [
["en-US:en_us_001", "US English Female"],
["en-US:en_us_002", "Jessie (US English Female)"],
["en-US:en_us_006", "Joey (US English Male)"],
["en-US:en_us_007", "Professor (US English Male)"],
["en-US:en_us_009", "Scientist (US English Male)"],
["en-US:en_us_010", "Confident (US English Male)"],
["en-GB:en_uk_001", "Narrator (British English Male)"],
["en-GB:en_uk_003", "British English Male"],
["en-AU:en_au_001", "Metro (Australian English Female)"],
["en-AU:en_au_002", "Smooth (Australian English Male)"],
["fr-FR:fr_001", "French Male 1"],
["fr-FR:fr_002", "French Male 2"],
["de-DE:de_001", "German Female"],
["de-DE:de_002", "German Male"],
["es-ES:es_002", "Spanish Male"],
["es-MX:es_mx_002", "Mexican Spanish Male"],
["pt-BR:br_001", "Brazilian Portuguese Female 1"],
["pt-BR:br_003", "Brazilian Portuguese Female 2"],
["pt-BR:br_004", "Brazilian Portuguese Female 3"],
["pt-BR:br_005", "Brazilian Portuguese Male"],
["id-ID:id_001", "Indonesian Female"],
["ja-JP:jp_001", "Japanese Female 1"],
["ja-JP:jp_003", "Japanese Female 2"],
["ja-JP:jp_005", "Japanese Female 3"],
["ja-JP:jp_006", "Japanese Male"],
["ko-KR:kr_002", "Korean Male 1"],
["ko-KR:kr_003", "Korean Female"],
["ko-KR:kr_004", "Korean Male 2"],
["en-US:en_us_ghostface", "Ghostface [Scream] (English)"],
["en-US:en_us_chewbacca", "Chewbacca [Star Wars] (English)"],
["en-US:en_us_c3po", "C3PO [Star Wars] (English)"],
["en-US:en_us_stitch", "Stitch [Lilo & Stitch] (English)"],
["en-US:en_us_stormtrooper", "Stormtrooper [Star Wars] (English)"],
["en-US:en_us_rocket", "Rocket [Guardians of the Galaxy] (English)"],
["en-US:en_female_madam_leota", "Madame Leota (English Female)"],
["en-US:en_male_ghosthost", "Ghost Host (English Male)"],
["en-US:en_male_pirate", "Pirate (English Male)"],
["en-US:en_male_wizard", "Wizard (English Male)"],
["en-US:en_male_grinch", "Grinch (English Male)"],
["en-US:en_male_narration", "Story Teller (English Male)"],
["en-US:en_male_funny", "Wacky (English Male)"],
["en-US:en_female_emotional", "Peaceful (English Female)"],
["en-US:en_female_samc", "Empathetic (English Female)"],
["en-US:en_male_cody", "Serious (English Male)"],
["en-US:en_female_f08_salut_damour", "Alto (English Female Singing)"],
["en-US:en_male_m03_lobby", "Tenor (English Male Singing)"],
["en-US:en_male_m03_sunshine_soon", "Sunshine Soon (English Male Singing)"],
["en-US:en_female_f08_warmy_breeze", "Warmy Breeze (English Female Singing)"],
["en-US:en_female_ht_f08_glorious", "Glorious (English Female Singing)"],
["en-US:en_male_sing_funny_it_goes_up", "It Goes Up (English Male Singing)"],
["en-US:en_male_m2_xhxs_m03_silly", "Chipmunk (English Male Singing)"],
["en-US:en_female_ht_f08_wonderful_world", "Dramatic (English Female Singing)"],
["en-US:en_female_ht_f08_halloween", "Halloween (English Female Singing)"],
];
// https://github.com/d4n3436/GTranslate/blob/97dea660453e2fb7ee0fd4f0db32b8efe7b86845/src/GTranslate/LanguageDictionary.cs
const outputLangMapping = {
"nb-NO": "no",
"yue-Hant-HK": "zh-TW",
"zh-TW": "zh-TW",
"zh-HK": "zh-CN"
}
const outputLangs = [
['af', 'Afrikaans (Afrikaans)'],
['sq', 'Albanian (Shqip)'],
['am', 'Amharic (አማርኛ)'],
['ar', 'Arabic (العربية)'],
['hy', 'Armenian (Հայերեն)'],
['as', 'Assamese (অসমীয়া)'],
['ay', 'Aymara (Aymar aru)'],
['az', 'Azerbaijani (Azərbaycan)'],
['bm', 'Bambara (ߓߊߡߊߣߊ߲ߞߊ߲)'],
['eu', 'Basque (Euskara)'],
['be', 'Belarusian (беларуская)'],
['bn', 'Bengali (বাংলা)'],
['bho', 'Bhojpuri (भोजपुरी)'],
['bs', 'Bosnian (bosanski)'],
['bg', 'Bulgarian (Български)'],
['ca', 'Catalan (Català)'],
['ceb', 'Cebuano (Binisaya)'],
['zh-CN', 'Chinese [Simplified] (简体中文)'],
['zh-TW', 'Chinese [Traditional] (繁體中文)'],
['co', 'Corsican (Corsu)'],
['hr', 'Croatian (Hrvatski)'],
['cs', 'Czech (Čeština)'],
['da', 'Danish (Dansk)'],
['dv', 'Dhivehi (ދިވެހިބަސް)'],
['doi', 'Dogri (डोगरी)'],
['nl', 'Dutch (Nederlands)'],
['en', 'English (English)'],
['eo', 'Esperanto (Esperanto)'],
['et', 'Estonian (Eesti)'],
['ee', 'Ewe (Eʋegbe)'],
['fil', 'Filipino [Tagalog] (Filipino)'],
['fi', 'Finnish (Suomi)'],
['fr', 'French (Français)'],
['fy', 'Frisian (Frysk)'],
['gl', 'Galician (Galego)'],
['ka', 'Georgian (ქართული)'],
['de', 'German (Deutsch)'],
['el', 'Greek (Ελληνικά)'],
['gn', 'Guarani (avañeʼẽ)'],
['gu', 'Gujarati (ગુજરાતી)'],
['ht', 'Haitian Creole (Kreyòl ayisyen)'],
['ha', 'Hausa (Hausa)'],
['haw', 'Hawaiian (ʻŌlelo Hawaiʻi)'],
['he', 'Hebrew (עברית)'],
['hi', 'Hindi (हिन्दी)'],
['hmn', 'Hmong (Hmong)'],
['hu', 'Hungarian (Magyar)'],
['is', 'Icelandic (Íslenska)'],
['ig', 'Igbo (Igbo)'],
['ilo', 'Ilocano (Iloko)'],
['id', 'Indonesian (Indonesia)'],
['ga', 'Irish (Gaeilge)'],
['it', 'Italian (Italiano)'],
['ja', 'Japanese (日本語)'],
['jv', 'Javanese (Jawa)'],
['kn', 'Kannada (ಕನ್ನಡ)'],
['kk', 'Kazakh (Қазақ Тілі)'],
['km', 'Khmer (ខ្មែរ)'],
['rw', 'Kinyarwanda (Kinyarwanda)'],
['gom', 'Konkani (कोंकणी)'],
['ko', 'Korean (한국어)'],
['kri', 'Krio (Krio)'],
['ku', 'Kurdish (Kurdî)'],
['ckb', 'Kurdish [Sorani] (کوردیی ناوەندی)'],
['ky', 'Kyrgyz (Kyrgyz)'],
['lo', 'Lao (ລາວ)'],
['la', 'Latin (Latina)'],
['lv', 'Latvian (Latviešu)'],
['ln', 'Lingala (Lingála)'],
['lt', 'Lithuanian (Lietuvių)'],
['lg', 'Luganda (Oluganda)'],
['lb', 'Luxembourgish (Lëtzebuergesch)'],
['mk', 'Macedonian (Македонски)'],
['mai', 'Maithili (मैथिली)'],
['mg', 'Malagasy (Malagasy)'],
['ms', 'Malay (Melayu)'],
['ml', 'Malayalam (മലയാളം)'],
['mt', 'Maltese (Malti)'],
['mi', 'Maori (Te Reo Māori)'],
['mr', 'Marathi (मराठी)'],
['mni-Mtei', 'Meiteilon [Manipuri] (ꯃꯩꯇꯩꯂꯣꯟ)'],
['lus', 'Mizo (Mizo ṭawng)'],
['mn', 'Mongolian (Монгол хэл)'],
['my', 'Myanmar [Burmese] (မြန်မာ)'],
['ne', 'Nepali (नेपाली)'],
['no', 'Norwegian (Norsk)'],
['ny', 'Nyanja [Chichewa] (Nyanja)'],
['or', 'Odia (Oriya) (ଓଡ଼ିଆ)'],
['om', 'Oromo (Afaan Oromoo)'],
['ps', 'Pashto (پښتو)'],
['fa', 'Persian (فارسی)'],
['pl', 'Polish (Polski)'],
['pt', 'Portuguese [Portugal, Brazil] (Português)'],
['pa', 'Punjabi (ਪੰਜਾਬੀ)'],
['qu', 'Quechua (Runa simi)'],
['ro', 'Romanian (Română)'],
['ru', 'Russian (Русский)'],
['sm', 'Samoan (Gagana Sāmoa)'],
['sa', 'Sanskrit (संस्कृत)'],
['gd', 'Scots Gaelic (Gàidhlig)'],
['nso', 'Sepedi (Sesotho sa Leboa)'],
['sr', 'Serbian (Српски)'],
['st', 'Sesotho (Sesotho)'],
['sn', 'Shona (chiShona)'],
['sd', 'Sindhi (सिन्धी)'],
['si', 'Sinhala [Sinhalese] (සිංහල)'],
['sk', 'Slovak (Slovenčina)'],
['sl', 'Slovenian (Slovenščina)'],
['so', 'Somali (Af Soomaali)'],