DanM DanM - 2 months ago 12
Objective-C Question

Easy way to force pauses in an AVSpeechSynthesizer utterance?

I'm using

AVSpeechSynthesizer
to speak a long passage. However, there are some sections of the text where I want the speaker to pause for a moment before continuing. Is there a trivial way to just, say, add some special character into the
NSString
used to create the utterance that will force a pause? Or am I going to have to split this up into several separate utterances and manually delay between them?

Answer

Try looking at AVSpeechSynthesizerDelegate's willSpeakRangeOfSpeechString:

You could check for a special character there, call pauseSpeakingAtBoundary if you find it, and then resume after a set amount of time.

Comments