Click here to Skip to main content
15,868,082 members
Articles / Mobile Apps / iPhone

FliteEngine - Objective-C speech synthesizer

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
21 Jan 2012BSD1 min read 22.4K   419   10  
FliteEngine - An Objective-C speech synthesizer.

Introduction

This is the second speech synthesizer wrapper as I wrote in my previous article ESpeakEngine. The following sections describe the Flite speech synthesizer wrapper - FliteEngine.

Background

FliteEngine is an Objective-C static library project containing a very light wrapper for the Flite Open Source speech synthesizer. It does not add any new features to Flite, it only exposes its functionality as Objective-C class methods and combines this functionality with the iOS AVFoundation Framework (to see all available properties of the Flite synthesizer, please read the documentation on its homepage URL). It also uses the standard delegate pattern by defining FliteEngineDelegate.

Using the code

Usage of the FliteEngine is very easy. You have to only add a standard dependency on the FliteEngine static library project to your project and add a path to the folder Flite_1_0/Classes in the Target Build Settings: Header Search Paths.

Then import the FliteEngine header in the class which is holding the engine instance:

Objective-C
#import "FliteEngine.h"

In the init or the viewDidLoad method, create a new instance of the FliteEngine and set all parameters you want (volume, speed, variance, pitch):

Objective-C
- (void)viewDidLoad {
    [super viewDidLoad];
    engine = [[FliteEngine alloc] init];
    engine.volume = 1;
}

And finally, bind any button's touch event to the code which calls the FliteEngine speak method:

Objective-C
- (IBAction)speech {
    NSString * text = self.textView.text;
    [engine speak:text];
}

Points of Interest

No documentation is included in this up-to-date version. Anyhow, the source code is self-explanatory and has altogether only a few hundred lines. Also, the test application is a good start point to look for more properties.

Any questions will be answered, feel free to contact me.

History

  • 2010: Initial version.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
CEO bring-it-together s.r.o.
Slovakia Slovakia
Jozef Božek is currently a software engineer at bring-it-together s.r.o. in area of large scale infomation systems and mobile applications development.
He has been developing in C++ nearly full time since 2000, in Java since 2004 and in Objective-C since 2009. He is programming using Java EE SDK, iOS SDK, COM/DCOM, MFC, ATL, STL and so on Smile | :)

Comments and Discussions

 
-- There are no messages in this forum --