Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

hectr/MRSpeechDispatcher

Repository files navigation

MRSpeechDispatcher

CI Status Version License Platform

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];

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

CocoaPods

MRSpeechDispatcher is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MRSpeechDispatcher"

Manually

Perform the following steps:

License

MRSpeechDispatcher is available under the MIT license. See the LICENSE file for more info.

About

Text-to-speech operations dispatcher

Resources

License

Stars

Watchers

Forks

Packages

No packages published