When I was trying to translate a sample audio from English to some other language using Azure Bing Speech to Text Api, I am getting Error: Voice recognition failed miserably: Wrong status code 401 in Bing Speech API / token
I have tried increasing open_timeout to a higher value like 50000(which was suggested for slow-internet) hard-coded in bingspeech-api-client in Line 110 , but still the error persists.
let audioStream = fs.createReadStream('hello.wav');
// Bing Speech Key (https://www.microsoft.com/cognitive-services/en-us/subscriptions)
let subscriptionKey = '******';
let client = new BingSpeechClient(subscriptionKey);
client.recognizeStream(audioStream).then(function(response)
{
console.log("response is ",response);
console.log("-------------------------------------------------");
console.log("response is ",response.results[0]);
}).catch(function(error)
{
console.log("error occured is ",error);
});
This code should generate the text from that sample audio file.