| 125 | let voices = []; |
| 126 | |
| 127 | const getVoices = () => { |
| 128 | voices = synth.getVoices(); |
| 129 | |
| 130 | // Loop through voices and create an option for each one |
| 131 | voices.forEach(voice => { |
| 132 | // Create option element |
| 133 | const option = document.createElement('option'); |
| 134 | // Fill option with voice and language |
| 135 | option.textContent = voice.name + '(' + voice.lang + ')'; |
| 136 | |
| 137 | // Set needed option attributes |
| 138 | option.setAttribute('data-lang', voice.lang); |
| 139 | option.setAttribute('data-name', voice.name); |
| 140 | voiceSelect.appendChild(option); |
| 141 | }); |
| 142 | }; |
| 143 | |
| 144 | //line 117 ,118 cause duplication of voice |
| 145 | getVoices(); |