Skip to content

Latest commit

 

History

History
 
 

csharp-dotnetcore

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Quickstart: Recognize speech in C# under .NET Core (Windows, macOS, or Linux)

This sample demonstrates how to recognize speech with C# under .NET Core 2.0 (Windows, macOS, 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.

Note: on Linux, we currently only support x64 with the Ubuntu 16.04, Ubuntu 18.04, or Debian 9 distribution.

Prerequisites

  • A subscription key for the Speech service. See Try the speech service for free.

  • A PC (Windows x64, Ubuntu 16.04 x64, Ubuntu 18.04 x64, or Debian 9 x64) or Mac (macOS 10.13 or later) with a working microphone.

  • Either one of the following:

  • 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
  • On Debian 9, run the following commands for the installation of required packages:

    sudo apt-get update
    sudo apt-get install libssl1.0.2 libasound2

Build the sample

  • 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.

  • 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 with westus if you are using the 30-day free trial subscription.
  • 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

Run the sample

Using Visual Studio 2017

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.

Using the .NET Core CLI

Run the following command from the directory that contains this sample:

dotnet helloworld/bin/Debug/netcoreapp2.0/helloworld.dll

References