Summary

2013-10: The support is now in the stable branch (updated below accordingly).

2011-07-18: Zarvox (the author of the audio branch) got his branch merged into the unstable libfreenect branch, I updated the commands accordingly.

The MS Kinect device features a microphone array (4 microphones). The free driver “libfreenect” is very active and a development branch is already containing audio recording support. In this page, I just explain the command to run to record 4 “.wav” files using the kinect under linux.

Let's do it

You need to have “git” installed and you'll probably need some software packages like “cmake” and “libusb-1.0.0-dev” if you don't have it yet. We first get the kinect project from github and merge the audio branch with the latest main branch.

# clone the libfreenect repository
git clone https://github.com/OpenKinect/libfreenect.git
cd libfreenect

# setup the repository containing the audio branch
git remote add zarvox https://github.com/zarvox/libfreenect.git
git fetch zarvox
# create a local branch that merges the audio branch and the main one
git checkout zarvox/audio -b myaudio
git merge origin/master

# get the unstable branch
git checkout unstable

Once we get everything, we just need to build it “as usual” but with a dedicated option:

mkdir build
cd build
cmake -DBUILD_AUDIO=true ..
# ^ for this one to work, you might need to install missing packages

make
# ^ needs network to download from MS website (can be a little long)
        

If the build went fine, you will get a “bin/” directory with various executables. The first time you run one of the executable, it needs to send some “firmware” to the kinect. That's why, you should first run one executable from within the “build” directory. Afterwards, you can run from anywhere.

# run from the build directory
sudo bin/glview

# do some recording using the four microphones
mkdir recording-1
cd recording-1
sudo ../bin/wavrecord
# Ctrl-C to stop recording
# => creates 4 files channel1.wav ... channel4.wav

# (optionnaly) to hear what the kinect heard:
sox -M channel4.wav channel1.wav mix41.wav
        

I hope this was useful.
Thanks to Zarvox for his branch and support.
In case of problems, questions or remarks, just contact me at click-me ;-p @nospam.com.