Talking head

From Wiki for iCub and Friends
Jump to: navigation, search

Audio configuration

The head is equipped with two USB sound cards, identified by the system with the names:

  • (1) Texas Instruments Japan
  • (2) Via Technologies, Inc.

The complete list of all USB devices is obtained with the command:


The system has to be configured in order to set (1) as default playback device, (2) as default recording devices. Both the sound cards are handled by the same driver (snd-usb-audio), wrapped by ALSA. If the board ids are not manually specified, the system may assign arbitrary (swapped) ids depending on which is the first usb device to answer during the boot. It's thus mandatory to edit (or create if not present) the file /etc/modprobe.d/alsa.conf containing the following lines:

options snd slots=snd-usb-audio
options snd-usb-audio index=1 vid=0x08bb pid=0x27c4
options snd-usb-audio index=2 vid=0x040d pid=0x3400

Note that the vid and pid values are obtained for the two sound cards using the lsusb command. index=1 is the Texas instruments sound card, index=2 is the Via Technologies sound card. After setting the boards ids, it's necessary to set which is the default board for playback and recording. This is done by manually editing the file /usr/share/alsa/alsa.conf, adding the following lines at the end of the pcm section (and before ctl section)

pcm.!default {
        type asym
        playback.pcm {
                type plug
                slave.pcm "hw:0,0"
        capture.pcm {
                type plug
                slave.pcm "hw:2,0"

Testing audio system

Basic tools to test the audio system are: Festival (text to speech generator), audacity (audio editing with gui)

sudo apt-get install festival
sudo apt-get install audacity

To generate text interactively from the festival command line:

(SayText "hello")

To generate a .wav file from a text file:

cat letter.txt | text2wave -o letter.wav

To play a .wav file:

aplay letter.wav

To record a .wav file

arecord -f cd test.wav

To edit a wav file:

audacity test.wav