MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / getVoices

Function getVoices

assets/js/TextToSpeech.js:127–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125let voices = [];
126
127const 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
145getVoices();

Callers 1

TextToSpeech.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected