4
$\begingroup$

I wish Mathematica would wait until Speak stops speaking before moving on to the next command, but I couldn't think of anything better than

mySpeak[text_String] := Module[{phrases}
  , 
  phrases = 
   StringSplit[
    StringReplace[text, (# -> # <> "\n") & /@ {".", ";", "!", "?"}], 
    "\n"];
  Do[
   Speak[phrases[[i]]];
   Pause[0.4+0.2*StringLength[phrases[[i]]]];
   , {i, Length@phrases}
   ]
  ]

Is there a better solution?

$\endgroup$
1
  • $\begingroup$ I don't think this is possible here. The phrase gets sent to the system tts and there's no callback to Mathematica or way of polling that it has finished. $\endgroup$
    – flinty
    Commented Oct 28 at 23:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.