let voices=[];
function loadVoices(){
voices=speechSynthesis.getVoices();
let s=document.getElementById('voicePick');
s.innerHTML=voices.map((v,i)=>``).join('');
}
speechSynthesis.onvoiceschanged=loadVoices;
loadVoices();
function speak(text){
if(!enabled) return;
let u=new SpeechSynthesisUtterance(text);
let idx=document.getElementById('voicePick').value;
if(voices[idx]) u.voice=voices[idx];
u.volume=1; u.rate=0.95; u.pitch=1;
speechSynthesis.cancel();
speechSynthesis.speak(u);
}
// use it like:
speak('You have a new booking');