AudioBasics-D2D C++ Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8


When you run this sample, you see the following:

  • A real-time visualization of the audio signal strength displayed as a scrolling waveform.
  • An arrow indicating the audio beam direction, which is the direction the sensor is best tuned for listening. The audio beam direction may take some time to update when the sound source direction changes because in noisy environments, constantly changing the listening direction to match the most recent loud sound can be computationally expensive.
  • A sound source direction indicator shown as a shaded semicircular bar under the audio beam indicator. This indicator displays both the direction of the most recent sound source, and the confidence the sensor has in the detection of the direction. Confidence in the direction can be very low in noisy environments, unless the foreground sound is much louder than the background noise.

    The shading of the indicator is darkest in the direction of the most recent sound source. If there is low confidence in the direction, the shading will cover most of the indicator. If there is high confidence in the direction, the shading will cover only a small portion of the indicator.

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_COLOR constantInitialize the sensor to stream out color data.
CreateEvent functionCreate an event that will be signaled when color data is available by returning an event handle.
INuiSensor::NuiImageStreamOpen method, NUI_IMAGE_TYPE_COLOR constant, and NUI_IMAGE_RESOLUTION_640x480 constant, and the event handleOpen a color stream to receive color data.
INuiSensor::NuiImageStreamGetNextFrame methodOpen a stream (with the event just created) for storing color data from the sensor.
INuiSensor::NuiImageStreamReleaseFrame methodRelease each frame of color data after saving it.
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.

Community Additions