xcode - AVSpeechSynthesizer - 如何检测毫秒暂停的点(iPHONE - iPAD/iOS7 xcode)

标签 xcode ios7 point avspeechsynthesizer

我想读一段很长的文字:

NSString *text =@"Long test with dot. I want speaching pause when read dot. How can I do?";
AVSpeechSynthesizer *synthesizer = [AVSpeechSynthesizer new];
[synthesizer setDelegate:self];
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:text];
        utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:[self.defaults objectForKey:LANGUAGE]];
        utterance.rate = 0.28;
        [synthesizer speakUtterance:utterance];

我想要合成器检测点并暂停 100 毫秒。

是否可以?我能怎么做 ??

最佳答案

我的意思是一个点 (.)

但也许我找到了一个解决方案也适合 char ',' :

NSString *text = @"Line one. LineTwo aftre a pause. Line three, pause here again.";
        text = [text stringByReplacingOccurrencesOfString:@"," withString:@"."];

        NSArray *a = [text componentsSeparatedByString:@"."];
        for(NSString *line in a)
           {
           AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:line];
           utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:[self.defaults objectForKey:LINGUA]];
           utterance.rate = 0.28;
           utterance.**postUtteranceDelay** = 0.3;
           [self.synthesizer speakUtterance:utterance];
           }

关于xcode - AVSpeechSynthesizer - 如何检测毫秒暂停的点(iPHONE - iPAD/iOS7 xcode),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21580536/

相关文章:

ios - UIWebView - 如何在 iPad 上显示 iPhone 大小的内容

polygon - .NET 中多边形上的点(经度/纬度)

xcode - 无法在 iPhone 3G 中安装使用 Xcode 4.2 构建的应用程序

ios - 键盘在 ios7 (Xcode 6) 中无法正常工作

uikit - iOS 7 : What is UIBarButtonItem's default font?

algorithm - 在两组点上寻找平移和比例以获得它们距离的最小二乘误差?

algorithm - 三角面上有一个点,如何找到包含该点的三角形?

ios - 更改 .swift 以连接到 TableView Controller 而不是 View Controller

ios - UISplitView,设置委托(delegate)时接收语义问题

ios - UILabel具有自动布局的丑陋旋转动画