Share via


AudioBasics-WPF C# Sample

Kinect for Windows 1.5, 1.6, 1.7, 1.8

Overview

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.

  • A text indicator displays the audio beam angle, the angle of the most recent sound source, and the confidence of the most recent sound source.

The Sample Uses the Following APIs To Do This
KinectSensor.KinectSensors Property Get the Kinect sensors that are plugged in and ready for use.
KinectStatus.Connected enumeration value Indicate that the given Kinect sensor is fully connected and ready to send data.
KinectSensor.Status Property Get the current status of the given Kinect sensor.
KinectSensor.Start Method and KinectSensor.Stop Method Start or stop the sensor.
KinectAudioSource.Start Method and KinectAudioSource.Stop Method Start or stop the streaming of audio data.
KinectAudioSource.BeamAngleChanged Event Add an event handler for a BeamAngleChanged event. This event is fired when the sensor changes the direction it is tuned for listening.
KinectAudioSource.SoundSourceAngleChanged Event Add an event handler for a SoundSourceAngleChanged event. This event is fired when the Kinect sensor detects a new sound source. In noisy environments, this event can fire very frequently.

For additional 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.