how to fix Speech Synthesis Utterance in javascript
<p>When ever i run this code i get a female response and then the second time i get a male voice and if i try to run it again it fails to respond.</p>

<p>here is the code/</p>

<pre><code>var aiload = document.getElementById('ai').innerHTML
var msg = new SpeechSynthesisUtterance(aiload);
var voices = window.speechSynthesis.getVoices();

voices.forEach(function (voice, i) {
    var voiceName = 'Google UK English Female';
    var selected = '';

    if(voiceName == 'native') {
        selected = 'selected';
    }
    var option = "&lt;option value='" + voiceName + "' " + selected + " &gt;" + voiceName + "&lt;/option&gt;";
    voiceSelect.append(option);
    console.log(voiceName);
});

msg.volume = 1; // 0 to 1
msg.rate = 1; // 0.1 to 10
msg.pitch = 0; //0 to 2
msg.text = aiload;
msg.lang = 'en-US';

msg.onend = function(e) {
    console.log('Finished in ' + event.elapsedTime + ' seconds.');
};


speechSynthesis.speak(msg);
</code></pre>