Reputation: 373
currently I am creating an STT application using
I have created an azure Speech Cognitive resource in the region westeurope
and verified the key is correct.
Now I am using the following code to perform speech recognition:
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)
}
the recognizer will then just log an event with the message Unable to contact server. StatusCode: 1006, undefined Reason: Unsupported type: object at: (shallow)
.
I have created a speech service according to the azure docs and implemented this code as defined in the sample implementation in Azure portal.
Sadly this error message is not very helpful to me nor am I able to find anything in the Azure KnowlegeBase.
Does anybody else have the same problem?
Upvotes: 2
Views: 1642
Reputation: 1
If it's not the keys
, then it's most likely a mismatch with the supported NodeJS version. Don't use the latest, try the most supported. As of May 2024, Node 18
works well!
Upvotes: 0
Reputation: 711
I solved this by changing the subscription key.
Azure was showing the wrong subscription key on the Speech Services Overview page. "Key 1" and "Key 2" was showing the same key, which turned out to be "Key 2".
However, the keys are also available in the "Keys and Endpoint" section, but here "Key 1" had another value, which worked for me.
Upvotes: 1
Reputation: 373
I was able to solve this issue by explicitly setting manual resolutions using my package.json. This seems to originate from the Certificate Methods used in asn1.js. Thanks for your help. I added this line there:
{
"resolutions": {
"microsoft-cognitiveservices-speech-sdk/**/asn1.js": "5.4.1"
}
}
Upvotes: 0