Skip to content

Commit 160c6fc

Browse files
authored
Merge pull request #4908 from rhurey/staging
Speech SDK 1.44 doc updates
2 parents e187aaf + 31e2ff1 commit 160c6fc

File tree

22 files changed

+341
-171
lines changed

22 files changed

+341
-171
lines changed

articles/ai-services/speech-service/embedded-speech.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Embedded speech is included with the Speech SDK (version 1.24.1 and higher) for
2727

2828
# [Android](#tab/android-target)
2929

30-
Requires Android 7.0 (API level 24) or higher on Arm64 (`arm64-v8a`) or Arm32 (`armeabi-v7a`) hardware.
30+
Requires Android 8.0 (API level 26) or higher on Arm64 (`arm64-v8a`) or Arm32 (`armeabi-v7a`) hardware.
3131

3232
Embedded TTS with neural voices is only supported on Arm64.
3333

articles/ai-services/speech-service/how-to-configure-azure-ad-auth.md

Lines changed: 64 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ For programming languages where a Microsoft identity platform client library isn
121121

122122
## Get the Speech resource ID
123123

124-
You need your Speech resource ID to make SDK calls using Microsoft Entra authentication.
124+
You need your Speech resource ID to make SDK calls using Microsoft Entra authentication in scenarios that don't yet support Entra ID directly.
125125

126126
# [Azure portal](#tab/portal)
127127

@@ -184,7 +184,7 @@ For ```SpeechRecognizer```, ```SourceLanguageRecognizer```, ```ConversationTrans
184184
TokenCredential browserCredential = new InteractiveBrowserCredential();
185185

186186
// Define the custom domain endpoint for your Speech resource.
187-
var endpoint = "wss://{your custom name}.cognitiveservices.azure.com/stt/speech/universal/v2";
187+
var endpoint = "https://{your custom name}.cognitiveservices.azure.com/";
188188

189189
// Create the SpeechConfig object using the custom domain endpoint and TokenCredential.
190190
var speechConfig = SpeechConfig.FromEndpoint(new Uri(endpoint), browserCredential);
@@ -198,7 +198,7 @@ For ```TranslationRecognizer``` object, use an appropriate instance of [TokenCre
198198
TokenCredential browserCredential = new InteractiveBrowserCredential();
199199

200200
// Define the custom domain endpoint for your Speech resource
201-
var endpoint = "wss://{your custom name}.cognitiveservices.azure.com/stt/speech/universal/v2";
201+
var endpoint = "https://{your custom name}.cognitiveservices.azure.com/";
202202

203203
// Create the SpeechTranslationConfig object using the custom domain endpoint and TokenCredential.
204204
var speechConfig = SpeechTranslationConfig.FromEndpoint(new Uri(endpoint), browserCredential);
@@ -233,38 +233,7 @@ std::string region = "Your Speech Region";
233233
auto authorizationToken = "aad#" + resourceId + "#" + aadToken;
234234
auto speechConfig = SpeechConfig::FromAuthorizationToken(authorizationToken, region);
235235
```
236-
::: zone-end
237-
238-
::: zone pivot="programming-language-java"
239-
### SpeechRecognizer, SpeechSynthesizer, IntentRecognizer, ConversationTranscriber
240-
241-
For ```SpeechRecognizer```, ```SpeechSynthesizer```, ```IntentRecognizer```, ```ConversationTranscriber``` objects, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ```SpeechConfig``` object.
242-
243-
```Java
244-
String resourceId = "Your Resource ID";
245-
String region = "Your Region";
246-
247-
// You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
248-
String authorizationToken = "aad#" + resourceId + "#" + token;
249-
SpeechConfig speechConfig = SpeechConfig.fromAuthorizationToken(authorizationToken, region);
250-
```
251-
::: zone-end
252-
253-
::: zone pivot="programming-language-python"
254-
### SpeechRecognizer, SpeechSynthesizer, IntentRecognizer, ConversationTranscriber
255-
256-
For ```SpeechRecognizer```, ```SpeechSynthesizer```, ```IntentRecognizer```, ```ConversationTranscriber``` objects, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ```SpeechConfig``` object.
257-
258-
```Python
259-
resourceId = "Your Resource ID"
260-
region = "Your Region"
261-
# You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
262-
authorizationToken = "aad#" + resourceId + "#" + aadToken.token
263-
speechConfig = SpeechConfig(auth_token=authorizationToken, region=region)
264-
```
265-
::: zone-end
266236

