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=ar&q=%D9%85%D8%B1%D8%AD%D8%A8%D8%A7%20%D8%B5%D8%AF%D9%8A%D9%82%D8%8C%20%D9%83%D9%8A%D9%81%20%D8%AD%D8%A7%D9%84%D9%83%D8%9F
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.
Use AVSpeechSynthesizer
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Some random text that you want to be spoken"];
[utterance setRate:0.7];
[synthesizer speakUtterance:utterance];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With