Making the Playstation Eye’s microphones work on Linux
Introduction
I'm the proud owner of a PlayStation® Move system and also a proud user of the Arch Linux distribution. As much as pride is concerned, it's not very “proudful” when you decide to give your PlayStation® Eye (PS3 Eye) a try as a webcam, and you realize it doesn't quite work as you expected. This post investigates this issue and proposes a solution.
Even though the PS3 Eye is supported by Linux 2.6.29 and above 1, and the video worked fine for me. The audio did not… :/
All I wanted was to see something similar to the following image. Keep reading if you want to know how to do it.
The problem
As one can see, by the output of the following command, my system had no trouble recognizing the PS3 Eye as a sound “card”:
$ cat /proc/asound/cards
0 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xfbff8000 irq 43
1 [CameraB409241 ]: USB-Audio - USB Camera-B4.09.24.1
OmniVision Technologies, Inc. USB Camera-B4.09.24.1 at usb-0000:00:1d.0-1.1, hi
(Un)Fortunately, I don't really use ALSA directly. Instead, as most kids these days, I use the PulseAudio sound server to manage the access to my sound card. So, even though ALSA can recognize the PS3 Eye microphone array just fine, PulseAudio can't2.
Once you understand what you want to do, and who is responsible for it, the solution is quite easy.
The solution
Fortunately, PulseAudio supports configuration files and comes with good
documentation. Upon startup, its daemon reads and interprets the files
~/.pulse/default.pa
and /etc/pulse/default.pa
. Thus, all we have to do is
to instruct PulseAudio to look for the PS3 Eye when loading.
In our case, we want to add a new alsa audio source, and adding the line
"load-module module-alsa-source device=hw:1,0"
to /etc/pulse/default.pa
does the trick for the whole system. Or, in the shell:
$ sudo echo "load-module module-alsa-source device=hw:1,0" >> /etc/pulse/default.pa
How can I know what to pass as an argument to device?
You might be asking yourself that question. Fear not, dear friend. With ALSA,
you can always take a look at the /proc/asound/cards file. There, you will see
the index of your device. On my case, the PS3 Eye was on line 1 with the label
CameraB409241. Then, for the PS3 Eye, you will want the stream with index zero.
Thus, hw:1,0 is our device. The directory /proc/asound/card<index>
will
contain all the information you might need about your card.
A small problem
It seems like the PS3 Eye must be connected when the PulseAudio daemon is
brought up. To prevent from having to logout/login, you can use the pacmd
command. It supports the same syntax of the /etc/pulse/default.pa
file. So,
calling
$ pacmd load-module module-alsa-source device=hw:1,0
Will work just fine.