Skip to content

Commit 9721861

Browse files
authored
Merge pull request #108338 from trrwilson/user/travisw/migrate-voice-assistant-to-pivots
Move voice assistant quickstarts into common pivot pattern
2 parents bb083f5 + 4e34434 commit 9721861

File tree

17 files changed

+281
-183
lines changed

17 files changed

+281
-183
lines changed

.openpublishing.redirection.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50325,6 +50325,18 @@
5032550325
"source_path": "articles/sql-data-warehouse/what-is-a-data-warehouse-unit-dwu-cdwu.md",
5032650326
"redirect_url": "/azure/synapse-analytics/sql-data-warehouse/what-is-a-data-warehouse-unit-dwu-cdwu",
5032750327
"redirect_document_id": true
50328+
},
50329+
{
50330+
"source_path": "articles/cognitive-services/speech-service/quickstart-voice-assistant-java-android.md",
50331+
"redirect_url": "/azure/cognitive-services/speech-service/quickstarts/voice-assistants?pivots=programming-language-java&tabs=android"
50332+
},
50333+
{
50334+
"source_path": "articles/cognitive-services/speech-service/quickstart-voice-assistant-java-jre.md",
50335+
"redirect_url": "/azure/cognitive-services/speech-service/quickstarts/voice-assistants?pivots=programming-language-java&tabs=jre"
50336+
},
50337+
{
50338+
"source_path": "articles/cognitive-services/Speech-Service/quickstart-voice-assistant-csharp-uwp.md",
50339+
"redirect_url": "/azure/cognitive-services/speech-service/quickstarts/voice-assistants?pivots=programming-language-csharp&tabs=uwp"
5032850340
}
5032950341
]
5033050342
}

