TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Sep 2015 |
Maintained by Héctor Marqués.
MRSpeechDispatcher
provides an easy-to-use interface for producing synthesized speech from text on an iOS device:
MRSpeechDispatcher *dispatcher = MRSpeechDispatcher.defaultSpeechDispatcher;
dispatcher.reusedSynthesizer = [[AVSpeechSynthesizer alloc] init];
[dispatcher speechText:@"Now relax." withAnimus:MRSpeechAnimusGlad];
[dispatcher speechText:@"And close your eyes." withAnimus:MRSpeechAnimusRegular];
[dispatcher keepQuiteFor:2];
[dispatcher speechText:@"Well done!" withAnimus:MRSpeechAnimusGlad];
[dispatcher speechText:@"See you the next session!" withAnimus:MRSpeechAnimusHurry];
In the example above the dispatcher enqueues the texts to be spoken by wrapping the produced AVSpeechUtterance
instances into MRSpeechUtteranceOperation
objects and adding them to its NSOperationQueue
.
But MRSpeechUtteranceOperation
can also be created and used independently just as any other NSOperation
instance:
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"hello"];
NSOperation *operation = [MRSpeechUtteranceOperation speechOperationWithUtterance:utterance];
[operation start];
To run the example project, clone the repo, and run pod install
from the Example directory first.
Perform the following steps:
MROperation
class into your project (see https://www.github.com/hectr/MROperation).MRSpeechDispatcher is available under the MIT license. See the LICENSE file for more info.