267-
::: zone pivot="programming-language-cpp"
268237
### TranslationRecognizer
269238

270239
For the ```TranslationRecognizer```, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ```SpeechTranslationConfig``` object.
@@ -278,35 +247,91 @@ std::string region = "Your Speech Region";
278247
auto authorizationToken = "aad#" + resourceId + "#" + aadToken;
279248
auto speechConfig = SpeechTranslationConfig::FromAuthorizationToken(authorizationToken, region);
280249
```
250+
281251
::: zone-end
282252

283253
::: zone pivot="programming-language-java"
254+
### SpeechRecognizer, ConversationTranscriber
255+
256+
For ```SpeechRecognizer```, ```ConversationTranscriber``` objects, use an appropriate instance of [TokenCredential](/dotnet/api/azure.core.tokencredential) for authentication, along with the endpoint that includes your [custom domain](/azure/ai-services/speech-service/speech-services-private-link?tabs=portal#create-a-custom-domain-name), to create a ```SpeechConfig``` object.
257+
258+
```Java
259+
TokenCredential browserCredential = new InteractiveBrowserCredentialBuilder().build();
260+
261+
// Define the custom domain endpoint for your Speech resource.
262+
String endpoint = "https://{your custom name}.cognitiveservices.azure.com/";
263+
264+
// Create the SpeechConfig object using the custom domain endpoint and TokenCredential.
265+
SpeechConfig speechConfig = SpeechConfig.fromEndpoint(new java.net.URI(endpoint), browserCredential);
266+
```
267+
284268
### TranslationRecognizer
285269

286-
For the ```TranslationRecognizer```, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ```SpeechTranslationConfig``` object.
270+
For ```TranslationRecognizer``` object, use an appropriate instance of [TokenCredential](/dotnet/api/azure.core.tokencredential) for authentication, along with the endpoint that includes your [custom domain](/azure/ai-services/speech-service/speech-services-private-link?tabs=portal#create-a-custom-domain-name), to create a ```SpeechTranslationConfig``` object.
271+
272+
```Java
273+
TokenCredential browserCredential = new InteractiveBrowserCredentialBuilder().build();
274+
275+
// Define the custom domain endpoint for your Speech resource
276+
String endpoint = "https://{your custom name}.cognitiveservices.azure.com/";
277+
278+
// Create the SpeechTranslationConfig object using the custom domain endpoint and TokenCredential.
279+
SpeechConfig speechConfig = SpeechTranslationConfig.fromEndpoint(new java.net.URI(endpoint), browserCredential);
280+
```
281+
282+
### SpeechSynthesizer, IntentRecognizer
283+
284+
For ```SpeechSynthesizer```, ```IntentRecognizer``` objects, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ```SpeechConfig``` object.
287285

288286
```Java
289287
String resourceId = "Your Resource ID";
290288
String region = "Your Region";
291289

