【问题标题】:SFSpeechRecognizer (Siri Transcription) Timeout Error on iOS AppiOS 应用程序上的 SFSpeechRecognizer(Siri 转录)超时错误
【发布时间】:2017-07-20 02:01:33
【问题描述】:

在我的 iOS 应用中,我尝试使用 iOS 10 的最新功能 Speech API 转录预先录制的音频。

包括documentation 在内的多个消息来源指出,语音 API(更具体地说是 SFSpeechRecognizer)的音频持续时间限制为 1 分钟。

在我的代码中,我发现任何长度约为 15 秒或更长的音频文件都会出现以下错误。

错误域=kAFAssistantErrorDomain Code=203 "SessionId=com.siri.cortex.ace.speech.session.event.SpeechSessionId@50a8e246, Message=Timeout waiting for command after 30000 ms" UserInfo={NSLocalizedDescription=SessionId=com. siri.cortex.ace.speech.session.event.SpeechSessionId@50a8e246, Message=Timeout waiting for command after 30000 ms, NSUnderlyingError=0x170248c40 {Error Domain=SiriSpeechErrorDomain Code=100 "(null)"}}

我在整个互联网上进行了搜索,但无法找到解决此问题的方法。也有人遇到同样的问题。有些人怀疑这是 Nuance 的问题。

另外值得注意的是,我确实从转录过程中获得了部分结果。

这是我的 iOS 应用程序中的代码。 ` // 创建一个语音识别器请求对象。 让 srRequest = SFSpeechURLRecognitionRequest(url: 位置) srRequest.shouldReportPartialResults = false

    sr?.recognitionTask(with: srRequest) { (result, error) in
        if let error = error {
            // Something wrong happened
            print(error.localizedDescription)
        } else {
            if let result = result {
                print(4)
                print(result.bestTranscription.formattedString)
                if result.isFinal {
                    print(5)
                    transcript = result.bestTranscription.formattedString
                    print(result.bestTranscription.formattedString)

                    // Store the transcript into the database.
                    print("\nSiri-Transcript: " + transcript!)

                    // Store the audio transcript into Firebase Realtime Database
                    self.firebaseRef = FIRDatabase.database().reference()

                    let ud = UserDefaults.standard
                    if let uid = ud.string(forKey: "uid") {
                        print("Storing the transcript into the database.")
                        let path = "users" + "/" + uid + "/" + "siri_transcripts" + "/" + date_recorded + "/" + filename.components(separatedBy: ".")[0]
                        print("transcript database path: \(path)")
                        self.firebaseRef.child(path).setValue(transcript)
                    }
                }
            }
        }
    }`

感谢您的帮助。

【问题讨论】:

    标签: ios iphone swift ios10 sfspeechrecognizer


    【解决方案1】:

    除了遇到同样问题的其他人之外,我还没有确认我的答案,但我认为这是对预录音频的无证限制。

    【讨论】:

      【解决方案2】:

      删除 result.isFinal 并改为对结果进行空检查。参考:https://github.com/mssodhi/Jarvis-ios/blob/master/Jarvis-ios/HomeCell%2Bspeech.swift

      【讨论】:

      • 感谢您的回复。不幸的是,问题仍然存在。我认为这与 Apple 在不更改文档的情况下更改音频文件长度的限制有关。这也可能是对预录音频的无证限制。
      • @itsSLO 您是否尝试过使用实时音频源,即使用麦克风而不是预先录制的文件?
      • 我没有,因为我目前没有针对这种情况的用户案例。话虽如此,我确实相信使用实时音频馈送将比预先录制的音频具有更高的限制。
      【解决方案3】:

      这是真的,我从视频中提取了音频文件,如果超过15秒就会报如下错误:

      Domain = kAFAssistantErrorDomain Code = 203 "Timeout" UserInfo = {
          NSLocalizedDescription = Timeout,
          NSUnderlyingError = 0x1c0647950 {Error Domain=SiriSpeechErrorDomain Code=100 "(null)"}
      }
      

      关键问题是超过 15 秒后的音频文件识别。 result.isFinal一直是0,很郁闷的是没有准确的时间戳,虽然是“Timeout”,但识别内容却很完整,感觉怪怪的。

      如果打印出结果遍历,可以看到有一些限制,也就是15秒,但是原因是音频文件的时间戳反馈被限制在一个有限的数量,比如15或者4或者9、通向终点。超时反馈更不稳定。

      但在实时语音识别中,你可以突破 15 秒,如官方文档所述,在一分钟内。

      【讨论】:

        猜你喜欢
        • 2013-03-02
        • 1970-01-01
        • 1970-01-01
        • 2016-07-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-26
        相关资源
        最近更新 更多