This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "TSTextToSpeechUtils.h" | |
@interface TSTextToSpeechUtils () | |
@property (strong, nonatomic) AVSpeechSynthesizer *synthesizer; | |
@property (strong, nonatomic) AVSpeechUtterance *lastPlayingUtterance; | |
@property (strong, nonatomic) AVAudioSession *audioSession; | |
@end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <AVFoundation/AVFoundation.h> | |
@interface TSTextToSpeechUtils : NSObject<AVSpeechSynthesizerDelegate> | |
- (void)synthesizeSpeechForText:(NSString *)text; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HEADER FILE | |
#import <Foundation/Foundation.h> | |
#import <AVFoundation/AVFoundation.h> | |
@interface TSTextToSpeechUtils : NSObject<AVSpeechSynthesizerDelegate> | |
- (void)synthesizeSpeechForText:(NSString *)text; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc | |
class TextToSpeechUtils: NSObject, AVSpeechSynthesizerDelegate { | |
let synthesizer = AVSpeechSynthesizer() | |
let audioSession = AVAudioSession.sharedInstance() | |
let defaultLanguage = "en-US" | |
var lastPlayingUtterance: AVSpeechUtterance? | |
public func synthesizeSpeech(forText text: String) { | |