Skip to content

Commit 138136c

Browse files
Merge pull request #6089 from MicrosoftDocs/main
7/17/2025 11:00 AM IST Publish
2 parents db33d34 + c519280 commit 138136c

File tree

14 files changed

+312
-186
lines changed

14 files changed

+312
-186
lines changed

articles/ai-services/language-service/index.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,9 @@ additionalContent:
106106
links:
107107
- text: Support and help
108108
url: ../cognitive-services-support-options.md?context=/azure/ai-services/speech-service/context/context
109+
- title: Announced for Deprecation
110+
links:
111+
- text: Language Understanding
112+
url: ../luis/index.yml
113+
- text: QnA Maker
114+
url: ../qnamaker/index.yml

articles/ai-services/speech-service/get-started-speech-to-text.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ author: eric-urban
66
manager: nitinme
77
ms.service: azure-ai-speech
88
ms.topic: quickstart
9-
ms.date: 3/10/2025
9+
ms.date: 7/16/2025
1010
ms.author: eur
1111
ms.reviewer: eur
1212
ms.custom: devx-track-python, devx-track-js, devx-track-csharp, mode-other, devx-track-extended-java, devx-track-go, build-2024, ignite-2024
13-
zone_pivot_groups: programming-languages-speech-services-studio
14-
#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.
13+
zone_pivot_groups: programming-languages-get-started-transcription
14+
#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.
1515
---
1616

1717
# Quickstart: Recognize and convert speech to text
1818

19-
::: zone pivot="ai-studio"
19+
::: zone pivot="ai-foundry"
2020
[!INCLUDE [Azure AI Foundry include](includes/quickstarts/speech-to-text-basics/ai-foundry.md)]
2121
::: zone-end
2222

@@ -48,12 +48,12 @@ zone_pivot_groups: programming-languages-speech-services-studio
4848
[!INCLUDE [Swift include](includes/quickstarts/speech-to-text-basics/swift.md)]
4949
::: zone-end
5050

51-
::: zone pivot="programming-language-rest"
52-
[!INCLUDE [REST include](includes/quickstarts/speech-to-text-basics/rest.md)]
51+
::: zone pivot="programming-language-typescript"
52+
[!INCLUDE [TypeScript include](includes/quickstarts/speech-to-text-basics/typescript.md)]
5353
::: zone-end
5454

55-
::: zone pivot="programming-language-cli"
56-
[!INCLUDE [CLI include](includes/quickstarts/speech-to-text-basics/cli.md)]
55+
::: zone pivot="programming-language-rest"
56+
[!INCLUDE [REST include](includes/quickstarts/speech-to-text-basics/rest.md)]
5757
::: zone-end
5858

5959
## Next step

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/cli.md

Lines changed: 0 additions & 95 deletions
This file was deleted.

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: eric-urban
33
ms.service: azure-ai-speech
44
ms.topic: include
5-
ms.date: 01/30/2024
5+
ms.date: 7/16/2025
66
ms.author: eur
77
---
88

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/csharp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: eric-urban
33
ms.service: azure-ai-speech
44
ms.topic: include
5-
ms.date: 01/30/2024
5+
ms.date: 7/16/2025
66
ms.author: eur
77
---
88

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/go.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: eric-urban
33
ms.service: azure-ai-speech
44
ms.topic: include
5-
ms.date: 01/30/2024
5+
ms.date: 7/16/2025
66
ms.author: eur
77
---
88

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: eric-urban
33
ms.service: azure-ai-speech
44
ms.topic: include
5-
ms.date: 01/30/2024
5+
ms.date: 7/16/2025
66
ms.author: eur
77
---
88

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/javascript.md

Lines changed: 65 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -16,85 +16,88 @@ ms.author: eur
1616

1717
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.
1818

19-
## Set up the environment
19+
## Setup
2020

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:
2222

23-
### Set environment variables
23+
```shell
24+
mkdir transcription-quickstart && cd transcription-quickstart
25+
```
26+
27+
1. Create the `package.json` with the following command:
2428

25-
[!INCLUDE [Environment variables](../../common/environment-variables.md)]
26-
27-
## Recognize speech from a file
29+
```shell
30+
npm init -y
31+
```
2832

29-
> [!TIP]
30-
> 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:
3134

32-
Follow these steps to create a Node.js console application for speech recognition.
35+
```console
36+
npm install microsoft-cognitiveservices-speech-sdk
37+
```
3338

