This sample demonstrates various forms of speech recognition, intent recognition, and translation using the Speech SDK for C#. It runs under .NET Core 2.0 on Windows or Linux (Ubuntu 16.04 or 18.04 x64 only).
-
A subscription key for the Speech service. See Try the speech service for free.
-
A PC (Windows x64, Ubuntu 16.04 or 18.04 x64); some sample scenarios require a working microphone.
-
Either one of the following:
- On Windows:
- Microsoft Visual Studio 2017, Community Edition or higher.
- The .NET Core cross-platform development workload in Visual Studio. You can enable it in Tools > Get Tools and Features.
- On Windows or Linux (Ubuntu 16.04 or 18.04):
- .NET Core 2.0
- On Windows you also need the Microsoft Visual C++ Redistributable for Visual Studio 2017 for your platform.
- On Windows:
-
On Ubuntu 16.04 or 18.04, run the following commands for the installation of required packages:
sudo apt-get update sudo apt-get install libssl1.0.0 libasound2 wget
-
By building this sample you will download the Microsoft Cognitive Services Speech SDK. By downloading you acknowledge its license, see Speech SDK license agreement.
-
Download the sample code to your development PC.
Note: make sure to download the complete set of samples, not just this directory. This sample references code in the directory ../../sharedcontent/console, which is shared across samples.
-
If you are using Microsoft Visual Studio 2017 on Windows:
- Start Microsoft Visual Studio 2017 and select File > Open > Project/Solution.
- Navigate to the folder containing this sample, and select the solution file contained within it.
-
To tailor the sample to your configuration, use search and replace across the whole solution (for example, in Visual Studio, via Edit > Find and Replace > Quick Replace) to update the following strings:
YourSubscriptionKey
: replace with your subscription key.YourServiceRegion
: replace with the region your subscription is associated with. For example,westus
ornortheurope
.YourEndpointId
(optional): replace with the endpoint ID of your customized model in CRIS.- The following settings apply for intent recognition powered by the Language Understanding service (LUIS):
YourLanguageUnderstandingSubscriptionKey
: replace with your Language Understanding service subscription key (endpoint key).YourLanguageUnderstandingServiceRegion
: replace with the region associated with your Language Understanding service subscription.YourLanguageUnderstandingAppId
: replace with the ID of a Language Understanding service application that you want to recognize intents with.YourLanguageUnderstandingIntentName1
,YourLanguageUnderstandingIntentName2
,YourLanguageUnderstandingIntentName3
: replace with names of intents that your Language Understanding service application recognizes.
-
If you are using Microsoft Visual Studio 2017 on Windows, press Ctrl+Shift+B, or select Build > Build Solution.
-
If you are using the .NET Core CLI, run the following command from the directory that contains this sample:
dotnet build helloworld/helloworld.csproj
To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.
The app displays a menu that you can navigate using your keyboard. Choose the scenarios that you're interested in.
Run the following command below from the directory that contains this sample. (We assume we did you performed a Debug build earlier)
cd samples/bin/Debug/netcoreapp2.0
dotnet samples.dll
The app displays a menu that you can navigate using your keyboard. Choose the scenarios that you're interested in.