I'm using the js library p5.speech. I'm trying to get each strings throught the speech function. However, each time it repeats the same strings. So is the issue coming from my code or the js library (and in this case, what library should i use?)
const btReport1 = document.getElementById('report1');
btReport1.addEventListener('click', function(e) {
myVoice.setVoice('Google UK English Female');
for(var i=0; i<allData.length;i++){
console.log("allData"+i+" = " + allData[i].profile.length);
// myVoice.speak(allData[i].profile.length+" patients have "+ allData[i].food);;
setTimeout(function afterTwoSeconds() { myVoice.speak(allData[i].profile.length+" dogs have "+ allData[i].food);}, 1000);
}
});