Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

C# Console app for .NET Framework on Windows

This sample demonstrates various forms of speech recognition, intent recognition, and translation using the Speech SDK for C#. It runs under the .NET Framework 4.6.1 (or above) on Windows.

Note: this sample is also available in a version for .NET Framework on Windows.

Prerequisites

  • A subscription key for the Speech service. See Try the speech service for free.
  • A Windows PC; some sample scenarios require a working microphone.
  • Microsoft Visual Studio 2017, Community Edition or higher.
  • The .NET desktop development workload in Visual Studio. You can enable it in Tools > Get Tools and Features.

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.

    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.

  • 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, 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 or northeurope.
    • 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.
    • The following settings apply to keyword-triggered recognition:
      • YourKeywordRecognitionModelFile.table: replace with the location of your keyword recognition model file.
      • YourKeyword: replace with the phrase your keyword recognition model triggers on.
  • Set the active solution configuration and platform to the desired values under Build > Configuration Manager:

    • On a 64-bit Windows installation, choose x64 as active solution platform.
    • On a 32-bit Windows installation, choose x86 as active solution platform.
  • Press Ctrl+Shift+B, or select Build > Build Solution.

Run the sample

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.

References