Share via


AudioCaptureRaw-Console C++ Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Overview

When you run this sample, the audio capture starts immediately. A command window is also displayed to allow you to stop the capture of audio data.

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::NuiAudioArrayID method Get the USB id of the microphone array.

The Kinect for Windows sensor has a 4-microphone array. This sample demonstrates how to use the sensor as a standard audio input device for Windows and therefore capture and process audio. This sample captures audio and stores it in a standard 4-channel .wav audio file at the following path:

          C:\Users\your_user_name\Music\KinectAudio-HH-MM-SS.wav
        

where:

  • your_user_name will be filled in with your user name.
  • HH-MM-SS is the timestamp (the time the audio was created) in hours, minutes, and seconds.

The sample captures audio in shared mode using the timer-driven programming model which means the audio stream is available to multiple processes. The audio data is copied out of the audio stream into a separate buffer under the control of the sample.

For more information about audio, see Capturing Audio Data in C#.

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.