articles/cognitive-services/Speech-Service/includes/quickstarts/quickstart-list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
- [Quickstart: Synthesize text to an audio device](~/articles/cognitive-services/speech-service/quickstarts/text-to-speech.md)
66
- [Quickstart: Synthesize text to a file](~/articles/cognitive-services/speech-service/quickstarts/text-to-speech-audio-file.md)
77
- [Quickstart: Recognize Intents](~/articles/cognitive-services/speech-service/quickstarts/intent-recognition.md)
8+
- [Quickstart: Create a custom voice assistant](~/articles/cognitive-services/speech-service/quickstarts/voice-assistants.md)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: "Quickstart: Create a custom voice assistant, C# - Speech service"
3+
titleSuffix: Azure Cognitive Services
4+
services: cognitive-services
5+
author: trrwilson
6+
manager: nitinme
7+
ms.service: cognitive-services
8+
ms.subservice: speech-service
9+
ms.topic: include
10+
ms.date: 03/20/2020
11+
ms.author: travisw
12+
---
13+
14+
[!INCLUDE [uwp](./uwp.md)]
15+
16+
***
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: "Quickstart: Create a custom voice assistant, C# - Speech service"
3+
titleSuffix: Azure Cognitive Services
4+
services: cognitive-services
5+
author: trrwilson
6+
manager: nitinme
7+
ms.service: cognitive-services
8+
ms.subservice: speech-service
9+
ms.topic: include
10+
ms.date: 03/20/2020
11+
ms.author: travisw
12+
---
13+
14+
> [!div class="nextstepaction"]
15+
> [Explore C# samples on GitHub](https://aka.ms/speech/github-csharp)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: "Quickstart: Create a custom voice assistant, C# - Speech service"
3+
titleSuffix: Azure Cognitive Services
4+
services: cognitive-services
5+
author: trrwilson
6+
manager: nitinme
7+
ms.service: cognitive-services
8+
ms.subservice: speech-service
9+
ms.topic: include
10+
ms.date: 03/20/2020
11+
ms.author: travisw
12+
---
13+
14+
If you prefer to jump right in, view or download all [Speech SDK C# Samples](https://aka.ms/speech/github-csharp) on GitHub. Otherwise, let's get started.

articles/cognitive-services/Speech-Service/quickstart-voice-assistant-csharp-uwp.md renamed to articles/cognitive-services/Speech-Service/includes/quickstarts/voice-assistants/csharp/uwp.md

Lines changed: 28 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,35 @@
11
---
2-
title: 'Quickstart: Custom voice assistant, C# (UWP) - Speech service'
3-
titleSuffix: Azure Cognitive Services
4-
description: In this article, you create a C# Universal Windows Platform (UWP) application by using the Cognitive Services Speech Software Development Kit (SDK). You connect your client application to a previously created Bot Framework bot configured to use the Direct Line Speech channel. The application is built with the Speech SDK NuGet Package and Microsoft Visual Studio 2019.
5-
services: cognitive-services
6-
author: IEvangelist
7-
manager: nitinme
2+
author: trrwilson
83
ms.service: cognitive-services
9-
ms.subservice: speech-service
10-
ms.topic: quickstart
11-
ms.date: 02/10/2020
12-
ms.author: dapine
4+
ms.topic: include
5+
ms.date: 03/20/2020
6+
ms.author: travisw
137
---
148

15-
# Quickstart: Create a voice assistant with the Speech SDK, UWP
16-
17-
Quickstarts are also available for [speech recognition](~/articles/cognitive-services/Speech-Service/quickstarts/speech-to-text-from-microphone.md?pivots=programming-language-csharp&tabs=uwp), [speech synthesis](~/articles/cognitive-services/Speech-Service/quickstarts/text-to-speech.md?pivots=programming-language-csharp&tabs=uwp), and [speech translation](~/articles/cognitive-services/Speech-Service/quickstarts/translate-speech-to-text.md?pivots=programming-language-csharp&tabs=uwp).
18-
19-
In this article, you'll develop a C# Universal Windows Platform (UWP) application using the [Speech SDK](speech-sdk.md). The program will connect to a previously authored and configured bot to enable a voice assistant experience from the client application. The application is built with the [Speech SDK NuGet Package](https://aka.ms/csspeech/nuget) and Microsoft Visual Studio 2019 (any edition).
20-
21-
> [!NOTE]
22-
> The Universal Windows Platform lets you develop apps that run on any device that supports Windows 10, including PCs, Xbox, Surface Hub, and other devices.
23-
249
## Prerequisites
2510

26-
This quickstart requires:
27-
28-
* [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/).
29-
* An Azure subscription key for the Speech service. [Get one for free](get-started.md) or create it on the [Azure portal](https://portal.azure.com).
30-
* A previously created bot configured with the [Direct Line Speech channel](https://docs.microsoft.com/azure/bot-service/bot-service-channel-connect-directlinespeech).
11+
Before you get started, make sure to:
3112

13+
> [!div class="checklist"]
14+
> * [Create an Azure Speech resource](~/articles/cognitive-services/speech-service/get-started.md)
15+
> * [Set up your development environment and create an empty project](~/articles/cognitive-services/speech-service/quickstarts/setup-platform.md?tabs=uwp)
16+
> * Create a bot connected to the [Direct Line Speech channel](https://docs.microsoft.com/azure/bot-service/bot-service-channel-connect-directlinespeech)
17+
> * Make sure that you have access to a microphone for audio capture
18+
>
3219
> [!NOTE]
33-
> Please refer to [the list of supported regions for voice assistants](regions.md#voice-assistants) and ensure your resources are deployed in one of those regions.
20+
> Please refer to [the list of supported regions for voice assistants](~/articles/cognitive-services/speech-service/regions.md#voice-assistants) and ensure your resources are deployed in one of those regions.
3421
35-
## Optional: Get started fast
22+
## Open your project in Visual Studio
3623

37-
This quickstart will describe, step by step, how to make a client application to connect to your speech-enabled bot. If you prefer to dive right in, the complete, ready-to-compile source code used in this quickstart is available in the [Speech SDK Samples](https://aka.ms/csspeech/samples) under the `quickstart` folder.
24+
The first step is to make sure that you have your project open in Visual Studio.
3825

39-
## Create a Visual Studio project
26+
## Start with some boilerplate code
4027

41-
[!INCLUDE [](../../../includes/cognitive-services-speech-service-quickstart-uwp-create-proj.md)]
42-
43-
## Add sample code
44-
45-
Now add the XAML code that defines the user interface of the application, and add the C# code-behind implementation.
46-
47-
### XAML code
48-
49-
First, you'll create the application's user interface by adding the XAML code:
28+
Let's add some code that works as a skeleton for our project.
5029

5130
1. In **Solution Explorer**, open `MainPage.xaml`.
5231

53-
1. In the designer's XAML view, replace the entire contents with the following code snippet:
32+
1. In the designer's XAML view, replace the entire contents with the following snippet that defines a rudimentary user interface:
5433

5534
```xml
5635
<Page
@@ -99,9 +78,7 @@ First, you'll create the application's user interface by adding the XAML code:
9978

10079
The Design view is updated to show the application's user interface.
10180

102-
### C# code-behind source
103-
104-
Then you add the code-behind source so that the application works as expected. The code-behind source includes:
81+
1. In **Solution Explorer**, open the code-behind source file `MainPage.xaml.cs`. (It's grouped under `MainPage.xaml`.) Replace the contents of this file with the below, which includes:
10582

10683
- `using` statements for the `Speech` and `Speech.Dialog` namespaces
10784
- A simple implementation to ensure microphone access, wired to a button handler
@@ -110,12 +87,6 @@ Then you add the code-behind source so that the application works as expected. T
11087
- A helper to play back text-to-speech (without streaming support)
11188
- An empty button handler to start listening that will be populated later
11289

113-
To add the code-behind source, follow these steps:
114-
115-
1. In **Solution Explorer**, open the code-behind source file `MainPage.xaml.cs`. (It's grouped under `MainPage.xaml`.)
116-
117-
1. Replace the file's contents with the following code snippet:
118-
11990
```csharp
12091
using Microsoft.CognitiveServices.Speech;
12192
using Microsoft.CognitiveServices.Speech.Audio;
@@ -283,7 +254,6 @@ To add the code-behind source, follow these steps:
283254
}
284255
}
285256
```
286-
287257
1. Add the following code snippet to the method body of `InitializeDialogServiceConnector`. This code creates the `DialogServiceConnector` with your subscription information.
288258

289259
```csharp
@@ -298,12 +268,12 @@ To add the code-behind source, follow these steps:
298268
```
299269

300270
> [!NOTE]
301-
> Please refer to [the list of supported regions for voice assistants](regions.md#voice-assistants) and ensure your resources are deployed in one of those regions.
271+
> Please refer to [the list of supported regions for voice assistants](~/articles/cognitive-services/speech-service/regions.md#voice-assistants) and ensure your resources are deployed in one of those regions.
302272

303273
> [!NOTE]
304-
> For information on configuring your bot and retrieving a channel secret, see the Bot Framework documentation for [the Direct Line Speech channel](https://docs.microsoft.com/azure/bot-service/bot-service-channel-connect-directlinespeech).
274+
> For information on configuring your bot, see the Bot Framework documentation for [the Direct Line Speech channel](https://docs.microsoft.com/azure/bot-service/bot-service-channel-connect-directlinespeech).
305275

306-
1. Replace the strings `YourChannelSecret`, `YourSpeechSubscriptionKey`, and `YourServiceRegion` with your own values for your bot, speech subscription, and [region](regions.md).
276+
1. Replace the strings `YourSpeechSubscriptionKey` and `YourServiceRegion` with your own values for your speech subscription and [region](~/articles/cognitive-services/speech-service/regions.md).
307277

308278
1. Append the following code snippet to the end of the method body of `InitializeDialogServiceConnector`. This code sets up handlers for events relied on by `DialogServiceConnector` to communicate its bot activities, speech recognition results, and other information.
309279

@@ -388,36 +358,23 @@ To add the code-behind source, follow these steps:
388358
NotifyUser($"Exception: {ex.ToString()}", NotifyType.ErrorMessage);
389359
}
390360
```
361+
362+
## Build and run your app
391363

392-
1. From the menu bar, choose **File** > **Save All** to save your changes.
393-
394-
## Build and run the application
395-
396-
Now you are ready to build and test your application.
364+
Now you're ready to build your app and test your custom voice assistant using the Speech service.
397365

398366
1. From the menu bar, choose **Build** > **Build Solution** to build the application. The code should compile without errors now.
399367

400368
1. Choose **Debug** > **Start Debugging** (or press **F5**) to start the application. The **helloworld** window appears.
401369

402-
![Sample UWP voice assistant application in C# - quickstart](media/sdk/qs-voice-assistant-uwp-helloworld-window.png)
370+
![Sample UWP voice assistant application in C# - quickstart](~/articles/cognitive-services/Speech-Service/media/sdk/qs-voice-assistant-uwp-helloworld-window.png)
403371

404372
1. Select **Enable Microphone**, and when the access permission request pops up, select **Yes**.
405373

406-
![Microphone access permission request](media/sdk/qs-csharp-uwp-10-access-prompt.png)
374+
![Microphone access permission request](~/articles/cognitive-services/Speech-Service/media/sdk/qs-csharp-uwp-10-access-prompt.png)
407375

408376
1. Select **Talk to your bot**, and speak an English phrase or sentence into your device's microphone. Your speech is transmitted to the Direct Line Speech channel and transcribed to text, which appears in the window.
409-
<!--
410-
![Successful bot response](media/voice-assistants/quickstart-cs-uwp-bot-successful-turn.png)
411-
-->
412-
## Next steps
413377

414-
> [!div class="nextstepaction"]
415-
> [Create and deploy a basic bot](https://docs.microsoft.com/azure/bot-service/bot-builder-tutorial-basic-deploy?view=azure-bot-service-4.0)
416-
417-
## See also
378+
## Next steps
418379

419-
- [About voice assistants](voice-assistants.md)
420-
- [Get a Speech service subscription key for free](get-started.md)
421-
- [Custom keywords](speech-devices-sdk-create-kws.md)
422-
- [Connect Direct Line Speech to your bot](https://docs.microsoft.com/azure/bot-service/bot-service-channel-connect-directlinespeech)
423-
- [Explore C# samples on GitHub](https://aka.ms/csspeech/samples)
380+
[!INCLUDE [footer](./footer.md)]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: 'Quickstart: Create a custom voice assistant - Speech service'
3+
titleSuffix: Azure Cognitive Services
4+
services: cognitive-services
5+
author: trrwilson
6+
manager: nitinme
7+
ms.service: cognitive-services
8+
ms.subservice: speech-service
9+
ms.topic: include
10+
ms.date: 03/20/2020
11+
ms.author: travisw
12+
---
13+
14+
In this quickstart, you will use the [Speech SDK](~/articles/cognitive-services/speech-service/speech-sdk.md) to create a custom voice assistant application that connects to a bot that you have already authored and configured. If you need to create a bot, see [the related tutorial](~/articles/cognitive-services/speech-service/tutorial-voice-enable-your-bot-speech-sdk.md) for a more comprehensive guide.
15+
16+
After satisfying a few prerequisites, connecting your custom voice assistant takes only a few steps:
17+
> [!div class="checklist"]
18+
> * Create a `BotFrameworkConfig` object from your subscription key and region.
19+
> * Create a `DialogServiceConnector` object using the `BotFrameworkConfig` object from above.
20+
> * Using the `DialogServiceConnector` object, start the listening process for a single utterance.
21+
> * Inspect the `ActivityReceivedEventArgs` returned.

0 commit comments

Comments
 (0)