【问题标题】:NSSpeechSynthesizer does not write AIFF-fileNSSpeechSynthesizer 不写入 AIFF 文件
【发布时间】:2014-10-23 08:06:21
【问题描述】:

在 OS X 10.9.4 上使用 Xcode 5.1.1, 考虑以下代码 sn-ps:

- (IBAction)speak:(id)sender        // text to loudspeaker, this works
{
   [self setup];         // provide the synthesizer with its parameters
   [speaker startSpeakingString: [textEntry stringValue]];
}


- (IBAction)storeSpeech:(id)sender  // does not work
{
   [self setup];         // provide the synthesizer with its parameters
   [NSURL *outputFile =
          [NSURL URLWithString:@"speech.aiff"];
   [speaker startSpeakinString: [textEntry stringValue]
          toURL:outputFile];   // the aiff-file is not created, why not?
}

方法 speak 输出到计算机扬声器。这工作正常。

方法 storeSpeech 不会创建任何 aiff 文件。为什么不呢?

【问题讨论】:

    标签: objective-c cocoa xcode5


    【解决方案1】:

    “speech.aiff”不是一个 URL,是吗?

    要么使用以 file:// 开头的 URL,要么使用创建文件 URL 的路径和方法。

    【讨论】:

    • 您当然是对的,谢谢。我现在使用 [NSURL fileURLWithPath:@"speech.aiff"];它做了它应该做的事情。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-14
    • 2015-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多