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 c
Below is the code I used.
NSString *myStr;
// myStr = @"Hello friend, how are you?";
myStr = @"مرحبا صديق، كيف حالك؟";
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:myStr];
[utterance setRate:0.2f];
// utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-us"];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"ar-SA"];
[synthesizer speakUtterance:utterance];
Imports used are
#import <AVFoundation/AVFoundation.h>
#import <QuartzCore/QuartzCore.h>
Languages supported are as below.
Arabic (Saudi Arabia) - ar-SA
Chinese (China) - zh-CN
Chinese (Hong Kong SAR China) - zh-HK
Chinese (Taiwan) - zh-TW
Czech (Czech Republic) - cs-CZ
Danish (Denmark) - da-DK
Dutch (Belgium) - nl-BE
Dutch (Netherlands) - nl-NL
English (Australia) - en-AU
English (Ireland) - en-IE
English (South Africa) - en-ZA
English (United Kingdom) - en-GB
English (United States) - en-US
Finnish (Finland) - fi-FI
French (Canada) - fr-CA
French (France) - fr-FR
German (Germany) - de-DE
Greek (Greece) - el-GR
Hindi (India) - hi-IN
Hungarian (Hungary) - hu-HU
Indonesian (Indonesia) - id-ID
Italian (Italy) - it-IT
Japanese (Japan) - ja-JP
Korean (South Korea) - ko-KR
Norwegian (Norway) - no-NO
Polish (Poland) - pl-PL
Portuguese (Brazil) - pt-BR
Portuguese (Portugal) - pt-PT
Romanian (Romania) - ro-RO
Russian (Russia) - ru-RU
Slovak (Slovakia) - sk-SK
Spanish (Mexico) - es-MX
Spanish (Spain) - es-ES
Swedish (Sweden) - sv-SE
Thai (Thailand) - th-TH
Turkish (Turkey) - tr-TR
Starting from iOS7, Apple already provide that in its SDK as per below:
Apple documentation
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];