Is there any way to wait until the Speech Engine Sub System finishes speaking before advancing the code?

Hello, I’m trying to use the speech engine described here to handle dynamic text entered by the user, but there doesn’t seem to be any way to signal that the speech is over or know the duration of time the speech will take. Does anyone know how this could be achieved? If not, are there any other offline TTS plugins that are good? Thanks!