You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I can load the entire string into say.speak and have it say what I need to say, my goal for this project is to split the string into a list, and to iteratively have say.speak shout out each string in the list. However, the speak function does not say the text when put in any loop, but works fine if its outside of a loop.
const responseData = response.text.split(/\r?\n/);
if(responseData.length == 0){
say.speak("Sorry. I do not think I heard that right.");
}
else{
var sayPromise = [];
for(var i = 0; i < responseData.length;i++){
const resolve = () => {
return new Promise((resolve) => {
say.speak(responseData[i],"Alex",1,(err)=>{
resolve();
});
})};
sayPromise.push(resolve);
}
for(const async of sayPromise){
const result = await async();
} }
The text was updated successfully, but these errors were encountered:
While I can load the entire string into say.speak and have it say what I need to say, my goal for this project is to split the string into a list, and to iteratively have say.speak shout out each string in the list. However, the speak function does not say the text when put in any loop, but works fine if its outside of a loop.
The text was updated successfully, but these errors were encountered: