Click here to Skip to main content
15,867,488 members
Articles / Mobile Apps / iPhone

ESpeakEngine - Objective-C speech synthesizer

Rate me:
Please Sign up or sign in to vote.
4.80/5 (3 votes)
23 Jan 2012BSD2 min read 73.2K   3K   22   36
ESpeakEngine - Objective-C speech synthesizer

Introduction

A few years ago I was looking for some Objective-C framework which would allow to speech text on iOS devices in our project. In that time i did not find any, but only tree plain speech synth libraries written i C - eSpeak, Flite and Festival.

After couple days of research and attempts to integrate those libraries for iOS SDK I choosed eSpeak and Flite as candidates (I was able to successfully customize only eSpeak and Flite in reasonable time, they supports more languages, Google use eSpeek for its translation service…).

In next couple of lines is described first speech synthesizer wrapper - ESpeakEngine.

Background

The ESpeakEngine is Objectice-C static library project containing very light wrapper for eSpeak open source speech synthesizer. It does not add any new features to eSpeak, it only exposes its funcionality as Objective-C class methods and combines this functionality with iOS AVFoundation Framework (to see all available properties of eSpeak synthesizer, please read documentation on its homepage url). It also uses standard delegate pattern by defining ESpeakEngineDelegate.

In static library project also exists a test target which contains simple iPhone app. This sample app has only a one screen with the UITextView for text input and the UIButton to start speech syntesis of an entered text.

Using the code

Usage of the ESpeakEngine is very easy, You have to only add a standard dependency on the ESpeakEngine static library project to Your project (simply drag and drop library project file from Finder to Project Navigator):

Screen_Shot_2012-01-24_at_10.34.07.png

add path to folder eSpeak_1.0/Classes in Target Build Settings: Header Search Paths:

Header_search_paths.png

Link ESpeakEngine binary and AVFundation.Framework:

Linked_binaries.png

and link also ESpeakEngine data folder espeak-data - simply drag and drop this folder from referenced eSpeak.xcodeproj project to parent project (to its any group, i drop it in example project to group ESpeakTest/Supporting Files):

Link_epeak-data_dialog.png

Linked_espeak-data.png

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

C++
#import "ESpeakEngine.h"   
In the init or the viewDidLoad method create a new instance of the ESpeakEngine and set all parameters you want (language, volume, gender… etc.):
C++
- (void)viewDidLoad {
    [super viewDidLoad];
    engine = [[ESpeakEngine alloc] init];
    engine.volume = 1;
    [engine setLanguage:@"en"];
} 

And finally bind any button touch event to code which calls the ESpeakEngine a speak method:

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 test application is 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

 
Questioncrash with ios 8 Pin
Member 1094792815-Jul-14 3:36
Member 1094792815-Jul-14 3:36 
QuestionCan't read data file: Pin
Anandhakumar Palanisamy20-Feb-13 0:10
Anandhakumar Palanisamy20-Feb-13 0:10 
GeneralMy vote of 3 Pin
Linasses11-Jan-13 0:32
Linasses11-Jan-13 0:32 
Questionjust awful speech! Pin
Yoeluk15-Dec-12 10:00
Yoeluk15-Dec-12 10:00 
AnswerRe: just awful speech! Pin
Jozef Bozek15-Dec-12 12:01
Jozef Bozek15-Dec-12 12:01 
GeneralRe: just awful speech! Pin
Yoeluk15-Dec-12 17:18
Yoeluk15-Dec-12 17:18 
AnswerRe: just awful speech! Pin
Jozef Bozek6-Feb-13 22:28
Jozef Bozek6-Feb-13 22:28 
QuestionEspeak Text to speech Pin
ammadandamu2-Dec-12 6:37
ammadandamu2-Dec-12 6:37 
AnswerRe: Espeak Text to speech Pin
Jozef Bozek15-Dec-12 11:50
Jozef Bozek15-Dec-12 11:50 
QuestionUsing different accents Pin
pluto9999-Oct-12 13:57
pluto9999-Oct-12 13:57 
AnswerRe: Using different accents Pin
Jozef Bozek15-Dec-12 11:53
Jozef Bozek15-Dec-12 11:53 
QuestionEspeak Iphone Project How to change male voice ? Pin
bilal7869918-Sep-12 23:44
bilal7869918-Sep-12 23:44 
Hello I m a student from Uet-taxila and i am working on TTS.I am New to Iphone Developing. I want change voice of male to female voice just like voice in iphone siri waiting for your Response .....
AnswerRe: Espeak Iphone Project How to change male voice ? Pin
Jozef Bozek25-Oct-12 4:25
Jozef Bozek25-Oct-12 4:25 
GeneralRe: Espeak Iphone Project How to change male voice ? Pin
Member 1098066931-Jul-14 2:01
Member 1098066931-Jul-14 2:01 
QuestionI follow your instructions and found 2 problems Pin
amielreyes033-Jul-12 21:25
amielreyes033-Jul-12 21:25 
AnswerRe: I follow your instructions and found 2 problems Pin
Jozef Bozek15-Dec-12 11:57
Jozef Bozek15-Dec-12 11:57 
GeneralRe: I follow your instructions and found 2 problems Pin
Linasses10-Jan-13 6:56
Linasses10-Jan-13 6:56 
AnswerRe: I follow your instructions and found 2 problems Pin
Jozef Bozek6-Feb-13 22:05
Jozef Bozek6-Feb-13 22:05 
QuestionPlease help me Device error- Pin
nielmabahohehehe1-Jul-12 14:50
nielmabahohehehe1-Jul-12 14:50 
AnswerRe: Please help me Device error- Pin
Jozef Bozek2-Jul-12 6:10
Jozef Bozek2-Jul-12 6:10 
QuestionProblem deploying to device Pin
Member 386931717-May-12 6:12
Member 386931717-May-12 6:12 
AnswerRe: Problem deploying to device Pin
Jozef Bozek22-May-12 5:00
Jozef Bozek22-May-12 5:00 
QuestionCant get working on device. Pin
jayy6615-May-12 17:43
jayy6615-May-12 17:43 
AnswerRe: Cant get working on device. Pin
Jozef Bozek15-May-12 21:37
Jozef Bozek15-May-12 21:37 
GeneralRe: Cant get working on device. Pin
jayy6616-May-12 16:03
jayy6616-May-12 16:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.