If you define USE_AUDIO constant before including NtKinect.h, the functions and variables of NtKinect related to audio become effective.
If you call the setAudio() function, Audio data is acquired, and saved to the file if recording is in progress. To end recording, call closeAudioFile() function.
type of return value | function name | descriptions |
---|---|---|
void | setAudio(bool flag = false) |
Acquire audio and save it in a file during recording
|
void | drawAudioDirection(cv::Mat& image ) | Draw the direction of audio beam on image. |
bool | isOpenedAudio() | Returns whether or not recording is in progress. |
void | openAudio(string path ) | Open path as a recording file |
void | closeAudio() | Close the recording file. |
type | variable name | descriptions |
---|---|---|
float | beamAngle | Direction of audio (angle to the left and right) |
float | beamAngleConfidence | Confidence value of beamAngle (0.0 ... 1.0) |
UINT64 | audioTackingId | Speaker's skeletonTrackingId |
Download a little modified WaveFile.h of "AudioCaptureRaw-Console C++ Sample" by Microsoft, and place it in the folder where other souce files (such as main.cpp) are located. Then, add it to the project.
Define USE_AUDIO constant before including NtKinect.h.
Call the openAudioFile() function to start recording, and closeAudioFile() to end recording. Audio is acquired with setAudio() function, and audio is automatically saved in the file during recording.
In the example program below, we create a WAV file whose name is current time like "2016-07-18_09-16-32.wav".
main.cpp |
|
Recording starts with 'r' key, and stops with 's' key. Recording status is displayed as "Recording" or "Stopped" at the upper left of the RGB image.
Since the above zip file may not include the latest "NtKinect.h", Download the latest version from here and replace old one with it.