Does iOS provide built in text to speech support or any class like NSSpeechRecognizer?
There is no built in text-to-speech support in iOS 5 or 6 - you'll need to use a third party library. If you are using iOS 7 you're in luck.
There's a new class in iOS 7 called AVSpeechSynthesizer
(Apple's docs can be found here). You can use this to perform text-to-speech. Here's a simple example:
AVSpeechUtterance *utterance = [AVSpeechUtterance
speechUtteranceWithString:@"Hello world"];
AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc] init];
[synth speakUtterance:utterance];
Properties such as speed and voice type are set in the AVSpeechUtterance
, rather than the synthesizer.
How to use Speech Recognition inside the iOS SDK?
There are many libraries availble. You can use any of them.
openears // This is the best library
VocalKit (Deprecated for open ears)
- TTS
- ispeech (Not free)
Hope it helps you.
NOTE:
if you download openears (which contains a sample project called "OpenEarsSampleApp") @efimovD mentions this
Check the code in view controller and you will see an array with
possible commands. This thing detects commands! Not some talk. It
listens and tries to compare what you've said with the words from
array
How to programmatically use iOS voice synthesizers? (text to speech)
Starting from iOS 7, Apple provides this API.
Objective-C
#import <AVFoundation/AVFoundation.h>
…
AVSpeechUtterance *utterance = [AVSpeechUtterance
speechUtteranceWithString:@"Hello World!"];
AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc] init];
[synth speakUtterance:utterance];
Swift
import AVFoundation
…
let utterance = AVSpeechUtterance(string: "Hello World!")
let synth = AVSpeechSynthesizer()
synth.speakUtterance(utterance)
Is it possible to use TTS in iOS
flite TTS has been turned into an iOS library available here.
It is not too hard to implement. Be aware that the performance that you see in the simulator is way better than on a device and you will need to budget extra for device testing.
iPhone: Speech Recognition is in IOS SDK available?
Siri is not available in API form yet, however, any UITextField or UITextArea can be dictated to using the built-in option for speech-to-text.
Save text to audio file programmatically
NSSpeechSynthesizer
does that job.
Say we have the property :
@property NSSpeechSynthesizer *synth;
that we initialize like this:
synth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
we can do:
NSURL *saveURL = [NSURL fileURLWithPath:[@"~/Desktop/SpokenText.aiff" stringByExpandingTildeInPath]];
[synth startSpeakingString:@"A spoken short text" toURL:saveURL];
Before saving, we probably want to change the voice or the volume:
[synth setVolume:0.5f];
[synth setVoice:voiceID];
where the value for volume
is expressed in floating-point units ranging from 0.0 through 1.0 and voiceID
is a voice identifier
.
To see all available voice identifiers:
NSArray *voiceIdentifiers = [NSSpeechSynthesizer availableVoices];
NSLog(@"%li %@",voiceIdentifiers.count,voiceIdentifiers);
Output on OS X 10.10.3
with all voices installed:
101 (
"com.apple.speech.synthesis.voice.Agnes",
"com.apple.speech.synthesis.voice.Albert",
"com.apple.speech.synthesis.voice.Alex",
"com.apple.speech.synthesis.voice.alice.premium",
"com.apple.speech.synthesis.voice.allison.premium",
"com.apple.speech.synthesis.voice.alva.premium",
"com.apple.speech.synthesis.voice.amelie.premium",
"com.apple.speech.synthesis.voice.angelica.premium",
"com.apple.speech.synthesis.voice.anna.premium",
"com.apple.speech.synthesis.voice.audrey.premium",
"com.apple.speech.synthesis.voice.aurelie.premium",
"com.apple.speech.synthesis.voice.ava.premium",
"com.apple.speech.synthesis.voice.BadNews",
"com.apple.speech.synthesis.voice.Bahh",
"com.apple.speech.synthesis.voice.Bells",
"com.apple.speech.synthesis.voice.Boing",
"com.apple.speech.synthesis.voice.Bruce",
"com.apple.speech.synthesis.voice.Bubbles",
"com.apple.speech.synthesis.voice.carlos.premium",
"com.apple.speech.synthesis.voice.carmit.premium",
"com.apple.speech.synthesis.voice.catarina.premium",
"com.apple.speech.synthesis.voice.Cellos",
"com.apple.speech.synthesis.voice.cem.premium",
"com.apple.speech.synthesis.voice.chantal.premium",
"com.apple.speech.synthesis.voice.claire.premium",
"com.apple.speech.synthesis.voice.damayanti.premium",
"com.apple.speech.synthesis.voice.daniel.premium",
"com.apple.speech.synthesis.voice.Deranged",
"com.apple.speech.synthesis.voice.diego.premium",
"com.apple.speech.synthesis.voice.ellen.premium",
"com.apple.speech.synthesis.voice.ewa.premium",
"com.apple.speech.synthesis.voice.federica.premium",
"com.apple.speech.synthesis.voice.felipe.premium",
"com.apple.speech.synthesis.voice.fiona.premium",
"com.apple.speech.synthesis.voice.Fred",
"com.apple.speech.synthesis.voice.GoodNews",
"com.apple.speech.synthesis.voice.henrik.premium",
"com.apple.speech.synthesis.voice.Hysterical",
"com.apple.speech.synthesis.voice.ioana.premium",
"com.apple.speech.synthesis.voice.iveta.premium",
"com.apple.speech.synthesis.voice.joana.premium",
"com.apple.speech.synthesis.voice.jorge.premium",
"com.apple.speech.synthesis.voice.juan.premium",
"com.apple.speech.synthesis.voice.Junior",
"com.apple.speech.synthesis.voice.kanya.premium",
"com.apple.speech.synthesis.voice.karen.premium",
"com.apple.speech.synthesis.voice.kate.premium",
"com.apple.speech.synthesis.voice.Kathy",
"com.apple.speech.synthesis.voice.katya.premium",
"com.apple.speech.synthesis.voice.klara.premium",
"com.apple.speech.synthesis.voice.kyoko.premium",
"com.apple.speech.synthesis.voice.laura.premium",
"com.apple.speech.synthesis.voice.lee.premium",
"com.apple.speech.synthesis.voice.lekha.premium",
"com.apple.speech.synthesis.voice.luca.premium",
"com.apple.speech.synthesis.voice.luciana.premium",
"com.apple.speech.synthesis.voice.magnus.premium",
"com.apple.speech.synthesis.voice.mariska.premium",
"com.apple.speech.synthesis.voice.markus.premium",
"com.apple.speech.synthesis.voice.mei-jia.premium",
"com.apple.speech.synthesis.voice.melina.premium",
"com.apple.speech.synthesis.voice.milena.premium",
"com.apple.speech.synthesis.voice.moira.premium",
"com.apple.speech.synthesis.voice.monica.premium",
"com.apple.speech.synthesis.voice.nicolas.premium",
"com.apple.speech.synthesis.voice.nikos.premium",
"com.apple.speech.synthesis.voice.nora.premium",
"com.apple.speech.synthesis.voice.oliver.premium",
"com.apple.speech.synthesis.voice.oskar.premium",
"com.apple.speech.synthesis.voice.otoya.premium",
"com.apple.speech.synthesis.voice.paola.premium",
"com.apple.speech.synthesis.voice.paulina.premium",
"com.apple.speech.synthesis.voice.petra.premium",
"com.apple.speech.synthesis.voice.Organ",
"com.apple.speech.synthesis.voice.Princess",
"com.apple.speech.synthesis.voice.Ralph",
"com.apple.speech.synthesis.voice.samantha.premium",
"com.apple.speech.synthesis.voice.sara.premium",
"com.apple.speech.synthesis.voice.satu.premium",
"com.apple.speech.synthesis.voice.serena.premium",
"com.apple.speech.synthesis.voice.sin-ji.premium",
"com.apple.speech.synthesis.voice.soledad.premium",
"com.apple.speech.synthesis.voice.susan.premium",
"com.apple.speech.synthesis.voice.tarik.premium",
"com.apple.speech.synthesis.voice.tessa.premium",
"com.apple.speech.synthesis.voice.thomas.premium",
"com.apple.speech.synthesis.voice.ting-ting.premium",
"com.apple.speech.synthesis.voice.tom.premium",
"com.apple.speech.synthesis.voice.Trinoids",
"com.apple.speech.synthesis.voice.veena.premium",
"com.apple.speech.synthesis.voice.Vicki",
"com.apple.speech.synthesis.voice.Victoria",
"com.apple.speech.synthesis.voice.Whisper",
"com.apple.speech.synthesis.voice.xander.premium",
"com.apple.speech.synthesis.voice.yannick.premium",
"com.apple.speech.synthesis.voice.yelda.premium",
"com.apple.speech.synthesis.voice.yuna.premium",
"com.apple.speech.synthesis.voice.yuri.premium",
"com.apple.speech.synthesis.voice.Zarvox",
"com.apple.speech.synthesis.voice.zosia.premium",
"com.apple.speech.synthesis.voice.zuzana.premium"
)
Can Dragonfly be used to modify existing text, like Capitalise That in DNS does?
Yes, but you'll have to get creative. Use a Dragonfly Function Action to press keys to highlight the text you want to capitalize. (For example, Shift-Right or Control-Shift-Left.) While still in the function called by the Function Action, read the text by sending keys for Control-C, then getting the contents of the clipboard. Then you can modify it however you want and print it back out.
Text to speech conversion
Yes it is possible through open ears. You can look at the sample project provided in the Openears itself with the help of FliteController.
There is method called say.
e.g.
-(void)viewDidLoad {
[super viewDidLoad];
// This is how to use an available instance of FliteController.
[fliteController say:@"Welcome to OpenEars."];
}
Hope it helps.
Text to Speech in OS X Application
What you call “text-to-speech” is also commonly abbreviated as TTS and alternatively called “speech synthesis”.
The Cocoa class NSSpeechSynthesizer is the API to use. The canonical sample code is CocoaSpeechSynthesisExample.
There also is a guide to “Speech Programming Topics” and a “Speech Synthesis Programming Guide” available.
Finally, there are lower level APIs available if you need access to stuff that is abstracted away for you by NSSpeechSynthesizer.
Related Topics
Cannot Assign Value of Type '() -> Void' to Type '(() -> Void)!'
iOS Floating Video Window Like Youtube App
How to Update Uibutton Title/Text Programmatically
iOS 9 Searchbar Disappears from Table Header View When Uisearchcontroller Is Active
Uitextview Disabling Text Selection
How to Custom Modal View Controller Presenting Animation
Does iOS Provide Built in Text to Speech Support or Any Class Like Nsspeechrecognizer
Disable the Uitableview Highlighting But Allow the Selection of Individual Cells
"The Data Couldn't Be Read Because It Is Missing" Error When Decoding JSON in Swift
New React Native Project with Old Version of React Native
Bsxpcmessage Received Error for Message: Connection Interrupted
Uitableview Add Cell Animation
MySQL and Swift - Upload Image and File || Would It Be Better to Use Alamofire