Export (0) Print
Expand All

Speech Basics-D2D C++ Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Hh973079.note(en-us,IEB.10).gifNote
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.

Overview

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 APIsTo Do This
NuiGetSensorCount functionGet the number of sensors that are ready for use.
NuiCreateSensorByIndex function and INuiSensor interfaceCreate an interface that represents a connected sensor.
INuiSensor::NuiStatus methodCheck the sensor status to see if the sensor is connected.
INuiSensor::NuiInitialize method and NUI_INITIALIZE_FLAG_USES_AUDIO constantInitialize the sensor to stream out audio.
NuiGetAudioSource functionGet the audio source.
ISpRecognizer (SAPI 5.4) interfaceControl the speech recognition engine.
ISpRecoGrammar (SAPI 5.4) interfaceManage the words and phrases that the speech recognition engine recognizes.
ISpEventSource (SAPI 5.4) interfaceConfigure events that will notify the application when speech is recognized by the speech recognition engine.
INuiSensor::Release methodRelease 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.

Community Additions

ADD
Show:
© 2014 Microsoft