34-
1. Open a command prompt window where you want the new project, and create a new file named *SpeechRecognition.js*.
35-
1. Install the Speech SDK for JavaScript:
36-
37-
```console
38-
npm install microsoft-cognitiveservices-speech-sdk
39-
```
39+
### Retrieve resource information
4040

41-
1. Copy the following code into *SpeechRecognition.js*:
42-
43-
```javascript
44-
const fs = require("fs");
45-
const sdk = require("microsoft-cognitiveservices-speech-sdk");
46-
47-
// This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
48-
const speechConfig = sdk.SpeechConfig.fromSubscription(process.env.SPEECH_KEY, process.env.SPEECH_REGION);
49-
speechConfig.speechRecognitionLanguage = "en-US";
50-
51-
function fromFile() {
52-
let audioConfig = sdk.AudioConfig.fromWavFileInput(fs.readFileSync("YourAudioFile.wav"));
53-
let speechRecognizer = new sdk.SpeechRecognizer(speechConfig, audioConfig);
54-
55-
speechRecognizer.recognizeOnceAsync(result => {
56-
switch (result.reason) {
57-
case sdk.ResultReason.RecognizedSpeech:
58-
console.log(`RECOGNIZED: Text=${result.text}`);
59-
break;
60-
case sdk.ResultReason.NoMatch:
61-
console.log("NOMATCH: Speech could not be recognized.");
62-
break;
63-
case sdk.ResultReason.Canceled:
64-
const cancellation = sdk.CancellationDetails.fromResult(result);
65-
console.log(`CANCELED: Reason=${cancellation.reason}`);
66-
67-
if (cancellation.reason == sdk.CancellationReason.Error) {
68-
console.log(`CANCELED: ErrorCode=${cancellation.ErrorCode}`);
69-
console.log(`CANCELED: ErrorDetails=${cancellation.errorDetails}`);
70-
console.log("CANCELED: Did you set the speech resource key and region values?");
71-
}
72-
break;
73-
}
74-
speechRecognizer.close();
75-
});
76-
}
77-
fromFile();
78-
```
41+
[!INCLUDE [Environment variables](../../common/environment-variables.md)]
7942

80-
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
8144

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:
48+
49+
```javascript
50+
import { readFileSync } from "fs";
51+
import { SpeechConfig, AudioConfig, SpeechRecognizer, ResultReason, CancellationDetails, CancellationReason } from "microsoft-cognitiveservices-speech-sdk";
52+
// This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
53+
const speechConfig = SpeechConfig.fromSubscription(process.env.SPEECH_KEY, process.env.SPEECH_REGION);
54+
speechConfig.speechRecognitionLanguage = "en-US";
55+
function fromFile() {
56+
const audioConfig = AudioConfig.fromWavFileInput(readFileSync("YourAudioFile.wav"));
57+
const speechRecognizer = new SpeechRecognizer(speechConfig, audioConfig);
58+
speechRecognizer.recognizeOnceAsync((result) => {
59+
switch (result.reason) {
60+
case ResultReason.RecognizedSpeech:
61+
console.log(`RECOGNIZED: Text=${result.text}`);
62+
break;
63+
case ResultReason.NoMatch:
64+
console.log("NOMATCH: Speech could not be recognized.");
65+
break;
66+
case ResultReason.Canceled:
67+
const cancellation = CancellationDetails.fromResult(result);
68+
console.log(`CANCELED: Reason=${cancellation.reason}`);
69+
if (cancellation.reason === CancellationReason.Error) {
70+
console.log(`CANCELED: ErrorCode=${cancellation.ErrorCode}`);
71+
console.log(`CANCELED: ErrorDetails=${cancellation.errorDetails}`);
72+
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).
8385
8486
1. Run your new console application to start speech recognition from a file:
8587
8688
```console
87-
node.exe SpeechRecognition.js
89+
node transcription.js
8890
```
8991
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.
9293
93-
The speech from the audio file should be output as text:
94+
## Output
9495
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.
100+
```
98101
99102
## Remarks
100103

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: eric-urban
33
ms.service: azure-ai-speech
44
ms.topic: include
5-
ms.date: 01/30/2024
5+
ms.date: 7/16/2025
66
ms.author: eur
77
---
88

articles/ai-services/speech-service/includes/quickstarts/speech-to-text-basics/rest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: eric-urban
33
ms.service: azure-ai-speech
44
ms.topic: include
5-
ms.date: 01/30/2024
5+
ms.date: 7/16/2025
66
ms.author: eur
77
---
88

0 commit comments

Comments
 (0)