簡體   English   中英

Microsoft Azure 認知語音轉文本 - 返回未定義的 API 錯誤

[英]Microsoft Azure Cognitive Speech to Text - Returns undefined API Error

目前我正在使用創建一個 STT 應用程序

  • NodeJS v16.x
  • microsoft-cognitiveservices-speech-sdk v1.17.0

我在西歐地區創建了一個westeurope語音認知資源,並驗證了密鑰是否正確。

現在我正在使用以下代碼來執行語音識別:


class RecognizerAzure {

  recognize(){
    this.audioFormat = AudioStreamFormat.getWaveFormatPCM(sampleRate, 16, 1)
    this.pushStream = AudioInputStream.createPushStream(this.audioFormat)
    this.audioConfig = AudioConfig.fromStreamInput(this.pushStream)
    this.speechConfig = SpeechConfig.fromSubscription(
      '*************',
      'westeurope'
    )
    this.speechConfig.speechRecognitionLanguage = "en_US"

    this.recognizer = new SpeechRecognizerMicrosoftAzure(
      this.speechConfig,
      this.audioConfig
    )

    this.recognizer.startContinuousRecognitionAsync(() => {
      if (this.recognizer) {
        console.debug(inspect(this.recognizer))
        this.recognizer.canceled = console.log
      }
    }, this.logger.warn)
  }

然后識別器將只記錄一個帶有消息Unable to contact server. StatusCode: 1006, undefined Reason: Unsupported type: object at: (shallow) Unable to contact server. StatusCode: 1006, undefined Reason: Unsupported type: object at: (shallow) 我根據 azure 文檔創建了一個語音服務,並按照 Azure 門戶中的示例實現中的定義實現了此代碼。

遺憾的是,此錯誤消息對我沒有太大幫助,我也無法在 Azure 知識庫中找到任何內容。

其他人有同樣的問題嗎?

我能夠通過使用我的 package.json 顯式設置手動分辨率來解決此問題。 這似乎源於 asn1.js 中使用的證書方法。 謝謝你的幫助。 我在那里添加了這一行:

{
  "resolutions": {
    "microsoft-cognitiveservices-speech-sdk/**/asn1.js": "5.4.1"
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM