Speech Basics-D2D C++ Sample
Kinect for Windows 1.5, 1.6, 1.7, 1.8
|This sample requires that you install the Microsoft Speech Platform SDK (see the software requirements to download the Speech SDK). See the section below for a special note about the default installation path.|
When you run this sample, you see the following:
- A turtle that moves based on the speech commands that you give it. The sample recognizes the following commands: "forward", "back", "turn left", and "turn right".
|The Sample Uses the Following APIs||To Do This|
|NuiGetSensorCount function||Get the number of sensors that are ready for use.|
|NuiCreateSensorByIndex function and INuiSensor interface||Create an interface that represents a connected sensor.|
|INuiSensor::NuiStatus method||Check the sensor status to see if the sensor is connected.|
|INuiSensor::NuiInitialize method and NUI_INITIALIZE_FLAG_USES_AUDIO constant||Initialize the sensor to stream out audio.|
|NuiGetAudioSource function||Get the audio source.|
|ISpRecognizer (SAPI 5.4) interface||Control the speech recognition engine.|
|ISpRecoGrammar (SAPI 5.4) interface||Manage the words and phrases that the speech recognition engine recognizes.|
|ISpEventSource (SAPI 5.4) interface||Configure events that will notify the application when speech is recognized by the speech recognition engine.|
|INuiSensor::Release method||Release the sensor when you exit the application.|
To run a sample you must have the Kinect for Windows SDK installed. To compile a sample, you must have the developer toolkit installed. The latest SDK and developer toolkit are available on the developer download page. If you need help installing the toolkit, look on this page: To Install the SDK and Toolkit. The toolkit includes a sample browser, which you can use to launch a sample or download it to your machine. To open the sample browser, click Start > All Programs > Kinect for Windows SDK [version number] > Developer Toolkit Browser.
If you need help loading a sample in Visual Studio or using Visual Studio to compile, run, or debug, see Opening, Building, and Running Samples in Visual Studio.
Speech SDK Installation Path
The Speech SDK does not create an environment variable to hold the install location. Therefore, any C++ project file (*.vcxproj extension) that uses speech needs to reference the following install location:
For x86: $(ProgramFiles)\Microsoft SDKs\Speech\v11.0\ For x64: $(ProgramFiles)\Microsoft SDKs\Speech\v11.0\
In a project file, the install location looks like this:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <IncludePath>$(ProgramFiles)\Microsoft SDKs\Speech\v11.0\Include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(KINECTSDK10_DIR)\inc</IncludePath> <LibraryPath>$(ProgramFiles)\Microsoft SDKs\Speech\v11.0\Lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(KINECTSDK10_DIR)\lib\x86</LibraryPath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <IncludePath>$(ProgramFiles)\Microsoft SDKs\Speech\v11.0\v11.0\Include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(KINECTSDK10_DIR)\inc</IncludePath> <LibraryPath>$(ProgramFiles)\Microsoft SDKs\Speech\v11.0\Lib;$(FrameworkSDKDir)\lib\x64;$(KINECTSDK10_DIR)\lib\amd64;$(LibraryPath)</LibraryPath> </PropertyGroup>
This applies if you install the Speech SDK to the default install location. If you choose to install the SDK to a different location, you will have to update the path accordingly.