292290
// You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
293291
String authorizationToken = "aad#" + resourceId + "#" + token;
294-
SpeechTranslationConfig translationConfig = SpeechTranslationConfig.fromAuthorizationToken(authorizationToken, region);
292+
SpeechConfig speechConfig = SpeechConfig.fromAuthorizationToken(authorizationToken, region);
295293
```
296294
::: zone-end
297295

298296
::: zone pivot="programming-language-python"
297+
### SpeechRecognizer, ConversationTranscriber
298+
299+
For ```SpeechRecognizer```, ```ConversationTranscriber``` objects, use an appropriate instance of [TokenCredential](/dotnet/api/azure.core.tokencredential) for authentication, along with the endpoint that includes your [custom domain](/azure/ai-services/speech-service/speech-services-private-link?tabs=portal#create-a-custom-domain-name), to create a ```SpeechConfig``` object.
300+
301+
```Python
302+
browserCredential = InteractiveBrowserCredential()
303+
304+
// Define the custom domain endpoint for your Speech resource.
305+
custom_endpoint = "https://{your custom name}.cognitiveservices.azure.com/"
306+
307+
// Create the SpeechConfig object using the custom domain endpoint and TokenCredential.
308+
speechConfig = SpeechConfig(token_credential=credential, endpoint=custom_endpoint)
309+
```
310+
299311
### TranslationRecognizer
300312

301-
For the ```TranslationRecognizer```, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ```SpeechTranslationConfig``` object.
313+
For ```TranslationRecognizer``` object, use an appropriate instance of [TokenCredential](/dotnet/api/azure.core.tokencredential) for authentication, along with the endpoint that includes your [custom domain](/azure/ai-services/speech-service/speech-services-private-link?tabs=portal#create-a-custom-domain-name), to create a ```SpeechTranslationConfig``` object.
314+
315+
```Python
316+
browserCredential = InteractiveBrowserCredential()
317+
318+
// Define the custom domain endpoint for your Speech resource
319+
custom_endpoint = "https://{your custom name}.cognitiveservices.azure.com/"
320+
321+
// Create the SpeechTranslationConfig object using the custom domain endpoint and TokenCredential.
322+
speechTranslationConfig = SpeechTranslationConfig(token_credential=credential, endpoint=custom_endpoint)
323+
```
324+
325+
### SpeechSynthesizer, IntentRecognizer
326+
327+
For ```SpeechSynthesizer```, ```IntentRecognizer``` objects, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ```SpeechConfig``` object.
302328

303329
```Python
304330
resourceId = "Your Resource ID"
305331
region = "Your Region"
306-
307332
# You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
308333
authorizationToken = "aad#" + resourceId + "#" + aadToken.token
309-
translationConfig = SpeechTranslationConfig(auth_token=authorizationToken, region=region)
334+
speechConfig = SpeechConfig(auth_token=authorizationToken, region=region)
310335
```
311336
::: zone-end
312337

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
author: eric-urban
3+
ms.service: azure-ai-speech
4+
ms.date: 9/9/2024
5+
ms.topic: include
6+
ms.author: eur
7+
---
8+
9+
> [!div class="checklist"]
10+
> - An Azure subscription. You can [create one for free](https://azure.microsoft.com/free/cognitive-services).
11+
> - [Create an AI Services resource for Speech](https://portal.azure.com/#create/Microsoft.CognitiveServicesAIServices) in the Azure portal.
12+
> - Get the Speech resource key and endpoint. After your Speech resource is deployed, select **Go to resource** to view and manage keys.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
author: eric-urban
3+
ms.service: azure-ai-speech
4+
ms.topic: include
5+
ms.date: 8/11/2024
6+
ms.author: eur
7+
---
8+
9+
You need to authenticate your application to access Azure AI services. This article shows you how to use environment variables to store your credentials. You can then access the environment variables from your code to authenticate your application. For production, use a more secure way to store and access your credentials.
10+
11+
[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/microsoft-entra-id-akv-expanded.md)]
12+
13+
To set the environment variables for your Speech resource key and endpoint, open a console window, and follow the instructions for your operating system and development environment.
14+
15+
- To set the `SPEECH_KEY` environment variable, replace *your-key* with one of the keys for your resource.
16+
- To set the `ENDPOINT` environment variable, replace *your-endpoint* with one of the endpoints for your resource.
17+
18+
#### [Windows](#tab/windows)
19+
20+
```console
21+
setx SPEECH_KEY your-key
22+
setx ENDPOINT your-endpoint
23+
```
24+
25+
> [!NOTE]
26+
> If you only need to access the environment variables in the current console, you can set the environment variable with `set` instead of `setx`.
27+
28+
After you add the environment variables, you might need to restart any programs that need to read the environment variables, including the console window. For example, if you're using Visual Studio as your editor, restart Visual Studio before you run the example.
29+
30+
#### [Linux](#tab/linux)
31+
32+
##### Bash
33+
34+
Edit your *.bashrc* file, and add the environment variables:
35+
36+
```bash
37+
export SPEECH_KEY=your-key
38+
export ENDPOINT=your-endpoint
39+
```
40+
41+
After you add the environment variables, run `source ~/.bashrc` from your console window to make the changes effective.
42+
43+
#### [macOS](#tab/macos)
44+
45+
##### Bash
46+
47+
Edit your *.bash_profile* file, and add the environment variables:
48+
49+
```bash
50+
export SPEECH_KEY=your-key
51+
export ENDPOINT=your-endpoint
52+
```
53+
54+
After you add the environment variables, run `source ~/.bash_profile` from your console window to make the changes effective.
55+
56+
##### Xcode
57+
58+
For iOS and macOS development, you set the environment variables in Xcode. For example, follow these steps to set the environment variable in Xcode 13.4.1.
59+
60+
1. Select **Product** > **Scheme** > **Edit scheme**.
61+
1. Select **Arguments** on the **Run** (Debug Run) page.
62+
1. Under **Environment Variables** select the plus (+) sign to add a new environment variable.
63+
1. Enter `SPEECH_KEY` for the **Name** and enter your Speech resource key for the **Value**.
64+
65+
To set the environment variable for your Speech resource endpoint, follow the same steps. Set `ENDPOINT` to the endpoint of your resource. For example, `https://YourServiceRegion.api.cognitive.microsoft.com`.
66+
67+
68+
69+
For more configuration options, see [the Xcode documentation](https://help.apple.com/xcode/#/dev745c5c974).
70+
71+
---

articles/ai-services/speech-service/includes/quickstarts/platform/java-android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Create a new project in Android Studio and add the Speech SDK for Java as a libr
3636
1. Enter *samples.speech.cognitiveservices.microsoft.com* in the **Package name** text box.
3737
1. Select a project directory in the **Save location** selection box.
3838
1. Select **Java** in the **Language** selection box.
39-
1. Select **API 23: Android 6.0 (Marshmallow)** in the **Minimum API level** selection box.
39+
1. Select **API 26: Android 8.0 (Oreo)** in the **Minimum API level** selection box.
4040
1. Select **Finish**.
4141

4242
Android Studio takes some time to prepare your new project. For your first time using Android Studio, it might take a few minutes to set preferences, accept licenses, and complete the wizard.

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ ms.author: eur
1212

1313
## Prerequisites
1414

15-
[!INCLUDE [Prerequisites](../../common/azure-prerequisites.md)]
15+
[!INCLUDE [Prerequisites](../../common/azure-prerequisites-resourcekey-endpoint.md)]
1616

1717
## Set up the environment
1818

1919
The Speech SDK is available as a [NuGet package](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech) and implements .NET Standard 2.0. You install the Speech SDK later in this guide. For other requirements, see [Install the Speech SDK](../../../quickstarts/setup-platform.md?pivots=programming-language-cpp).
2020

2121
### Set environment variables
2222

23-
[!INCLUDE [Environment variables](../../common/environment-variables.md)]
23+
[!INCLUDE [Environment variables](../../common/environment-variables-resourcekey-endpoint.md)]
2424

2525
## Recognize speech from a microphone
2626

@@ -51,16 +51,16 @@ Follow these steps to create a console application and install the Speech SDK.
5151
5252
int main()
5353
{
54-
// This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
54+
// This example requires environment variables named "SPEECH_KEY" and "ENDPOINT"
5555
auto speechKey = GetEnvironmentVariable("SPEECH_KEY");
56-
auto speechRegion = GetEnvironmentVariable("SPEECH_REGION");
56+
auto endpoint = GetEnvironmentVariable("ENDPOINT");
5757
58-
if ((size(speechKey) == 0) || (size(speechRegion) == 0)) {
59-
std::cout << "Please set both SPEECH_KEY and SPEECH_REGION environment variables." << std::endl;
58+
if ((size(speechKey) == 0) || (size(endpoint) == 0)) {
59+
std::cout << "Please set both SPEECH_KEY and ENDPOINT environment variables." << std::endl;
6060
return -1;
6161
}
6262
63-
auto speechConfig = SpeechConfig::FromSubscription(speechKey, speechRegion);
63+
auto speechConfig = SpeechConfig::FromEndpoint(speechKey, endpoint);
6464
6565
speechConfig->SetSpeechRecognitionLanguage("en-US");
6666
@@ -87,7 +87,7 @@ Follow these steps to create a console application and install the Speech SDK.
8787
{
8888
std::cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
8989
std::cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
90-
std::cout << "CANCELED: Did you set the speech resource key and region values?" << std::endl;
90+
std::cout << "CANCELED: Did you set the speech resource key and endpoint values?" << std::endl;
9191
}
9292
}
9393
}
@@ -113,10 +113,10 @@ Follow these steps to create a console application and install the Speech SDK.
113113

114114
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).
115115

116-
1. [Build and run](/cpp/build/vscpp-step-2-build) your new console application to start speech recognition from a microphone.
116+
1. To start speech recognition from a microphone, [Build and run](/cpp/build/vscpp-step-2-build) your new console application.
117117

118118
> [!IMPORTANT]
119-
> 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.
119+
> Make sure that you set the `SPEECH_KEY` and `ENDPOINT` [environment variables](#set-environment-variables). If you don't set these variables, the sample fails with an error message.
120120
121121
1. Speak into your microphone when prompted. What you speak should appear as text:
122122

0 commit comments

Comments
 (0)