This sample demonstrates how to recognize speech with C++ using the Speech SDK for Windows. 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 Windows PC with a working microphone.
- Microsoft Visual Studio 2017, Community Edition or higher.
- The Desktop development with C++ workload in Visual Studio and the NuGet package manager component in Visual Studio. You can enable both in Tools > Get Tools and Features, under the Workloads and Individual components tabs, respectively.
- 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.
- 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
helloworld.cpp
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
- 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.
- On a 64-bit Windows installation, choose
- Press Ctrl+Shift+B, or select Build > Build Solution.
Note If you are seeing red squigglies from IntelliSense for Speech SDK APIs, right-click into your editor window and select Rescan > Rescan Solution to resolve.
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.