It seems you are looking for NSSpeechSynthesizer
instance method: isSpeaking
. You can write a polling loop to test if it is speaking and continue to work once it is not anymore. Something like this:
import time
from Cocoa import NSSpeechSynthesizer
while 1:
sp = NSSpeechSynthesizer.alloc().initWithVoice_(None)
sp.startSpeakingString_("What would you like me to say?")
say_1 = raw_input("What would you like me to say?")
sp.startSpeakingString_(say_1)
while sp.isSpeaking(): # loop until it finish to speak
time.sleep(0.9) # be nice with the CPU
print 'done speaking'
UPDATE: Is better time.sleep
than continue
inside the loop. The latter will waste a lot of CPU and battery (as pointed out by @kindall).
Hope this helps!