目前,我正在创建一个STT应用程序
v16.x
我在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)
记录一个事件。我已经根据azure文档创建了一个语音服务,并实现了在Azure门户中的示例实现中定义的代码。
遗憾的是,这条错误信息对我没有太大帮助,我也无法在Azure KnowlegeBase中找到任何东西。
其他人也有同样的问题吗?
发布于 2022-02-03 15:13:36
我能够通过使用我的package.json显式设置手动决议来解决这个问题。这似乎源自asn1.js中使用的证书方法。谢谢你的帮助。我在这里加了一行:
{
"resolutions": {
"microsoft-cognitiveservices-speech-sdk/**/asn1.js": "5.4.1"
}
}
https://stackoverflow.com/questions/70893219
复制相似问题