iOS devices have embedded voice synthesizers for Accessibility's VoiceOver feature. Is there a way you can use these synthesizers programmatically to generate text-based sounds?
My problem is: I'm working on a simple app for kids to learn colors and rather than recording the names of the colors in each language i want to support and storing them as audio files, i'd rather generate the sounds at runtime with some text-to-speech feature.
Thanks
[EDIT: this question was asked pre-iOS7 so you should really consider the voted answer and ignore older ones, unless you're a software archeologist]
Go to Settings > Accessibility > Spoken Content. Adjust any of the following: Speak Selection: To hear text you selected, tap the Speak button. Speak Screen: To hear the entire screen, swipe down with two fingers from the top of the screen.
Go to Settings > Accessibility and tap Spoken Content. Turn on Speak Selection or Speak Screen, or both. Select Voices. Choose the voice and dialect that you want Speak Screen and Speak Selection to use.
Integrate speech recognition swift , create a new state object named speechRecognizer . The initializer requests access to the speech recognizer and microphone the first time the system calls the object. You'll begin transcribing when the meeting view appears and stop recording when the meeting view disappears.
Starting from iOS 7, Apple provides this API.
See this answer.
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)
#import <AVFoundation/AVFoundation.h> AVSpeechSynthesizer *av = [[AVSpeechSynthesizer alloc] init]; AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:@"Text to say"]; [av 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