Getting BBB working with pyAudio and USB Audio card

I’m trying to get pyAudio operational with a C-media mic/speaker card on a beaglebone black running ubuntu 13.04.
After many permutations of attempts, I’m seeking help here - as I simply cannot get the combination of configuration and pyAudio to play nice here.

I’ve disabled the HDMI by modifying uEnv.txt: optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

And I see my sound card listed:

root@ubuntu-armhf:/home/ubuntu# cat /proc/asound/devices
2: [ 1- 0]: digital audio playback
3: [ 1- 0]: digital audio capture
4: [ 1] : control
33: : timer

and:

root@ubuntu-armhf:/home/ubuntu# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

Simple python code fails:

import pyaudio
p=pyaudio.PyAudio()
s=p.open(format=pyaudio.paInt16,input_device_index=1,channels=1,rate=44100,input=True,frames_per_buffer=1024)

with the following errors:

root@ubuntu-armhf:/home/ubuntu# python audio_test.py
ALSA lib confmisc.c:768:(parse_card) cannot find card ‘0’
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory

Attempts to change the default card to ‘0’ have failed as well. 2 Examples:

  1. Per: http://ubuntuforums.org/showthread.php?t=1313071, adding

root@ubuntu-armhf:/etc/modprobe.d# tail -1 alsa-base.conf
options snd-card-usb-caiaq index=0

does not seem to set the default card to 0 (this is the setting used above)

  1. Changing asound.conf per: http://feipengy.no-ip.biz/blog/2013/12/09/enable-audio-in-beaglebone-black/
    Similar failure is observed from pyAudio.

Any ideas? I suspect I’m missing something really obvious here.

I don’t know why this traceback is printed, but it does not seem to affect performance. Try to use the soundcard dispite the traceback.