You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#customer intent: As a developer, I want to use Speech services to covert speech to text, from either a microphone or a file using my choice of technology.
#customer intent: As a developer, I want to use the Speech service to covert speech to text, from either a microphone or a file using my choice of technology.
15
15
---
16
16
17
17
# Quickstart: Recognize and convert speech to text
18
18
19
-
::: zone pivot="ai-studio"
19
+
::: zone pivot="ai-foundry"
20
20
[!INCLUDE [Azure AI Foundry include](includes/quickstarts/speech-to-text-basics/ai-foundry.md)]
Copy file name to clipboardExpand all lines: articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/javascript.md
+65-62Lines changed: 65 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,85 +16,88 @@ ms.author: eur
16
16
17
17
You also need a *.wav* audio file on your local machine. You can use your own *.wav* file (up to 30 seconds) or download the [https://crbn.us/whatstheweatherlike.wav](https://crbn.us/whatstheweatherlike.wav) sample file.
18
18
19
-
## Set up the environment
19
+
## Setup
20
20
21
-
To set up your environment, install the Speech SDK for JavaScript. Run this command: `npm install microsoft-cognitiveservices-speech-sdk`. For guided installation instructions, see [Install the Speech SDK](../../../quickstarts/setup-platform.md?pivots=programming-language-javascript).
21
+
1. Create a new folder `transcription-quickstart` and go to the quickstart folder with the following command:
> Try out the [Azure AI Speech Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-azureaispeech.azure-ai-speech-toolkit) to easily build and run samples on Visual Studio Code.
33
+
1. Install the Speech SDK for JavaScript with:
31
34
32
-
Follow these steps to create a Node.js console application for speech recognition.
1. In *SpeechRecognition.js*, replace *YourAudioFile.wav* with your own *.wav* file. This example only recognizes speech from a *.wav*file. For information about other audio formats, see [How to use compressed input audio](~/articles/ai-services/speech-service/how-to-use-codec-compressed-audio-input-streams.md). This example supports up to 30 seconds of audio.
43
+
## Recognize speech from a file
81
44
82
-
1. To change the speech recognition language, replace `en-US` with another [supported language](~/articles/ai-services/speech-service/language-support.md). For example, use `es-ES` for Spanish (Spain). If you don't specify a language, the default is `en-US`. For details about how to identify one of multiple languages that might be spoken, see [Language identification](~/articles/ai-services/speech-service/language-identification.md).
45
+
To transcribe speech from a file:
46
+
47
+
1. Create a new file named *transcription.js* with the following content:
console.log("CANCELED: Did you set the speech resource key and region values?");
73
+
}
74
+
break;
75
+
}
76
+
speechRecognizer.close();
77
+
});
78
+
}
79
+
fromFile();
80
+
```
81
+
82
+
In *transcription.js*, replace *YourAudioFile.wav* with your own *.wav* file. This example only recognizes speech from a *.wav* file. For information about other audio formats, see [How to use compressed input audio](~/articles/ai-services/speech-service/how-to-use-codec-compressed-audio-input-streams.md). This example supports up to 30 seconds of audio.
83
+
84
+
To change the speech recognition language, replace `en-US` with another [supported language](~/articles/ai-services/speech-service/language-support.md). For example, use `es-ES` for Spanish (Spain). If you don't specify a language, the default is `en-US`. For details about how to identify one of multiple languages that might be spoken, see [Language identification](~/articles/ai-services/speech-service/language-identification.md).
83
85
84
86
1. Run your new console application to start speech recognition from a file:
85
87
86
88
```console
87
-
node.exe SpeechRecognition.js
89
+
node transcription.js
88
90
```
89
91
90
-
> [!IMPORTANT]
91
-
> Make sure that you set the `SPEECH_KEY` and `SPEECH_REGION`[environment variables](#set-environment-variables). If you don't set these variables, the sample fails with an error message.
92
+
Wait a few moments to get the response.
92
93
93
-
The speech from the audio file should be output as text:
94
+
## Output
94
95
95
-
```output
96
-
RECOGNIZED: Text=I'm excited to try speech to text.
97
-
```
96
+
The speech from the audio file should be output as text:
97
+
98
+
```output
99
+
RECOGNIZED: Text=I'm excited to try speech to text.
0 commit comments