This sample demonstrates how to translate speech with C# under .NET Core 2.0 (Windows or Linux) using the Speech SDK. See the accompanying article on the SDK documentation page which describes how to build this sample from scratch in Visual Studio 2017.
-
A subscription key for the Speech service. See Try the speech service for free.
-
A PC (Windows x64, Ubuntu 16.04/18.04 x64) with 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):
- .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, run the following commands for the installation of required packages:
sudo apt-get update sudo apt-get install build-essential 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.
-
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.
-
Edit the
Program.cs
source:- Replace the string
YourSubscriptionKey
with your own subscription key. - Replace the string
YourServiceRegion
with the service region of your subscription. For example, replace withwestus
if you are using the 30-day free trial subscription.
- Replace the string
-
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.
Run the following command from the directory that contains this sample:
dotnet helloworld/bin/Debug/netcoreapp2.0/helloworld.dll