We are making iPhone app where client want reminder as voice message.
Requirement is user will set time and text they want for for reminder.
Using text, I will convert to speech and play the audio file when reminder is triggered.
For this, I planned to use google service
http://www.translate.google.com/translate_tts?tl=en&q=helloE%20friend
Play those text and download the audio file for the same.
NSString* userAgent = @"Mozilla/5.0";
NSURL *url = [NSURL URLWithString:[@"http://www.translate.google.com/translate_tts?tl=en&q=helloE%20friend"
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
[request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
NSURLResponse* response = nil;
NSError* error = nil;
NSData* data = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response
error:&error];
[data writeToFile:@"/var/tmp/tts.mp3" atomically:YES];
I can use those code, but client don't want to go online.
Is there any library which can do text-to-speech conversion without internet (like siri is doing)?
Any info on this would be great.
Starting from iOS7, Apple already provide that in its SDK as per below:
Apple documentation
Use AVSpeechSynthesizer
Reference
This works iOS 7 onwards ONLY
Below is the code I used.
Imports used are
Languages supported are as below.
Reference