Get started with Azure Speech Service
Choose your preferred language to see a complete sample that demonstrates speech-to-text, text-to-speech, and speech translation using Azure Cognitive Services.
Run a simple transcription in the browser
This example uses the Azure Speech SDK for JavaScript. Replace <YourSubscriptionKey>
and <YourRegion>
with your own credentials.
const speechConfig = SpeechSDK.SpeechConfig.fromSubscription("<YourSubscriptionKey>", "<YourRegion>");
speechConfig.speechRecognitionLanguage = "en-US";
const audioConfig = SpeechSDK.AudioConfig.fromDefaultMicrophoneInput();
const recognizer = new SpeechSDK.SpeechRecognizer(speechConfig, audioConfig);
recognizer.recognizing = (s, e) => {
console.log(`RECOGNIZING: ${e.result.text}`);
};
recognizer.recognized = (s, e) => {
if (e.result.reason === SpeechSDK.ResultReason.RecognizedSpeech) {
console.log(`RECOGNIZED: ${e.result.text}`);
}
};
recognizer.startContinuousRecognitionAsync();