【问题标题】:AVSpeechSynthesizer - How to detect dot for milliseconds pause (iPHONE - iPAD / iOS7 xcode)AVSpeechSynthesizer - 如何检测点暂停毫秒(iPHONE - iPAD / iOS7 xcode)
【发布时间】:2014-02-06 16:17:05
【问题描述】:

我想读一段很长的文字:

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 毫秒。

有可能吗?我该怎么办??

【问题讨论】:

  • 一个点?你是说经期吗?还是你的字面意思是句子中的“点”这个词。

标签: xcode ios7 point avspeechsynthesizer


【解决方案1】:

我的意思是一个点 (.)

但也许我也找到了 fot 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];
           }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-13
    • 2010-11-07
    • 2014-11-20
    • 1970-01-01
    • 2011-08-17
    相关资源
    最近更新 更多