Это не расшифровка полного аудиофайла, и процесс захватывающий перед расшифровкой полного аудиофайла. Это только запись первых нескольких секунд аудиофайла.
Я отослал это https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstart-js-node#prerequisites
Может ли кто-нибудь помочь мне с этим?
// pull in the required packages.
var sdk = require("microsoft-cognitiveservices-speech-sdk");
var fs = require("fs");
var axios = require('axios')
// replace with your own subscription key,
// service region (e.g., "westus"), and
// the name of the file you want to run
// through the speech recognizer.
var subscriptionKey = "";
var serviceRegion = ""; // e.g., "westus"
var filename = "output2.wav"; // 16000 Hz, Mono
// create the push stream we need for the speech sdk.
var pushStream = sdk.AudioInputStream.createPushStream();
// open the file and push it to the push stream.
fs.createReadStream(filename).on('data', function (arrayBuffer) {
// console.log(arrayBuffer);
pushStream.write(arrayBuffer.buffer);
}).on('end', function () {
pushStream.close();
});
// we are done with the setup
console.log("Now recognizing from: " + filename);
// now create the audio-config pointing to our stream and
// the speech config specifying the language.
var audioConfig = sdk.AudioConfig.fromStreamInput(pushStream);
var speechConfig = sdk.SpeechConfig.fromSubscription(subscriptionKey, serviceRegion);
// setting the recognition language to English.
speechConfig.speechRecognitionLanguage = "en-US";
// create the speech recognizer.
var recognizer = new sdk.SpeechRecognizer(speechConfig, audioConfig);
// start the recognizer and wait for a result.
recognizer.recognizeOnceAsync(
function (result) {
console.log(result);
recognizer.close();
recognizer = undefined;
},
function (err) {
console.trace("err - " + err);
recognizer.close();
recognizer = undefined;
});