目前我正在使用创建一个 STT 应用程序
- NodeJS v16.x
- microsoft-cognitiveservices-speech-sdk v1.17.0
我在该地区创建了一个 azure Speech Cognitive 资源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 知识库中找到任何内容。
其他人有同样的问题吗?